'master' page pathing problem

Hey guys, i recreated the ASP master page concept using this approach featuring output buffering:

Spinning the Web: Approximating Master Pages in PHP

But i have a problem with my font end files…basically they all have to be pathed from the root becuase when i include the master page from anouther directory e.g. (include ‘…/master.php’) all of the included files such as my .js and .css will attempt to path from my current working directory instead of being relative to the master.php’s position.

I believe i could solve this with the htaccess file but am unsure since that is backend and my problem seems frontend. Anyway, just wondering if anyone has encountered the same problem.

Cheers, Nick

look at set_include_path()

I dont think that is what im looking for, thanks though, i solved the problem by setting a $path variable and sending it back to the master page, including files like this:

<link rel=“stylesheet” href=“<?php echo $path; ?>scripts/fancybox/jquery.fancybox-1.3.4.css” type=“text/css” media=“screen” />
<script src=“<?php echo $path; ?>scripts/fancybox/jquery.fancybox-1.3.4.pack.js”></script>

wow, so I completely misunderstood what the issue was :eek:. Glad you got it sorted

Personally I prefer <?=$var?> for inline php echo’s.

<?=$var?>

learn something new every day! thanks

yeah <?=$var?> is the same as <? echo $var; ?> and you can use concantenation with it ie: <?=$var,$othervar,$thirdvar?> I find it pretty epic 8-D altho I do believe you have to have shorttags turned on… I’m not sure on that.