1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

PHP using "div" like frames?

Discussion in 'Web Development' started by selz, Feb 16, 2010.

  1. selz

    selz New Member

    Hi guys,

    I am using the "dog care template", which is arranged into sections using "div" - there is a site menu in a DIV section on the right of the screen - I hope this makes sense so far!

    What I want to be able to do is to to save the contents of this menu in one central file, rather than have to update it on every single page when a new menu item is added or one is removed - this is already getting tiresome! What I want to do is very similar to how Frames used to work...

    My knowledge of HTML is basic (I am self taught and am trying to learn as I go along) but I can pick up general concepts quite quickly. My knowledge of style sheets is more limited, I have only encountered them with this site. Guess what I'm saying is the simpler you can make the solution for me, the better :D

    I hope my request for knowledge makes sense - and thank you in advance!

    Regards,

    Selz
     
  2. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    Divs are the way of the world now frames are out, besides frames do not index well with search engines and if used wrong you will be considered a spamming site.

    One general concept coming right up.
    It's called "PHP Include command"​
    Basically you are going to make one menu.php file and place all your links in it.
    On every page you require the menu you will insert this one file name and call it with the include command like this. <?php include("menu.php"); ?>
    The beauty of the whole idea is you only have One file to update the rest of the pages are automatic because all they are doing is calling up menu.php

    Interested - thought you might be so start looking at these links it's really easy.

    Tizag.com
    w3schools.com

    php isn't a hard language to learn just remember it runs on the server.
    Take any html file like your about.html and rename it about.php load them both up on your server, use your browser to open each, they look the same execpt for the extension. Now you just made your first php file.
    php and html go hand in hand you can use code from both in the same file.
    Have fun with it and keep us informed. Stop by the forum and help out.
     
  3. selz

    selz New Member

    Thanks ishkey, that seems to make sense :)

    I'll check those sites out and try to do some quick learning - everything I know at the moment is self taught basic html from some 12 years ago - no wonder I feel out of practice!

    I'll have a play with my site now and let you know how I get on!! Thanks for the help :D
     
  4. selz

    selz New Member

    Right, I've been having a play about, but can't quite get things sorted....the menu isn't showing where it should. Will this have anything to do with the .css file holding the formatting information for the div section?

    Oh, how my poor brain is aching now:eek:
     
  5. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    That could very well be the problem, but like I have said a thousand times before when I lost my super powers so went the x-ray vision. But I could presume you are taking about
    Code:
    <div class="right-col">
            <h2>Breed...</h2>
            [COLOR="RoyalBlue"]-->your code here<--[/COLOR]
                   </div>
    
    Download the zip file and open it in a directory other than the one you are working on. You can see the how it works. Load it up to your site into a different directory or run it on your pc if you have a server setup on it. This template is the same one you are using except I made changes to the css file to make it wider. A friend needed more space in the main body.
     

    Attached Files:

  6. selz

    selz New Member

    You are most helpful :) Thank you!!! :D
     
  7. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    Figure it out yet?
     
  8. selz

    selz New Member

    No :(

    I have created a "sessions.php" file containing only the list of sessions offered, and used the <?php include("sessions.php""); ?> line (leaving the header in the index page body).

    When I upload everything, the sessions menu just won't show. I've printed the code for my index file and yours, and have compared line by line to see if I can spot anything which could be different, but as far as I can tell it should work! I have also compared the stylesheets, and can't see anything notably different there either, other than colours!

    Yours worked fine though when I uploaded it, so I am stumped!!


    Got reams of print outs to take home and study over the weekend, as I am desperate to work it out now - it has gone beyond a time and information-saving device to a personal challange!
     
  9. selz

    selz New Member

    I have also noticed that when viewing my index.php compared to the html version, the boxes below the main body of text have changed size, although both files refer to the same .css file.... Don't know if that's connected, or just another quirk to figure out...


    I'm hosting with 1&1 uk, if that makes any difference...

    *edit* Have just checked the 1&1 site, and it supports php. Now I'm really stumped LOL and considering buying a PHP for beginners book :)
     
  10. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    2 tools which may help.
    Here is an easy way to look at files side by side - ExamDiff
    saves on printing and is color coded.

    I use WampServer on my pc as a server while working on projects before I upload and test them on the host server - it's small and easy.

    I dumped 1&1 long ago when they started charging for everything.

    You might want to check your php.ini file which holds your configuration settings - it should be located in the root directory of your public_html or www directory on the server.
    Why don't up zip up "your files" and post them - I will be happy to look at them this weekend.
     
  11. selz

    selz New Member

    Hi Ishkey :)

    Apologies for not posting an update sooner, and thankyou for your kind offer to look over my code - that was a generous offer, thanks!

    I am hugely pleased to say that I'VE GOT IT WORKING :D:D I am so chuffed that it works, and so well!!!

    Oh, and I have bought a Teach Yourself PHP book, as I am inspired to learn more now :)