asloan Posted January 6, 2009 Share Posted January 6, 2009 Sorry I wasn't sure if I was suppose to start a new thread or not but here we go... I'm checking to see if it's the homepage and if it is the homepage I would like the css to change. but it is not working....any ideas? if (!$_SERVER['QUERY_STRING']) { echo('<style type="text/css"><!--#page_bg {padding: 0;background: #000;} div.center { text-align: center; margin: 10px auto 0 auto; padding: 0; width: 900px; background: #ffffff url(../images/content_top.jpg) top center no-repeat--></style>'); } thank you, Andrea if (!$_SERVER['QUERY_STRING']) { echo('<style type="text/css"><!--#page_bg {padding: 0;background: #000;} div.center { text-align: center; margin: 10px auto 0 auto; padding: 0; width: 900px; background: #ffffff url(../images/content_top.jpg) top center no-repeat--></style>'); } Quote Link to comment https://forums.phpfreaks.com/topic/139704-solved-css-within-if-statement/ Share on other sites More sharing options...
Clinton Posted January 6, 2009 Share Posted January 6, 2009 Are you posting a form at all or just trying to query the location if the page switches? Quote Link to comment https://forums.phpfreaks.com/topic/139704-solved-css-within-if-statement/#findComment-730946 Share on other sites More sharing options...
flyhoney Posted January 6, 2009 Share Posted January 6, 2009 You are placing it in the wrong place. I checked out your site and you are printing the style block at the very top of the page. You need to print the style block at the bottom of the <head> block. It looks like you are using Joomla, so you will have to dig around in the templates to find out where it is. Here is the HTML for your web page. I added a comment where you need to put your new styles. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" > <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="robots" content="index, follow" /> <meta name="keywords" content="joomla, Joomla" /> <meta name="description" content="Joomla! - the dynamic portal engine and content management system" /> <meta name="generator" content="Joomla! 1.5 - Open Source Content Management" /> <title>Benedictine College School of Business</title> <link href="/index.php?format=feed&type=rss" rel="alternate" type="application/rss+xml" title="RSS 2.0" /> <link href="/index.php?format=feed&type=atom" rel="alternate" type="application/atom+xml" title="Atom 1.0" /> <link href="/templates/siteground-j15-48/favicon.ico" rel="shortcut icon" type="image/x-icon" /> <script type="text/javascript" src="/media/system/js/mootools.js"></script> <script type="text/javascript" src="/media/system/js/caption.js"></script> <link rel="stylesheet" href="/templates/system/css/system.css" type="text/css" /> <link rel="stylesheet" href="/templates/siteground-j15-48/css/template.css" type="text/css" /> <!-- YOU NEED YOUR HOMEPAGE SPECIFIC STYLES TO GO HERE --> <?php if (!$_SERVER['QUERY_STRING']): ?> <style type="text/css"> #page_bg { padding: 0; background: #000; } div.center { text-align: center; margin: 10px auto 0 auto; padding: 0; width: 900px; background: #ffffff url(../images/content_top.jpg) top center no-repeat } </style> <?php endif; ?> </head> Quote Link to comment https://forums.phpfreaks.com/topic/139704-solved-css-within-if-statement/#findComment-730958 Share on other sites More sharing options...
Clinton Posted January 6, 2009 Share Posted January 6, 2009 Yea, what he said. :-) Quote Link to comment https://forums.phpfreaks.com/topic/139704-solved-css-within-if-statement/#findComment-730962 Share on other sites More sharing options...
asloan Posted January 6, 2009 Author Share Posted January 6, 2009 That is it exactly and now you have answer all my questions!!!!! thank you Quote Link to comment https://forums.phpfreaks.com/topic/139704-solved-css-within-if-statement/#findComment-730968 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.