Love2c0de Posted September 21, 2013 Share Posted September 21, 2013 (edited) Good evening, I've got an 'Offers' page with 3 deals on there. Each deal has it's own link with the URL like this: <a href="./Contact/Deal" />Deal 1</a> <a href="./Contact/Deal" />Deal 2</a> <a href="./Contact/Deal" />Deal 3</a> The idea is when one of the 3 deal buttons are clicked, I want to send a $_GET value through the URL and populate my textarea on my form with some text relevant to the 'Deal' on my contact page. I am rewriting the URL and only just got the page to load (I was getting a 404 before). Trouble is, my page has no styles applied to it whatsoever. The stylesheet appears in the <head> but none of the elements have any styles applied to them. Here is my Offers page: <h2 id="offer_intro">Exclusive Offers This Year!</h2> <div id="deals_container"> <div class="deals" id="deal1"> <h3>Deal 1</h3> <h2>40% Off!</h2> <p>Guranteed 40% off any website for our second client! Firstly, I will liaise with you and discuss the requirements of your website. I will provide you with the standard price, followed by the price after the deduction of the 40%. This offer includes domain & hosting for 1 year.</p> <span>Be quick!</span> <a href="./Contact/Deal">Order!</a> </div> <div class="deals" id="deal3"> <h3>Deal 3</h3> <h2>£50 Logo/Banner Design</h2> <p>If you would simply like a new logo or banner designed for your existing website, we provide this service for a very cheap fee of £50 when you order by 31<sup>st</sup> October 2013. We will create 3 or 4 mock examples and provide you with them all. We make any tweaks which you suggest.</p> <span>Need a logo?</span> <a href="./Contact/Deal">Order!</a> </div> <div class="deals" id="deal2"> <h3>Deal 2</h3> <h2>Free Domain & Hosting!</h2> <p>Free Domain & Hosting for<span>2 years</span> when you purchase any website. This will be deducted from the overall price of your website. We will provide support in setting up your domain and hosting account, including any email accounts and/or mailing accounts your website will use.</p> <span>Order Now!</span> <a href="./Contact/Deal">Order!</a> </div> </div> <script> $('.deals button').click(function(){ console.log(this); }); </script> Here is my .htaccess file: RewriteEngine on RewriteBase / RewriteRule ^/?([a-zA-Z_]+)$ index.php?page=$1 [L,QSA] RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_0-9]+)$ index.php?page=$1&deal=$2 [L] Obviously something is not right with the second RewriteRule I think because like I said above, it was giving me a 404 and I kept modifying it and I looked at other peoples problems online and figured the 'pattern' but not quite 100%. Getting this error in Chrome Dev Tools: Has anyone ever come across this problem? Thank you for your time. Kind regards, L2c. Edited September 21, 2013 by Love2c0de Quote Link to comment https://forums.phpfreaks.com/topic/282350-weird-issue-with-stylesheet/ Share on other sites More sharing options...
Love2c0de Posted September 21, 2013 Author Share Posted September 21, 2013 I think it's to do with my links not being relative to the path or something because the images and stylesheet are not loading. Any ideas? Sorry couldn't edit my last post. Thanks L2c. Quote Link to comment https://forums.phpfreaks.com/topic/282350-weird-issue-with-stylesheet/#findComment-1450607 Share on other sites More sharing options...
Solution jazzman1 Posted September 22, 2013 Solution Share Posted September 22, 2013 (edited) Try to place a html base tag inside a html head. <head> <title>TSPV-Websites - Offer</title> <link rel="stylesheet" href="css/main_styles.css" /> <link rel="stylesheet" href="css/fonts.css" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <base href="http://www.tspv-websites.co.uk/"> </head> Also, when you rewrite links don't use relative paths inside rewriting directory. For example: You want to rewrite a link, like <a href="./Contact"> to index.php?page=$1 and in this index directory try to set up a relative path like <a href="./Home"> the browser should display the link as - <a href="./Contact/Home", not just ./Home, but that's wrong. Be careful and use absolute paths. Edited September 22, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/282350-weird-issue-with-stylesheet/#findComment-1450611 Share on other sites More sharing options...
Love2c0de Posted September 22, 2013 Author Share Posted September 22, 2013 Hi Jazz, Thanks for the reply. I added the base tag and I now have my images loading ok, the only things not loading now are my 2 stylesheets, font.css and main_styles.css I will look into the absolute path later as I'll be away soon. Just googled it and played around with {SERVER_NAME} but no luck. However will research later. I'm not quite sure on this line in the console though: http://www.tspv-websites.co.uk/Contact/css/main_styles.css The /css/ directory is not within a directory called Contact, it is in the same directory as my main index.php, whereas the actual Contact HTML file is a couple stages above. Thanks again for the reply! Kind regards, L2c. Quote Link to comment https://forums.phpfreaks.com/topic/282350-weird-issue-with-stylesheet/#findComment-1450637 Share on other sites More sharing options...
Love2c0de Posted September 22, 2013 Author Share Posted September 22, 2013 Good morning again, I added the <base> tag above all my other external files in the <head> and it's working fine now. Thank you very much. Kind regards, L2c. Quote Link to comment https://forums.phpfreaks.com/topic/282350-weird-issue-with-stylesheet/#findComment-1450641 Share on other sites More sharing options...
jazzman1 Posted September 22, 2013 Share Posted September 22, 2013 I added the <base> tag above all my other external files in the <head> and it's working fine now Good for you I completely forgot about it, because the browser reads the content from Top to Bottom and Left to Right ( in normal languages) Quote Link to comment https://forums.phpfreaks.com/topic/282350-weird-issue-with-stylesheet/#findComment-1450653 Share on other sites More sharing options...
jazzman1 Posted September 22, 2013 Share Posted September 22, 2013 off: Your background is huge and very heavy to people like me who prefer to browse on the web without any cache. You have to consider using some CSS techniques. Quote Link to comment https://forums.phpfreaks.com/topic/282350-weird-issue-with-stylesheet/#findComment-1450686 Share on other sites More sharing options...
Love2c0de Posted September 22, 2013 Author Share Posted September 22, 2013 Good evening Jazzy, What would you suggest CSS wise? Should I optimize the image using an online image optimization tool? Thank you for further feedback! All criticism is greatly welcomed! Kind regards, L2c. Quote Link to comment https://forums.phpfreaks.com/topic/282350-weird-issue-with-stylesheet/#findComment-1450709 Share on other sites More sharing options...
jazzman1 Posted September 23, 2013 Share Posted September 23, 2013 Good morning gardener I'm afraid I'm not the right person in CSS. Just create a new topic thread in the HTML/CSS section, it's free of charge Take a look at here and here. Quote Link to comment https://forums.phpfreaks.com/topic/282350-weird-issue-with-stylesheet/#findComment-1450790 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.