What alternative is there to an iframe?

Discussion in 'HTML & Website Design' started by xthoms, Aug 28, 2010.

  1. #1
    I'm sitting and making my website, but I'm wondering what alternative there is to an iframe...

    I need it because every time I change the links I want them to change all over my website. It's because I've heard that google does not crawl iframes and the internal links do not count then.
     
    xthoms, Aug 28, 2010 IP
  2. EatingEmoKids

    EatingEmoKids Member

    Messages:
    111
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    28
    #2
    I used php includes to do this, and it's very easy.

    simply put all your links into a file called sidebar.php or menu.php (really what ever you want). it will look something like this:
    
    <ul>
        <li><a href="#">Home</a></li>
        <li><a href="#">About</a></li>
    </ul>
    HTML:
    then on your pages where you want to include the menu put in this line of code:

    <?php include("sidebar.php"); ?>
    PHP:
    your server has to support php and your pages need to have a .php extension for this to work.

    If you have any questions or need some help, let me know :)
     
    EatingEmoKids, Aug 28, 2010 IP
  3. squeenix

    squeenix Peon

    Messages:
    57
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can use HTML server sided includes.

    Or alternatively, you can use PHP, which you must install and configure with your server (or make sure your host supports).
    It's pretty easy. All you have to do is, put this line of code in to include a file's contents into the page.
    <?php include("yourfilename.php"); ?>
    Code (markup):
     
    squeenix, Aug 28, 2010 IP
  4. goliveira1990

    goliveira1990 Active Member

    Messages:
    127
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    93
    #4
    Try using divs
     
    goliveira1990, Aug 30, 2010 IP
  5. xthoms

    xthoms Member

    Messages:
    170
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #5
    Thank you for your help.

    I tried the PHP way but failed. I guess I'm just not really made for that lol.

    Could one of you maybe be extremely nice and make a quick sample of two files one PHP file with 2 links and the other file that imports it and then maybe send it to me? :)

    Thank you
     
    xthoms, Aug 31, 2010 IP
  6. infoman66

    infoman66 Peon

    Messages:
    58
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Like EatingEmoKids sayed,

    include your menu.php in page where want to see your menu. Of course, that page must be .php too.

    Simple your .htm page where include menu.php save as .php and that's it.

    Sample:
    <html>
    <head></head>
    <body>
    .. content..
    <?php include 'menu.php'; ?>
    .. content...
    </body>
    </html>

    You can put <?php include 'menu.php'; ?> almost on every places in body of page, but is good practise to put between <div></div> and stylish menu within css...
     
    infoman66, Aug 31, 2010 IP
  7. xthoms

    xthoms Member

    Messages:
    170
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #7
    Could you please try and do this for me? It doesn't need to be more than two files, one blank page where two links are imported? Thank you
     
    xthoms, Sep 1, 2010 IP
  8. EatingEmoKids

    EatingEmoKids Member

    Messages:
    111
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    28
    #8
    me and infoman66 both included the code to do this in our posts. If you cant follow the instructions hit me up on skype and I'll walk you through it.

    skype: eatinemokids
     
    EatingEmoKids, Sep 1, 2010 IP
  9. infoman66

    infoman66 Peon

    Messages:
    58
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Well th0m4 I think about this:
    your page save as index.php
     
    <html>
    <head>
    <title>Some title</title>
    <style type="text/css">
    <!--
    #container {} /* put your style between {}*/
    #top {}
    #topmenu {}
    #content {} 
    #footer {}
    ul #menu {}
    -->
    </style>
    </head>
    <body>
    <div id="container">
    <div id="top"> Top of the page </div>
    <div id="topmenu"> <?php include 'menu.php'; ?> </div>
    <div id="content"> Content goes here </div>
    <div id="footer"> Bottom of the page </div>
    </div>
    </body>
    </html>
    
    Code (markup):
    And your menu page such as menu.php
    
    <ul id="menu">
    <li><a href="index.php">Home</a></li>
    <li><a href="some-page1.php">Link 1</a></li>
    <li><a href="some-page2.php">Link 2</a></li>
    </ul>
    
    Code (markup):
    Save your index.php page like some-page1.php and some-page2.php modify contet and thats it...
    Simple isn't it?
     
    infoman66, Sep 2, 2010 IP
  10. lostdesign39

    lostdesign39 Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    thanks, you can also use cURL to grab data from another webpage
     
    lostdesign39, Sep 2, 2010 IP