karimali831 Posted August 5, 2011 Share Posted August 5, 2011 Hello Sorry if I can't explain this properly, I'll give it a try.. I add some style in index.php: <style> .... </style> I use links such as: index.php?page=news index.php?page=articles etc. Now I only want to use the style in news, articles but not index.php itself if that makes sense? I can add the style in news, articles files itself but the style will be affected in index.php which I don't want. Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 5, 2011 Share Posted August 5, 2011 you can do something like this: <?php // list of pages where you WANT <style> to show: $listOfPages = array("news","articles"); if(in_array($_GET['page'],$listOfPages)){ ?> <style> .... </style> <?php } ?> but it's better to have your css in external files. Quote Link to comment Share on other sites More sharing options...
karimali831 Posted August 5, 2011 Author Share Posted August 5, 2011 I have tried this but the style affects index.php still <?php $listOfPages = array("news","articles"); if(in_array($_GET['site'],$listOfPages)){ ?> <style> tr, td, table { padding:4px; border-collapse:separate; border-spacing:1px 1px; border-color:#000000; } </style> <?php } ?> index.php?site=articles Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.