HTML including CSS using PHP -


i trying build one-page dynamic site , i've hit roadblock. since urls like:

index.php?page=tutorials&article=0 

aren't pretty, decided use .htaccess rewrite urls, in case so:

tutorials/articles/0 

but means of includes won't work since use paths relative root path of site:

js/jquery-1.9.1.min.js 

i've tried work around these using following code included @ beginning of index.php:

$str = dirname(__file__); $str = str_replace('\\','/',$str);//since i'm using localhost development, paths contain backwards slahses replace them $str.='/'; define('root_dir', $str); 

and including everytinhg php:

echo root_dir.'js/jquery'; 

but aproach doesn't seem work well, though paths apear generated ok:

<script src="c:/xampp/htdocs/tzeny/js/jquery-1.9.1.min.js"></script> 

my question can me find solution include files corectly or make solution work?

for first pages works, so:

tzeny/tutorials 

works but

tzeny/tutorials/categories/0 

doesn't include anything. used both /tzeny/ , /. more ideas please? or should go normal urls?

you need use absolute path. example : if domain www.domain.com/tzeny/index.php?page=tutorials&article=0 each file index need include scripts :

<script src="/tzeny/js/jquery-1.9.1.min.js"></script> 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -