<?php include "QUESTION" ?>

5 posts by 3 authors in: Forums > CMS Builder
Last Post: July 19, 2012   (RSS)

Re: [kdub718] <?php include "QUESTION" ?>

By Jason - July 18, 2012

Hi,

If the directory you are in is only 1 level below the root, that code should work. To help keep things even more organize, a good practice is to create a folder in the root called "includes". You can then put all the files that get included on other pages into that directory.

So if you then were in a sub directory, and wanted to include "file-name.php", you would use this:

<?php include ("../includes/file-name.php"); ?>

Let me know if that works for you.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] <?php include "QUESTION" ?>

By kdub718 - July 18, 2012

No I did notice it does work. I didn't think it was cause the file I was trying to get it to include has style elements for css in it. So its not finding the directories for the css. So I'm not sure what I'm going to do

Re: [kdub718] <?php include "QUESTION" ?>

By Toledoh - July 18, 2012

Could you also use something like;
<base href="http://www.yourdomain.com/" target="_self" />
and then have all links relative to the base URL?
Cheers,

Tim (toledoh.com.au)

Re: [kdub718] <?php include "QUESTION" ?>

By Jason - July 19, 2012

Hi,

What you can do is include all your CSS in your main page, not your included page. The PHP include just "inserts" the code from an external page into the including page. So any CSS rules set up in the including page will apply.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/