Jump to content

Includes in templates


benji87

Recommended Posts

Hey everyone. Im currently building a CMS using a basic template created in dreamweaver. The problem im having is when including php files. I dont mean for headers or general layout but for content items. For example in the template ive included a php script file that shows how many members are online. Then on the pages that i create from that template i have things like displaying a little forum and league table. Trouble is for some reason on some pages the includes like the forum will come up with an mysql_query error because it cant connect to the database i.e it says the path ive directed it too to include the database connection doesnt exist but i know it does because it works fine when i quote out the members online include.

This isnt just a problem with these files because it does the same thing with other files it just doesnt seem to like having more than one include on the same page but only in some cases!

I hope that makes sense !
Link to comment
https://forums.phpfreaks.com/topic/27440-includes-in-templates/
Share on other sites

It's most likely your include file ordering or the location of the include files in relation to the include that may be calling another include. Remember the parent script path is the current working path / directory, so if you call a include in a lower directory, that calls a include in a different directory or upper directory, you will need to [b]change directories[/b] before calling that include, so PHP can find that include file based on the current working directory!


Link to comment
https://forums.phpfreaks.com/topic/27440-includes-in-templates/#findComment-125482
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.