new2php1033 Posted September 22, 2009 Share Posted September 22, 2009 Hi Everyone, I am still learning php but tried to write something to solve a problem I am having. A cart that I need to use will only allow for their template but it hooks into our POS system so I need to use it. It uses the same divs for both the inner page and home page making it harder to style. What I wanted to do since I can upload multiple stylesheets is try and use a if statement and say if it is the index.html page show this style sheet else show the standard inner page. Can someone tell me what I did wrong. <?php if ( $_SERVER[sERVER_NAME] == "https://domain.com/index.htm" ){ echo '<link rel="stylesheet" href="graphics/styleshome.css" type="text/css" />'; }else{ echo '<link rel="stylesheet" href="graphics/styles.css" type="text/css" />'; } ?> Thanks Quote Link to comment https://forums.phpfreaks.com/topic/175060-cart-will-only-allow-for-one-template-trying-to-use-php-to-solve-problem/ Share on other sites More sharing options...
MadTechie Posted September 22, 2009 Share Posted September 22, 2009 $_SERVER['SERVER_NAME'] will only give you the domain you probably want $_SERVER["PHP_SELF"], Quick tip add this line of code echo "<!-- This file is:".$_SERVER["PHP_SELF"]." -->"; and load up the first template, and view source and look for 'This file is' copy the text after it, and use that in your statement also remember the $_GET maybe used to pick the page, ie ?page=home, you could use that instead ie if ($_GET['page'] == 'home') Quote Link to comment https://forums.phpfreaks.com/topic/175060-cart-will-only-allow-for-one-template-trying-to-use-php-to-solve-problem/#findComment-922642 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.