SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast ReadyMade's Avatar
    Join Date
    Mar 2006
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow Need help getting to grips with php...

    I've been checking out some of the posts on here for answers, but I feel my problem would be better helped with some direct advice and suggestions realting to my problem.
    My website, http://www.stadium-arcadium.com is built using html. I've added a phpbb forum. From editing the phpbb files i've seen just how beneficial php will be to me. I've had no real experience with php before.

    Firstly, the navigation on the left column of my site needs to be updated for each page, which is time consuming. I know I could probably use frames but I would like to make it a global file like i've seen with the phpbb files. If I could make one file for the navigation that works on all pages then thats going to make my life a hell of a lot easier. I was also wondering just how easy it will be to transfer my current pages to php?

    If possible i'd just like some direction, some suggestions of what php tools to use, example scripts and tutorials etc to get me started.

    Thanks for your time. Always appreciated.

  2. #2
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You've made a good choice with PHP - it's a very flexible and easy-to-learn web language!

    From what I can see, you want to have the navigation in one file which is referenced from all the other ones, so that you can update it whenever you want with the changes being reflected on all your pages immediately. If that's what you want, then it's actually very easy.

    Just make a new file which contains only the navigation for the site, then in each of your pages where you want it to be shown, just include the following code:

    PHP Code:
    <?php include_once 'http://www.example.com/path/to/navigation.php'?>
    Wherever you put the above code, the navigation will be included at that point. You have to make sure, however, that every page that includes that code is executed as a PHP page. This is normally as easy as renaming the file extension from .htm or .html to .php. If you do this, remember to update all your links to point to the new file names.

    If there's anything else specific that you want help with then I'll try to help as much as I can. You can also read up on specific PHP functions at http://www.php.net/.

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    Changing a large site to PHP would take a while, but not impossible, and worth the effort. The first thing you could do is simply rename all the files to PHP without putting any PHP into them. Use Apache to rewrite all the HTML file requests to the PHP files and then you can start modifying the pages as you have the time.

  4. #4
    Non-Member lostseed's Avatar
    Join Date
    Sep 2005
    Location
    Zurconion Soon!
    Posts
    1,549
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would suggest using a GREP editor (Impossible to find.. sheesh oh peesh..) Or basically a Search and Replace in files..

    PSPad (Freeware) - Search / Replace in Files.

    You can replace all your navigation items with your php include.
    Also rename all extentions to php (F2 to rename files indivually or you can look for a file renamer).

    Also you dont need to do include_once, just do
    PHP Code:
    <?php include("nav.php"); ?>

  5. #5
    SitePoint Enthusiast ReadyMade's Avatar
    Join Date
    Mar 2006
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks so much for the replies people. I'll see what I can progress with during this week and post back if I get stuck along the way!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •