Jump to content

Update a section on multiple pages


DizzyDan

Recommended Posts

Currently I am working on this site test.heckraiser.orgIf I want to be able to add an event or a sponsored link that would change across all of the pages instead of going into each individual page and updating the .html documents code manually what would I need to get involved with?

Link to comment
Share on other sites

Includes are pretty easy to get the hang of. You only need to learn a very small amount of PHP. Have a read of the tutorial I posted and if you have any questions post them here.Think of it as simply including the contents of another file on your page. Somewhat like you would load an iframe, except that the page is included server-side so there is no need for a frame.

Link to comment
Share on other sites

Oh that is just fantastic... You are my savior.Quick question though, for some reason i have to reference the file like this

<?php include("/home5/guitarh2/public_html/test.heckraiser.org/events.php"); ?>

I had thought this would work

<?php include("/events.php"); ?>

but it doesn'tAm I doing something wrong?

Link to comment
Share on other sites

That first '/' tells PHP to look in your root folder. If events.php is in the same folder as the file including it you can omit the '/' and just do include('events.php');EDIT:Actually, this:include('./events.php');would probably be better. It tells PHP to look in the current directory (that's what the './' says) for the file events.phpI'm trying to find documentation in the PHP manual for relative file paths, but I can't seem to find it....:)

Link to comment
Share on other sites

It will work as 'event.php' for the homepage but for each addition page I want it to reference the one file in the homepage directory.Otherwise I have to put an events.php in each directory. which would kind of defeat its purpose, unless i am missing something here which is very possible.EDIT:Just saw your edit and the

include('./events.php');

didnt work :)

Link to comment
Share on other sites

From those other files you can just use ../ to jump to the parent directory.Say you have page2.php located at /root/directoryIf events.php is located in /root then in page2.php you can write this:include('../events.php');to jump up to the root folder to look for events.php

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...