Hi,
I’m working on starting to clean up some of the php code I’m doing, and split out some of the HTML it uses.
I have a function that writes a bunch of HTML into a string, and then returns the string. It’s basically this:
[php]function create_content() {
$output = ‘’;
$output .= ’
some text
some other text
</article>
';
return $output;
}
[/php]It works like I want it to.
I was thinking I’d move the HTML code into a file.
So I created a file, “my_file.inc” which has in it:
[code]
some text
some other text
</article>
[/code]
And changed the funtion to instead include it
[php]function create_content() {
$output = ‘’;
$output .= include("./my_file.inc");
return $output;
}
[/php]
With the ‘include’, it finds the file, but the display of the content gets moved from where it it in the original way, and gets put above everything on my page.
I also tried ‘require’, ‘readfile’, and a bunch of other php commands instead of include.
I sometimes get the display but in the wrong place. Other times, I get no display at all. Sometimes I just see a “1” displayed.
But I never get the display from the file in the right place :-/
I think it has to do with wrong use of quotes, or something. I’ve been running around in circles on this for a couple of days. In the IRC they told me the stuff I tried above. Nothing helps.
I figured I needed to ask for some help here.
Anybody?
Thanks a lot!!