Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Web Design (WordPress, Joomla, etc.) What do I use (not iframes) to pull content from one file into another.

  • What do I use (not iframes) to pull content from one file into another.

    Posted by Cameron Mcefee on August 26, 2008 at 5:50 pm

    Hello.

    I’ll start with my question first.

    What can I use (php or javascript?), that isn’t iframes, to pull content from one html file and place it in another? I want to make each page reference and display content from a single external file.

    I’m building a site for my boss that we use to display the current status of our content to our clients. Since it is updated multiple times a day, and each update is archived, I need some sort of dynamic navigation system. At the moment I am using a single index file and iframes for the navigation and content. When I update, I update the html file for the nav with the newest projects and then add new content pages for those new posts.

    In case my description isn’t very clear, my thinking behind my design is that each of these sites have 30-50 pages. The menu has a link for each new post and is updated every couple hours so it’s foolish to have the menu built into each page. I’d rather just do something like place some sort of script on a div that pulls the menu items from an external file. That way I only have to update one file and all others will take their info from it.

    Thanks for any help.

    Cameron Mcefee replied 18 years ago 2 Members · 2 Replies
  • 2 Replies
  • Curtis Thompson

    August 26, 2008 at 11:30 pm

    hello…

    you can do it with both php and javascript, but it’s easier with php – you can use either the include_once or require_once directives:

    https://us.php.net/include_once

    basically you make your nav file somewhere and then include it in each page where you want it – you can do any kind of code that each page uses with this technique (like page footers, etc.)..

    hope that helps!

    sitruc

  • Cameron Mcefee

    August 27, 2008 at 12:21 am

    Awesome, that sounds like my solution. I’ve never used php before but after some research I’ve come up with a few questions.

    1. I get the feeling that php is a server thing. Does this mean that I won’t be able to test it on a local machine before I upload it?

    2. Does php need any kind of tag in the header like css or some similar declaration?

    3. My nav file is an html file. Can I use the php to pull from that or should I be pulling from a php file?

    The reason I ask is that I got rid of the iframe code and put in the php that you linked to. Nothing displayed so I’m missing something somewhere.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy