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. Link to comment https://forums.phpfreaks.com/topic/243951-style/ 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. Link to comment https://forums.phpfreaks.com/topic/243951-style/#findComment-1252616 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 Link to comment https://forums.phpfreaks.com/topic/243951-style/#findComment-1252623 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.