Internal Link Question

Discussion in 'HTML & Website Design' started by vizmon, May 15, 2007.

  1. #1
    Say if I have about 10 articles on my site now, and I am cross linking them.
    Everytime when I add a new article, I need to manually add the link on the last 10 pages, as well as the new page I am going to add. This is really tedious.
    Is there a way to automate this task? Some java or php script or something?

    I am not considering navigation bar.

    Thanks.
    Viz
     
    vizmon, May 15, 2007 IP
  2. kentuckyslone

    kentuckyslone Notable Member

    Messages:
    4,371
    Likes Received:
    367
    Best Answers:
    0
    Trophy Points:
    205
    #2
    One way to do this would be to use a php include file. You would call the file up on each page where you want the links to appear - the file itself would be located outside the pages. When you add a new article you would just need to add the link to the one include file and it would autmoatically update on all pages where the include file is called for.

    Here is an article that explains in more detail about how to do this
    PHP Includes Make a Webmaster's Life Easier
     
    kentuckyslone, May 15, 2007 IP
  3. vizmon

    vizmon Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, very helpful indeed.
    But wouldn't putting this code:
    <?php
    include '/home/Account ID/public_html/directory/name.php';
    ?>
    in the page compromise security?
    You are revealing your account id in this instance.

    Viz
     
    vizmon, May 15, 2007 IP
  4. kentuckyslone

    kentuckyslone Notable Member

    Messages:
    4,371
    Likes Received:
    367
    Best Answers:
    0
    Trophy Points:
    205
    #4
    No that code will appear no where when you view source. For example if you view the source for the page the article appears on you will not see that sort of code anywhere though it is used several times.

    This is a server side include - the server intreprets it before it goes to the browser and only the code that is actually inside the include file will show up.

    Try it out - go back to that article and "view source"
     
    kentuckyslone, May 15, 2007 IP
  5. vizmon

    vizmon Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks! :)
     
    vizmon, May 16, 2007 IP
  6. kentuckyslone

    kentuckyslone Notable Member

    Messages:
    4,371
    Likes Received:
    367
    Best Answers:
    0
    Trophy Points:
    205
    #6
    You are very welcome. PHP includes really do make a lot of things easier.
     
    kentuckyslone, May 16, 2007 IP
  7. csn123

    csn123 Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Easy solution: Use the PHP code listed above.

    Complex solution: Get a MYSQL database and put your articles in there. Build your pages to automatically include all relevant content - essentially a Content Management System [CMS] (told you it was more complex!)
     
    csn123, May 16, 2007 IP
  8. vizmon

    vizmon Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    :D I spent 1 day reading up on Joomla but gave up!
     
    vizmon, May 16, 2007 IP
  9. csn123

    csn123 Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Joomla's scary! :) Try something like Website Baker at websitebaker[dot]org

    It's a lightweight CMS package but if all you need is to add and edit pages, it does the job. It also has SEO URLs built-in too!
     
    csn123, May 16, 2007 IP