开发者

Using include() to load different page content acts differently locally vs hosted

I have a live site that includes different php files depending on what page the user is trying to access. The header and footer are the same, but in the file, if the user requests filename1.php vs filename2.php, a different php is loaded into the content of the page. Basic CMS stuff.

On the live site, it works fine. I just set up a local dev environment, and it doesn't work. The file that is supposed to load into the middle of the page instead is the only file loaded. I'm not saying this well. Here's an example:

How it works live:

<html>
    <head>
        Stuff
    </head>

    <body>
        More stuff
        <? include( 'some_file.php' ); ?>
    </body>
</html>

How it works locally:

<? include( 'some_file.php' ); ?>

Just that file loads, no other content.

Any thoughts on why that one page is loading, but not the surrounding content? If I'm not explaining this well, please let me know.

Edit:

This might be a better explanation? or not.. Anyway, it's like the included page, instead of loading into the middle of the index file, is loading instead of the index file.

Edit 2:

Here is what it looks like live, which can be seen at http://saloncosabella.com/our_team/meet_our_team : live http://img.skitch.com/20100510-j36r58pu6kjrmekexixh81f96i.jpg

And here is what it looks like locally: local http://img.skitch.com/20100510-q29f2uq34g5pp68w5ke77dddks.jpg

The html that shows up on the local site (not all that pretty, I know):

                    <a href="/our_team/meet_our_team?stylist=jamie.staton"><img src="/images/our_team/jamie.staton.png" class="thumbnail first_thumb" /></a><a href="/our_team/meet_our_team?stylist=torrey.staton"><img src="/images/our_team/torrey.staton.png" class="thumbnail" /></a><a href="/our_team/meet_our_team?stylist=brittany.benallo"><img src="/images/our_team/brittany.benallo.png" class="thumbnail" /></a><a href="/our_team/meet_our_team?stylist=victoria."><img src="/images/our_team/victoria..png" class="thumbnail" /></a><a href="/our_team/meet_our_team?stylist=tiahna.cristobal"><img src="/images/our_team/tiahna.cristobal.png" class="thumbnail" /></a><a href="/our_team/meet_our_team?stylist=christina.walker"><img src="/images/our_team/christina.walker.png" class="thumbnail" /></a><a href="/our_team/meet_our_team?stylist=kristen.pulst"><img src="/images/our_team/kristen.pulst.png" class="thumbnail" /></a><a href="/our_team/meet_our_team?stylist=allison.canino"><img src="/images/our_team/allison.canino.png" class="thumbnail" /></a><a href="/our_team/meet_our_team?stylist=lia."><img src="/images/our_team/lia..png" class="thumbnail" /></a><a href="/our_team/meet_our_team?stylist=alex.woodworth"><img src="/images/our_team/alex.woodworth.png" class="thumbnail" /></a><a href="/our_team/meet_our_team?stylist=lauren.hassett"><img src="/images/our_team/lauren.hassett.png" class="thumbnail" /></a><a href="?stylist_page=1开发者_如何学Python"><img src="/images/our_team/see_more.png" alt="See More" class="thumbnail" ></a>             <div class="clear"></div> 


Compare phpinfo() outputs on both servers. See what is different. Maybe that way you can determine why this happens.

Also, you could try a third server -- maybe some virtual machine already pre-configured for LAMPP. See what happens.

And last, try to make a simple test case, compare the results.


Maybe short tag is disabled on your local server. Check this variable,

short_open_tag


Are your scripts using output buffering? If the header area enables buffering, and your 'middle' include does an ob_end_clean() and doesn't preserve the returned buffer data, that would appear as if only the middle include was being displayed, even though everything was being generated properly.


Very very estrange...

Looks like the web server is not output anything out of the PHP tags...

Or maybe, the output doesn't start until the PHP module is needed.

¿Can you add the text <?php echo "hi"; ?> in the first line in the local file to check if it works?


Do you have an exit; in your php code? Removing any exit;s in my php solved the problem for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜