PHP Includes And Help

Discussion in 'HTML & Website Design' started by andymayo, Apr 7, 2008.

  1. #1
    here is my site. www.xninelivesx.com and i want the site wide linke to use an include script (if thats correct)

    i want this so i dont have to go through allpages to add 1 link... so annoying.

    help appreciated and if necessary payment available.
    + rep were appropriate
     
    andymayo, Apr 7, 2008 IP
  2. nicangeli

    nicangeli Peon

    Messages:
    828
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #2
    An example of how this could work for you,

    Take this piece of code,

    
    <div id="nav">
    
    		<!-- max nav items is 9 (<li>...</li> x9) -->
    		<ul>
    			<li><a href="/">Home		</a></li>
    			<li><a href="/forum">Forums</a></li>
    		  <li><a href="/clans">Clans</a></li>
    		  <li><a href="gaming/xbox-360.html">Xbox 360</a></li>
    		  <li><a href="gaming/PS3.html">PS3</a></li>
    
    		  <li><a href="gaming/pc-mac.html">PC/MAC</a></li>
    		  <li><a href="gaming/other-gaming.html">Other Gaming</a></li>
    		  <li><a href="http://www.xninelivesx.com/media.html">		Video/Media		</a></li>
    		  <li>
    			<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=matty@xninelivesx.com&item_name=xNineLivesx Gaming Community&no_shipping=0&no_note=1&tax=0&currency_code=GBP&lc=GB&bn=PP-DonationsBF&charset=UTF-8">Donate</a></li>
    	  </ul>
    
    	</div>
    
    
    Code (markup):
    and save it in a file called nav.php

    Then replace that block of code in your index page with,

    <?php
    include("nav.php");
    ?>

    You will also have to rename your index page index.php, presuming your host supports PHP. Then each time you need to edit the navigation you will only have to edit the nav.php file.

    Nicangeli
     
    nicangeli, Apr 7, 2008 IP
  3. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #3
    I read the initial post a little different than nicangeli but his answer is still correct.

    You just want to add outgoing links in this manner. You can use his format or you links may be a simple text file in this format with no head or body tags:

    html code for link one <br />
    html code for link two <br />
    html code for link three <br />
    html code for link four <br />

    Using this method will apply your existing CSS to the text on the page when it is included.
     
    Colbyt, Apr 7, 2008 IP
  4. andymayo

    andymayo Guest

    Messages:
    652
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    cheers ppl
     
    andymayo, Apr 7, 2008 IP
  5. WXM Matty

    WXM Matty Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hello I have tryed to use this and it works great but when I use it on other pages it cuts off half the page and does not display anything.

    Do I need to change the code somehow for each page?
     
    WXM Matty, Apr 7, 2008 IP