1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Section that is Updated on Every Page?

Discussion in 'HTML & Website Design' started by abcdefGARY, Jul 6, 2006.

  1. #1
    hello. since this forum generates a lot of great solutions... I've decided to post some of my questions here.

    I'd like to know how (and if there is a way) to generate a "section" that updates everytime I update that particular page linked to it.

    so for example... a news section that is found on all pages of my website. but instead of having to update that section on every page, I only have to update the one news section.

    kind of like CSS stylesheets, but this time with content.

    I tried playing around with inline frames, however, in the end, it doesn't work with Firefox? :(

    Anyone who has solutions, please share! Thanks in advance!
     
    abcdefGARY, Jul 6, 2006 IP
  2. sgtsloth

    sgtsloth Peon

    Messages:
    205
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't think pure HTML will do this for you. But it's a piece of cake using any programming language. For example, PHP offers an "include" function that does exactly what you're talking about.
     
    sgtsloth, Jul 6, 2006 IP
  3. abcdefGARY

    abcdefGARY Well-Known Member

    Messages:
    665
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #3
    yeah. im trying to think outside the box. so im experimenting with things other than html to save my time and not update every and each page... -_-

    so how would I do this using what you said?

    btw thanks for replying so fast!
     
    abcdefGARY, Jul 6, 2006 IP
  4. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #4
    as sgtsloth said
    piece of cake

    using SSI - with perl or PHP or other means
    i used perl - now only PHP and use SSI to insert any of my currently 4 RSS feeds into many pages to keep visitors informed of the news in that particular RSS topic

    yoiu can have text modules, link modules or pics to be inserted into any page

    btw

    iframes and firefox
    i use iframe to include my address into all relevant pages ( like donation-, order-pages, etc and it works perfectly for me in my firefox and any other browser i use for testing )

    iframes is a very handy method to insert info or pics

    if you have a page with an iframe example that does NOT work for you - give me the URL and i may check to see why - it may be a simple syntax error
     
    hans, Jul 6, 2006 IP
  5. abcdefGARY

    abcdefGARY Well-Known Member

    Messages:
    665
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #5
    oops, I got rid of inline frames a long time ago since they didn't work. so I just started updating each page one by one whenever the news section needs update.

    until... i figured out CSS stylesheets! and thought if there was a way I could save some time by using more than styles, but incorporating content.

    anyways. enough of that.

    so how would I do this using "php"?
     
    abcdefGARY, Jul 6, 2006 IP
  6. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #6
    kk5st, Jul 7, 2006 IP
  7. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #7
    assume you have a file / text module to include named which is in the same folder as the file to be inserted

    text_module.htm

    then the full syntax would be

    <? include ('text_module.htm'); ?>
    PHP:
    just the code above without the 1. in front !!!

    if text module in other folder - relative paths work

    if doing that on a HTML-only site
    make sure you enable PHP parsing of HTML files first making proper adjustments in your
    .htaccess

    -------- start

    AddType x-mapp-php4 .html .htm .shtml
    removeHandler server-parsed shtml

    -------- end

    the 2 lines above added will stop shtml files to be parsed for perl SSI
    and enable PHP parsing of NON - .php ending files like .html and .htm files

    the .htaccess lines may need to be adapted to a particular apache config on your host - above works perfect for me but i had to figure it out all on my own as the usual recommended mehtod failed to work with 1AND1 hosting apache-configuration


    now
    make a test HTML file
    add a test module into
    you see it's easy

    now you need to play with you CSS to place it exactly where and how you want it to be
     
    hans, Jul 7, 2006 IP
  8. abcdefGARY

    abcdefGARY Well-Known Member

    Messages:
    665
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #8
    hmm. i dont quite get it. there's a lot of things in there i don't understand.

    is there like an example or perhaps a tutorial. im very new to this.

    oh, well. never mind. ill just get rid of the news section for now until i figure it out.

    thanks you guys.
     
    abcdefGARY, Jul 7, 2006 IP
  9. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #9
    tutorials
    what about w3schools
    http://www.w3schools.com/default.asp
    else just ask google for tutorials
    there are hundreds out there

    the sample i made you below is about the easiest i can offer its all copy and paste and in 3 minutes ready to test
     
    hans, Jul 7, 2006 IP
  10. abcdefGARY

    abcdefGARY Well-Known Member

    Messages:
    665
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #10
    sorry. but where do i copy all of that to?
     
    abcdefGARY, Jul 7, 2006 IP
  11. abcdefGARY

    abcdefGARY Well-Known Member

    Messages:
    665
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #11
    hmm. I think I'm going to try inline frames again. and if it doesn't work, ill pm you guys.

    right now... i have a little problem

    how do i make the table so it is on the edge?
    like this:
    [​IMG]

    because right now, it looks like:
    [​IMG]

    never mind. i found it:
    topmargin=0 leftmargin=0 marginheight=0 marginwidth=0
    lawl. :D
     
    abcdefGARY, Jul 7, 2006 IP
  12. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #12
    Did you not follow the links I gave you? The Apache documentation is very tutorial. What they cover related to the Apache web server is also applicable to server-side scripting languages such as PHP.

    gary
     
    kk5st, Jul 7, 2006 IP
  13. abcdefGARY

    abcdefGARY Well-Known Member

    Messages:
    665
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #13
    hey, gary.

    I looked, well skimmed, through the links you gave me.
    but they seem a little bit too advanced for me. i can only do basic and some advanced html and the rest ill need to learn via school or w/e.

    many of the things they said i don't really understand... :/

    but thanks anyways gares, im going to tool around with the inline frames.
     
    abcdefGARY, Jul 7, 2006 IP
  14. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #14
    create a new html file
    include all basic elements such as head
    meta
    body

    some text

    then add the include part of the code given below

    then create another file with the name to be included

    then run file 1 in browser and it should display the file 2
    to properly place the included module use CSS

    re question about tables
    may be you really should consider to study the w3schools onliine tutorial
    is free and highly efficient to use


    and that
    .htaccess

    -------- start

    AddType x-mapp-php4 .html .htm .shtml
    removeHandler server-parsed shtml

    -------- end

    as said into your
    .htaceess
     
    hans, Jul 7, 2006 IP
  15. Jdog

    Jdog Peon

    Messages:
    267
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #15
    You have to start reading the tutorials like the ones that Gary posted and start using them. It is complicated and difficult to skim it and understand what they are talking about. I was in the same place you are a couple weeks ago, but you just have to dive in and figure out what they are talking about. PHP includes are very simple to me now. As you are going through the tutorials and you find something that you don't understand, google it, figure it out and then go back to the tutorial. Just skimming it will not get you to where you need to be.

    Good luck.
     
    Jdog, Jul 7, 2006 IP
  16. abcdefGARY

    abcdefGARY Well-Known Member

    Messages:
    665
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #16
    :/

    i still have to try what hans said.
    if it doesnt work then ill try looking through it when i have time

    thanks everyone
     
    abcdefGARY, Jul 7, 2006 IP
  17. abcdefGARY

    abcdefGARY Well-Known Member

    Messages:
    665
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #17
    I used inline frames once again, and yes! it worked! he he he he he he he he h e thanks everyone
     
    abcdefGARY, Jul 7, 2006 IP
  18. sholiz

    sholiz Active Member

    Messages:
    495
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    60
    #18
    OK well I'll try to give the best "tutorial" on the PHP aspect, which maintains SEO -- not like frames.

    <?php include ('filename.html') ?>

    This calls to filename.html and includes EVERYTHING that's in that file.


    So, you're editing your site and there's an HTML column somewhere and you want a "list" to go in there -- say of, sold links? New pages? -- wahtever.

    Put those in a file, the way you want, and remove the HTML, HEAD, BODY, META -- all those tags, as you don't want to have a "2nd" page listed in your site's source.

    So, your 2nd page should be formatted something like this.
    
    <table id="soldlinks">
    <tr>
    <td>
    Links for Sale<br />
    Link 1<br />
    Link 2<br />
    Link 3<br />
    Link 4<br />
    Link 5<br />
    </tr>
    </td>
    <table>
    
    HTML:
    Now, that's your "include" text. You can formatt this in any way you want but I say just keep it as basic as possible, even design your site and copy that bit of source into another page. I like using the extension ".inc" just for my own refrence of ".inc-lude" so I know that it's a area of a page, that's included in another.

    Now, you've got your site setup how you want and need to include this page of "pre-generated" (already made) links that can be edited in ONE file and not every page across your site.

    Just a simple
    <?php include ('links.inc') ?>
    PHP:
    And it will pull that data from your file, and put it on your site without having to update 10, 20, 500 pages.
     
    sholiz, Jul 7, 2006 IP
  19. abcdefGARY

    abcdefGARY Well-Known Member

    Messages:
    665
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #19
    lolz. I now realize that the numbering (1, 2, 3, 4, etc.) is the line number. lawl. ok, I'm going to give that a try.

    -----------------------------------
    ok i just tried it and its not really working...

    my first page (index.htm) is:

    <html>
    
    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>New Page 1</title>
    </head>
    
    <body>
    <table>
    <tr>
    <td><?php include ('links.inc') ?></td></tr></table> 
    </body>
    
    </html>
    
    Code (markup):
    and my second page (links.inc)

    <table id="soldlinks">
    <tr>
    <td>
    Links for Sale<br>
    Link 1<br>
    Link 2<br>
    Link 3<br>
    </td>
    </tr>
          <table> 
    
    Code (markup):
    and when I open up index.htm , its just blank...
    i think im doing something wrong.
     
    abcdefGARY, Jul 7, 2006 IP
  20. ing

    ing Well-Known Member

    Messages:
    500
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    195
    #20
    Did you remember to add the code supplied above to your .htaccess file?
    You need to do that to make it work.
    :)
     
    ing, Jul 7, 2006 IP