www.webdeveloper.com
Results 1 to 7 of 7

Thread: How do I pull content from another page?

  1. #1
    Join Date
    Dec 2006
    Posts
    2

    Wink How do I pull content from another page?

    I've got about 35 pages on my site, and everytime I add/fix/whatever in my sidebar (menu, announcements, etc) I have to change it on all pages. Can't I just have that part of my content on another page, in a text file, even if its written in html I would like to have just one place to add it.

    With that in mind, is that going to undermine me as far as web ranking and pages referenced on my site, or does that stuff load into my html page before the spiders scrub it?

    Thanks!!

    Great site...

  2. #2
    Join Date
    Nov 2006
    Posts
    140
    You can. Use PHP or Perl to insert other files into the doc.
    It will not affect how spiders see stuff.
    Random (*cough*) example: http://jesa.skule.ca/
    If you look through the various pages, the nav bar stays the same.
    The nav bar gets slurped from one file and the rest of the content from a second (which is based on the ?page= in the URL)

  3. #3
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    If your site is on an Apache server then you can use server side includes (SSI) to assemble your pages on the fly.
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  4. #4
    Join Date
    Dec 2006
    Posts
    2

    What do you call that technique?

    Can you give me some keywords to look up that technique (having content in a separate file)? I'm having a tough time looking up examples.

    Thanks!

  5. #5
    Join Date
    Nov 2006
    Posts
    140
    You got 3 options: Perl, PHP, SSI
    I think Perl is less popular than the other two.
    Does your host support PHP/SSI?
    Testing:
    PHP:
    Make a file called test.php
    Code:
    PHP Code:
    <?php
    phpinfo
    ();
    ?>
    Make sure the file has executable permission set in addition to read (chmod 755) (not sure if read is even needed...)
    Visit the file with your browser. Either you get what you typed -> no PHP, or you get other stuff.

    SSI:
    Stick this somewhere in your HTML file and see if it works:
    PHP Code:
    <!--#echo var="DATE_LOCAL" --> 

  6. #6
    Join Date
    Aug 2006
    Posts
    4
    This may not be what your looking for but...


    Copy and Paste... you dont have to deal with any extra HTML if its already written, AND you can transfer pages in a snap!!

    I may not have gotten your question right but thats what might work

  7. #7
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    Stick this somewhere in your HTML file and see if it works:
    An HTML file with the extension .shtml that is.
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles