Page 1 of 1

Include files help

Posted: Thu Jul 02, 2009 3:23 pm
by deanaldo
Hi all, my first post here. I've been working on migrating some sites for a friend of mine onto a new web server and I've never had any experience of php at all, just HTML and CSS. I have installed PHP onto the web server and FTP'ed all the correct files down to the new web server. I seem to be having trouble with a few of the websites and it seems to be the same issue. A lot of the sites use the include coding for the headers and footers etc. and when I try to host the sites and access them locally, none of the include files are displayed.

Here is the code used in the index.php file:

Code: Select all

<body>
<div id="container">
    <div id="main">
        <div id="logo"><a href="index.php" title="Webpage title"><img src="images/template/logo_v3.gif" width="257" height="55" alt="Company Name" /></a></div>
        <div id="top_navigation">
            <? include '_incl/top_navigation.html'?>
        </div>
        <div id="banner" class="home">
            <p>Company text line one</p>
            <p>Company text line two</p>
            <p>Company text line three</p>
            <p><a href="contact.php" title="Contact company">Contact</a></p>
        </div>
        <div id="main_content">
            <h1>WELCOME</h1>
            company text<br />
            more company text
            <p>business history</p>
            <p>more business history</p>
            <p>more historu</p>
            <? include '_incl/hp_lead_modules.html'?>
            <p>
            </div>
        <div id="right_modules">
            <? include '_incl/module_latest_news.html'?>
            <? include '_incl/module_map.html'?>
            <? include '_incl/module_qualify.html'?>
        </div>
        <br clear="all" />
    </div>
    <? include '_incl/footer.html'?>
</div>
</body>
and here is some code from the top navigation include file:

Code: Select all

<script type="text/javascript" language="JavaScript1.2" src="js/business-name-top-navigation.js"></script>
 
Can anyone tell me whats wrong and why it wont display any of the includes files? I'm running it on IIS7 on Server 2008

Appreciate any advice or help,

Thanks

Re: Include files help

Posted: Thu Jul 02, 2009 3:46 pm
by deanaldo
McInfo wrote:Check if you have the "short_open_tag" option enabled. You can do this by looking in your php.ini file or by running this script.

Code: Select all

<?php
printf('short_open_tag = %d', ini_get('short_open_tag'));
?>
In my php.ini file its disabled, "short_open_tag= Off".

Re: Include files help

Posted: Thu Jul 02, 2009 3:56 pm
by deanaldo
McInfo wrote:For the script in your first post to run properly, you need to have the short_open_tag option turned on. In your php.ini file, change the appropriate line to

Code: Select all

short_open_tag = On
The other solution would be to change every "<?" to "<?php" in your PHP files.
Thank you for your help, I'll try that later on as I have to go out right now, I'll let you know how I get on :)

Re: Include files help

Posted: Fri Jul 03, 2009 3:59 am
by deanaldo
Thanks for your help, the short tags setting worked :D