-1

I’m using phplist as a newsletter program within a site. Phplist works in a fashion similar to running a site within a site, meaning it has it’s own css, js, image folders etc. I am trying to include() the index.php from its main folder on my outer or shell site (so to speak). I tried include(“/list/index.php”) and it included it. But, it tries to get the stuff like the css, etc. from the shell site.

How do I include the index from the subfolder and have it to also include it’s folders such as css, js, etc.?

Or, how do I get that included index to read the things it needs from the subfolder that it is inside?

What ever I do, I need to do it from the page in the shell site.

Or, is this even possible?

JSP254
  • 39
  • 1
  • 9
  • It all depends on how the path to the assets are defined within PHPList. If they are determined based on the current working directory you may be able to simply call `chdir` – Orangepill Jun 14 '13 at 04:39
  • It might be easier too to just include the whole thing into an iframe. – Orangepill Jun 14 '13 at 04:40
  • not sure if i follow you. the paths to the folders inside phplist acts as if phplist is the working directory. i think that's what you're asking. i need to be able to include the index fromn that subfolder and have it perform all it needs to based on it's very own css, etc. – JSP254 Jun 14 '13 at 04:42
  • well, i was trying to do something similar to an iframe, but without an iframe. – JSP254 Jun 14 '13 at 04:43
  • does it work properly inside the subdirectory (can you go to /list/ ) in your browser without if barfing? – Orangepill Jun 14 '13 at 04:44
  • yes. domain.dev/list/index.php shows the page. i have it set without headers, footers, head, body, etc. i planned on all of those things to be implemented from the shell website page. edit: sorry. that made the situation sound goofy. this part of the index.php pulls info from a config folder etc. within the subfolder. if i just include the index.php from the subfolder, it tries to find the config folder inside the shell or parent. – JSP254 Jun 14 '13 at 04:54
  • I get what you're saying... answer I have below **MAY** work... if not out of the box with a little tweaking – Orangepill Jun 14 '13 at 05:09

1 Answers1

0

This is a longshot but this might work for you.

Start an output buffer

ob_start();
$cwd = getcwd();
chdir(__DIR__."/list");

include the url from within the list directory.

include("list/index.php");
chdir($cwd);

Get the contents of the buffer and empty it.

$html = ob_get_clean();

Do a string replace to rewrite the urls

$html = str_replace("http://domain.dev/'",
                    "http://domain.dev/list/'",
                     $html);

Output the html

echo $html;
Orangepill
  • 24,500
  • 3
  • 42
  • 63