<?php include "QUESTION" ?>

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

By kdub718 - July 18, 2012 - edited: July 18, 2012

So I have a general questions with php (using cmsb obviously)

I try and keep files organized and have them in proper directories.

With that said I'm trying to use and it works perfectly

<?php include "file-name.php" ?>

But in order for that to work I have to have that "file-name.php" in every directory.

I was trying to use

<?php include "../file-name.php" ?>

To point it back to the main directory so I don't have to have that "file-name.php" in every folder but it won't work.

I was wondering if I'm just doing it wrong or if it's not possible to do that?

Thanks

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/