Results 1 to 11 of 11

Thread: More XHTML Help

  1. #1
    Ah, Mrs. Peel! mike_w's Avatar
    Join Date
    Oct 2003
    Location
    Hertfordshire, England
    Posts
    3,326
    Thanks
    3
    Thanked
    9 times in 7 posts

    More XHTML Help

    Me again

    Essentially, after getting rid of frames, the links on my website (navigation between the different pages, not external links) have to be part of each page. While this works fine, it makes the process of adding a single link tedious since I have to update every page with the new link. Is there anyway to avoid this? e.g. add some kind of reference that will insert a piece of code from a separate file, so that you only to update the separate code to update all the pages.

    If any of that doesn't make sense (which is extremely likely) please tell me!

    Thanks

    Mike
    "Well, there was your Uncle Tiberius who died wrapped in cabbage leaves but we assumed that was a freak accident."

  2. #2
    Bigger than Jesus Norky's Avatar
    Join Date
    Feb 2005
    Posts
    1,579
    Thanks
    1
    Thanked
    8 times in 8 posts
    Create a new file called navigation.htm or something similar, this will contain solely the navigation html (no <html>, <body> etc!)

    In your main page where you want the navigation to appear, use this code:

    <?php include 'navigation.html'; ?>

    You will need to rename the file extension on all the pages with this php in to .php (eg. index.php)

  3. #3
    Ah, Mrs. Peel! mike_w's Avatar
    Join Date
    Oct 2003
    Location
    Hertfordshire, England
    Posts
    3,326
    Thanks
    3
    Thanked
    9 times in 7 posts
    I had thought of php, but I didn't know whether the server I use would support it. Well, one way to find out!

    Thanks

    Mike

    Edit: After I uploaded the page as PHP, and tried to access it, the page simply displayed the code. I assume that means that the server doesn't support PHP?
    Last edited by mike_w; 16-03-2005 at 11:09 PM.
    "Well, there was your Uncle Tiberius who died wrapped in cabbage leaves but we assumed that was a freak accident."

  4. #4
    Flak Monkey! Dorza's Avatar
    Join Date
    Jul 2003
    Location
    UK - South Wales
    Posts
    1,762
    Thanks
    34
    Thanked
    17 times in 15 posts
    • Dorza's system
      • Motherboard:
      • Asus P5B Deluxe - WiFi
      • CPU:
      • Q6600 @ 3.06Ghz
      • Memory:
      • 2GB Crucial
      • Storage:
      • 500GB Samsung SpinPoint
      • Graphics card(s):
      • Geforce 9600GT
      • PSU:
      • Cosair HX520W
      • Case:
      • LianLi something something or other
      • Monitor(s):
      • Eizo FlexScan S1910 (1280*1024)
      • Internet:
      • 2mb Virgin (when they want to give me that: else 1mb)
    Whos ur host?

    You can test ur host to c if they provide PHP. I would have thought that most paid for hosts these days provide PHP support.

    Code:
    <html>
    <head>
    <title> PHP Test Script </title>
    </head>
    <body>
    <?php
    phpinfo( );
    ?>
    </body>
    </html>
    You can test it with the above code. Just save the file as .php and upload it then navigate to it. If it works it should display a load of bumpf about the PHP used on the server.
    Last edited by Dorza; 16-03-2005 at 11:43 PM.

  5. #5
    HEXUS.net Webmaster
    Join Date
    Jul 2003
    Location
    UK
    Posts
    3,108
    Thanks
    1
    Thanked
    0 times in 0 posts
    Nope, you don't have PHP support if it displays the code. Unfortunately with static HTML there is no easy way to update multiple pages unless you use something like Templates in Dreamweaver or your coding application has a good find and replace. You can use server side includes but to be honest they're more trouble than they're worth.

    If you're really determined to have it maintained centrally then you need a simple javascript array which contains the URLs then load that javascript into the page and use document.write to write the URL in from the central array.

    If you can move to a host that supports PHP and MySQL or upgrade your package then that will give you far more options.

  6. #6
    Senior Member
    Join Date
    Nov 2003
    Location
    central london
    Posts
    215
    Thanks
    0
    Thanked
    0 times in 0 posts
    SSI? server side includes?
    Code:
    <!--#include virtual="/navigation.html" -->
    a howto is available here.



  7. #7
    Ah, Mrs. Peel! mike_w's Avatar
    Join Date
    Oct 2003
    Location
    Hertfordshire, England
    Posts
    3,326
    Thanks
    3
    Thanked
    9 times in 7 posts
    Well, I've sent an e-mail off to my webspace provider (free space with my ISP), but I'm not too hopefull!

    However, even if I can't use it, I would still like to able to try PHP - is there anyway to run the PHP code from my own computer? (I have a Windows 2000 computer and a Debian computer, if that makes any difference)
    "Well, there was your Uncle Tiberius who died wrapped in cabbage leaves but we assumed that was a freak accident."

  8. #8
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts
    IIS can handle PHP, but it would be best if you downloaded Apache though as it is PHP's 'native' environment.

    For ease of use though, use IIS and PHP.

    For your Nav problem, you could use templates in dreamweaver or find out if your ISP has cgi-bin or perl support, it'd be very easy to make a pl navigation SSI.
    To err is human. To really foul things up ... you need a computer.

  9. #9
    HEXUS.net Webmaster
    Join Date
    Jul 2003
    Location
    UK
    Posts
    3,108
    Thanks
    1
    Thanked
    0 times in 0 posts
    To make life easy get WAMP from www.wampserver.com. It will install Apache, PHP and MySQL for you

  10. #10
    Registered+
    Join Date
    Mar 2005
    Posts
    26
    Thanks
    0
    Thanked
    0 times in 0 posts
    Quote Originally Posted by mike_w
    is there anyway to run the PHP code from my own computer? (I have a Windows 2000 computer and a Debian computer, if that makes any difference)
    Debian is best, you can use "apt-get install apache php4" , I found this link :-

    http://www.gcolpart.com/howto/apache.php4

    Sorry it's in French! I haven't tried this method myself but it should get you started. There is more to it than that (but there would be in windows anyway).

    You will need to decide your web root (eg /home/$USER/public_html ) and alter /etc/apache/httpd.conf (<Directory\> and <VirtualHost> directives). The docs at http://httpd.apache.org/docs should help too. You'll find it fiddly the first time however you proceed but it will be worth it.

  11. #11
    HEXUS.net Webmaster
    Join Date
    Jul 2003
    Location
    UK
    Posts
    3,108
    Thanks
    1
    Thanked
    0 times in 0 posts
    Or just use wampserver on windows which involves clicking a setup.exe file and thats it

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. www.hexus.net valid XHTML 1.0 + valid CSS 2 ?
    By LWA in forum HEXUS Suggestions
    Replies: 4
    Last Post: 29-12-2014, 12:08 PM
  2. Very simple XHTML layout. Impossible with XHTML?
    By southsider in forum Software
    Replies: 4
    Last Post: 08-12-2004, 04:59 PM
  3. Xhtml
    By mike_w in forum Software
    Replies: 38
    Last Post: 07-12-2004, 10:44 AM
  4. Invalid XHTML
    By Zathras in forum HEXUS Suggestions
    Replies: 3
    Last Post: 13-11-2004, 12:28 AM
  5. Xhtml
    By Gordy in forum Software
    Replies: 5
    Last Post: 15-03-2004, 06:54 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
  •