+ Reply to Thread
Results 1 to 6 of 6

Thread: PHP Includes()

  1. #1
    NightFox is offline x10Hosting Member NightFox is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    3

    PHP Includes()

    Hey all,

    I am trying to display a table in my main page using includes, however i cannot understand how to use them without them being used for a header / footer (and it was working fine 2 hours ago). Any ideas as to wat i have done wrong would be appriciated I know that the way i'm using php atm is simple (Hello World) but i need to get this working first before i can continue with the rest.

    File to be includednewsrecent.php)
    Code:
    			<table cellpadding="0" cellspacing="5">
    				<tr>
                    <!--Recent Threads-->
    					<td><?php echo "Hello World"; ?>&nbsp;</td>
    			  </tr>
    				<tr>
    					<td>&nbsp;</td>
    			  </tr>				
    				<tr>
    					<td>&nbsp;</td>
    			  </tr>				
    				<tr>
    					<td>&nbsp;</td>
    			  </tr>				
    				<tr>
    					<td>&nbsp;</td>
    			  </tr>						
    				<tr>
    					<td>&nbsp;</td>
    			  </tr>									
    			</table>
    File linking to the includeindex.php)
    Code:
    <div id="rheadlines">
    <?php include(newsrecent.php) ?>
    		</div>
    Regards

    NightFox
    Last edited by NightFox; 01-20-2009 at 02:54 PM.

  2. #2
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    Re: PHP Includes()

    it might/might not do anything, but i think a correct code is important

    PHP Code:
    <div id="rheadlines">
    <?php include("newsrecent.php"); ?>
            </div>

  3. #3
    NightFox is offline x10Hosting Member NightFox is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    3

    Re: PHP Includes()

    Heh thanks for letting me know - it worked

    funny how its the simple things that go wrong

  4. #4
    lordskid is offline x10Hosting Member lordskid is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    41

    Re: PHP Includes()

    are you sure it worked? I was pretty sure that you should do it this way.
    PHP Code:
    <?php include "newsrecent.php"?>
    but then again if it worked then it worked. I'll take note of that too.

  5. #5
    Livewire's Avatar
    Livewire is offline Abuse Compliance Officer Livewire is a glorious beacon of lightLivewire is a glorious beacon of light
    Join Date
    Jun 2005
    Location
    Behind a keyboard.
    Posts
    8,998

    Re: PHP Includes()

    Quote Originally Posted by lordskid View Post
    are you sure it worked? I was pretty sure that you should do it this way.
    PHP Code:
    <?php include "newsrecent.php"?>
    but then again if it worked then it worked. I'll take note of that too.
    Include's a weird one - I've used it both ways and it seems to work both ways.

    The key is making sure the " or ' are there, otherwise it freaks out


    TOS breakers will be suspended regardless of race, creed, national origin, hair color, or favorite food. Thanks for your understanding!

  6. #6
    woiwky is offline x10 Lieutenant woiwky is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    390

    Re: PHP Includes()

    include() is a construct, not a function. Its syntax is similar to echo or return -- parentheses aren't required.
    "But you have access to the greatest source of knowledge in the universe."
    "Well I do talk to myself sometimes, yes."

    "I'm back, and I'm bad! Obviously within certain, sensible, preset parameters"

+ Reply to Thread

Similar Threads

  1. php errors galore
    By DMG Online in forum Scripts & 3rd Party Apps
    Replies: 9
    Last Post: 05-17-2008, 06:23 AM
  2. Free Development Web Software
    By Danfelbm in forum Graphics & Webdesign
    Replies: 1
    Last Post: 03-01-2008, 07:01 PM
  3. php problem
    By himgar in forum Free Hosting
    Replies: 1
    Last Post: 02-22-2008, 02:41 AM
  4. Cambios IMPORTANTES en PHP.
    By Fedlerner in forum Noticias y Anuncios
    Replies: 1
    Last Post: 11-06-2007, 11:13 AM
  5. PHP Includes dont work
    By chaganlal1 in forum Scripts & 3rd Party Apps
    Replies: 4
    Last Post: 05-06-2006, 05:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers