Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    vid
    vid is offline
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How Do I Link Multiple Pages Together

    Hi All I am making some new pages for my websites and want them all link together. They are all coded to reached the main page by <a href> tag but also want each of the new pages to link together. So I guess my question is Will I have to add a new <a href>tag such as <a href="codingforums.html">How to make multiple links all connect</a> and so on on each new page.....that includes the first one, the next page will contain 2 a href, the next one 3 and so on..

    Thanks for your help
    Will I have to add a new <a href>tag such as <a href="codingforums.html">How to make multiple links all connect</a> and so on on each new page.....that includes the first one, the next page will contain 2 a href, the next one 3 and so on..

    what I am trying to ask is page 2 needing to have these codes


    <a href="page3.html">I really do hope so</a>
    <a href="page2.html">Is this the correct way</a>
    <a href="codingforums.html">How to make multiple links all connect</a>

    and page 3 to have the previous codes of page one and two..............

    in order for all of them to link together?

    I am making approx 100 pages so I really do hope that only there is an easier way.............Thanks for you help

  • #2
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Quote Originally Posted by vid View Post
    Hi All I am making some new pages for my websites and want them all link together. They are all coded to reached the main page by <a href> tag but also want each of the new pages to link together. So I guess my question is Will I have to add a new <a href>tag such as <a href="codingforums.html">How to make multiple links all connect</a> and so on on each new page.....that includes the first one, the next page will contain 2 a href, the next one 3 and so on..

    Thanks for your help
    Will I have to add a new <a href>tag such as <a href="codingforums.html">How to make multiple links all connect</a> and so on on each new page.....that includes the first one, the next page will contain 2 a href, the next one 3 and so on..

    what I am trying to ask is page 2 needing to have these codes


    <a href="page3.html">I really do hope so</a>
    <a href="page2.html">Is this the correct way</a>
    <a href="codingforums.html">How to make multiple links all connect</a>

    and page 3 to have the previous codes of page one and two..............

    in order for all of them to link together?

    I am making approx 100 pages so I really do hope that only there is an easier way.............Thanks for you help
    Well, yes. You do need to add a separate link for each destination you want to reach.

    You can find example menus here that you can use in your own page:
    http://www.cssplay.co.uk/menus/

    Now the hard way to keep up with these is using just HTML. The slightly easier way is using javascript to pull in a separate menu file that you update once and each page loads up on its own (do a google search of "javascript includes"). The easiest and, in my opinion, best way is to use PHP includes if your host server allows it. This is just like the javascript include method only it doesn't require your viewer to have javascript enabled for it to work. You have a single file that contains only the HTML to make a menu for all pages. It can have submenus just like any other menu. Then each page will use a PHP include like this:
    PHP Code:
    <?php
    include ('/menu.html');
    ?>
    Your menu file can be *.html, *.php, or eve *.txt format and it will work just fine. I have a nice little example posted here:
    http://rowsdower.freehostia.com/php/?page=lazy_menus

    Using the PHP include syntax I gave you earlier and making the menu page as suggested in my link will fully automate your menu building. It gets no easier than that!

    So, really the first questions to find solutions for are these:
    1. How do I create a navigation menu?
    2. Does my host server support PHP scripting?

    Good luck with Steps 1 and 2. Let me know if you have any questions about Step 3!
    Last edited by Rowsdower!; 05-12-2009 at 10:35 PM.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #3
    Regular Coder
    Join Date
    Apr 2009
    Location
    Earth - sometimes sky :-)
    Posts
    121
    Thanks
    51
    Thanked 2 Times in 2 Posts
    I think the best way is to include all your pages with PHP like:
    <div id="some_div_where_you_wish_to_load_your_pages">
    <?php
    include ('page1.html');
    include ('page2.html');
    include ('page3.html');
    ....
    ?>
    </div>
    But with the include command you can open some security hole in your site and it can be hacked by a hacker because with the include command you can run some shell script from another server and show up some info like pass files on your server and so on.

    The best way for do something like this is checking all the loadable pages names with an if-then-else statement in you php code in the "loader" div.

    Something like this:
    If you wis to load 3 pages lets say p1.html,p2.html and p3.html you should do something like this code schema:

    1. define 3 variables (a,b,c)
    2 load into the var a=file name of p1.html,
    b=file name of p2.html,
    c=file name of p3.html,
    3. make some code like this schema in php

    if a=p1.html and b=p2.html and c=p3.html ... then
    include ('p1.html');
    include ('p2.html');
    include ('p3.html');
    ....
    else
    echo "Fake loader go away!";
    <-- this is the most important think! if somebody try to load from the browser some external site or shell,the shell could not be executed because of the if-then statement are not meet the requirement of the variables and in the browser will be printed "Fake loader go away!".

    Warning! this is not a valid php code,read some if-then-else tutorial and create your own code...

  • #4
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Quote Originally Posted by joda View Post
    I think the best way is to include all your pages with PHP like:
    PHP Code:
    <div id="some_div_where_you_wish_to_load_your_pages">
    <?php
    include ('page1.html');
    include (
    'page2.html');
    include (
    'page3.html');
    ....
    ?>
    </div>
    ...
    Well, simply using a PHP include (with or without any extra "security") will not create links between pages. It will actually print all data from the other "included" file(s) into the current file's source code, which is not what I understand the OP to be requesting. Even if it were, the result would be one single page long enough to reach from here to the moon when 100+ pages are involved. I can't imagine a user wanting to wait for the page to load, and then wanting to search down the page to find what they want.

    Anyway, the only other thing I can think that the OP is after is some sort of linking system such as can be found on a lot of pages for search results, where page 1 has a link to page 2, page 2 has a link to page 1 and page 3, page 3 has a link to page 2 and page 4, etc., etc. until the end of the results. Really, I'm just grasping at straws at this point until the OP tells us more about what is needed.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #5
    Regular Coder
    Join Date
    Apr 2009
    Location
    Earth - sometimes sky :-)
    Posts
    121
    Thanks
    51
    Thanked 2 Times in 2 Posts
    Yea, Rowsdower ur answer is ok I mean same thinl like you.
    I think, VID can make an external file like "link-list.txt" with the link's in it and include it with php and so the user can see a list of the links and the user can make some search on the page and clicking on the link what they need.

    But, VID can easy update the content of the "link-list.txt" so they can easy add or delete some links...

    I mean in the "link-list.txt" should be written lines like:
    <a href="p1.html">This is page 1</a>
    <a href="p2.html">This is page 2</a>
    <a href="p3.html">This is page 3</a>
    ....

    And here is the php code:
    PHP Code:
    <div id="some_div">
    <?php
    include ('link-list.txt');
    ?>
    </div>
    This is just and idea...
    Last edited by joda; 05-13-2009 at 02:16 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
    •