Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
  1. #1
    Junior Member
    Join Date
    Dec 2002
    Posts
    3
    Member #
    413
    Hi

    I am going to make a website shortly.

    I have a design, well it's just the top menu bars, and what i want to do is make the menu a server side include using php? So if i want to edit the links i just have to change one file and not every page as it will be a big site.

    Now, i have been told many things, one of them was this

    http://www.sport-talk.com/index2.shtml

    http://www.sport-talk.com/data.txt

    The data.txt should be the bit where i can edit the menubar without editing every page and have it show up on the pages.

    And that was to make the page and title it .shtml and add the code that was i did add (Which never worked, you will see when you click on it).

    As i say, i am a complete novice, so any help appreciated.

    Thanks

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    I'm a bit confused but if you're basically saying you want to port your SHTML to PHP, use this instead of SSI's includes:
    PHP Code:
    require("data.txt"); 
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    Junior Member
    Join Date
    Dec 2002
    Posts
    3
    Member #
    413
    I'm confused too.

    Bottom line is, all i want to do is be able to just edit one file when i want to add a link, thats what i got told to do above...To make that shtml page and .txt with the menubar code in it, but nothing shows up...So i don't really mind what way it gets done, just as long as i can.

    Thanks

  5. #4
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    In that case...

    1. Rename the pages from .shtml to .php
    2. Follow this format:
    Code:
    <html>
    .
    .
    .
    <body>
    .
    .
    .
    <? require("data.txt") ?>
    .
    .
    .
    </body></html>
    The bold line simply reads the contents of data.txt and inserts it in the same location, so when you update data.txt, all the pages appear to be updated.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  6. #5
    Junior Member
    Join Date
    Dec 2002
    Posts
    3
    Member #
    413
    YES!

    That works.

    Thanks man, appreciate it.

  7. #6
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Glad to help
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  8. #7
    410
    410 is offline
    Senior Member 410's Avatar
    Join Date
    Nov 2002
    Posts
    109
    Member #
    284
    filburt could he not of made <? include("data.txt") ?> would of done the same function right?

    this is one thing I don't understand about php, why there are a bunch of the same functions just wrote diffrent

  9. #8
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Posts
    1,132
    Member #
    250
    Liked
    15 times
    php.net

    require() and include() are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, don't hesitate to use require() if you want a missing file to halt processing of the page. include() does not behave this way, the script will continue regardless. Be sure to have an appropriate include_path setting as well.
    But I have to agree with you on this one
    There and Back Again :Ogre:

  10. #9
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    I've been in the habit of using require() because if the file should always be found, anyway, and having a PHP error in the middle of the page looks unprofessional IMO.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  11. #10
    410
    410 is offline
    Senior Member 410's Avatar
    Join Date
    Nov 2002
    Posts
    109
    Member #
    284
    o i see
    I will start using that then, I didn't know that require would stop the loading of the page.. humm I learned soemthing today.. lol

    BTW Merry x-mas


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:45 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com