jonah Posted December 13, 2003 Share Posted December 13, 2003 I would like to have a few values for the stylesheet be pulled from the database. As far as I know you cannot pass variables to a css file, so I have done the following: 1. rename stylesheet.css to stylesheet.php so that it is processed by PHP 2. added require('includes/application_top.php'); to the top of stylesheet.php 3. changed all instances of <link rel="stylesheet" type="text/css" href="stylesheet.css"> to <link rel="stylesheet" type="text/css" href="stylesheet.php"> This works great and I can move whatever settings that I would like to have definable to the database. Some may ask why would I even bother doing this. I am using the infobox skins contribution and added an entry for the infobox heading text color, so that when a skin is selected the text color can be defined also. The problem is that on some pages, and not everytime, stylesheet.php doesn't get loaded and the page is a mess. When I refresh the page everything is fine. To verify that this is not something with my PC I have tried loading it on a different PC with the same effect, although still it happens only occasionally. What could be causing this? Was it correct to include application_top in stylesheet.php? It seems as though at times the page is loading before the stylesheet, is there a better way to include this file? I hope this posting makes sense......please help! Link to comment Share on other sites More sharing options...
jonah Posted December 13, 2003 Author Share Posted December 13, 2003 Here are a few screenshots of what is happening. Note, I cannot replicate this error when using stylesheet.css. Stylesheet didn't load! After refreshing the page. Link to comment Share on other sites More sharing options...
paulm2003 Posted December 13, 2003 Share Posted December 13, 2003 Is it an idea to change it to an in document stylesheet? Allthough I am afraid, not sure, the pages will load slower that way. Maybe only styles you want to load from the database as an in document stylesheet. Link to comment Share on other sites More sharing options...
jonah Posted December 13, 2003 Author Share Posted December 13, 2003 I don't really want to create a stylesheet for each page. I would just like to have certain entries be read from the database. Like I said this works fine, except for the stylesheet occasionally not loading. If you would like to see the problem that I am having you can view the site that I am working on here: http://dropshipsites.net. To recreate the error click the Cart Contents link in the header anywhere from 3-7 times (waiting for the page to load between clicks, of course). Link to comment Share on other sites More sharing options...
jonah Posted December 13, 2003 Author Share Posted December 13, 2003 Problem solved! I can now pass variables to the stylesheet. The problem was with including application_top.php. Using the include statement to include the whole file was messing things up. I took the relevant pieces of code that I needed out of application_top.php and pasted them to the top of my stylesheet.php file and voila, it works. Link to comment Share on other sites More sharing options...
equilla Posted December 13, 2003 Share Posted December 13, 2003 Hi Jonah, still not quite sure why you needed to involve databases to get the result you wanted as there is already a stylesheet class that controls the presentation of the infobox header text. It's very inventive what you have done nonetheless! In the new version of which a beta should be posted in the next couple of days, I now introduce the possibility of maintaining 10 different slices sets and being able to map any one of these onto each of the infoboxes individually. This is the first step to allowing more complex designs to be accomplished. There will thus be 10 stylesheet entries - one for the infobox header in each slice set (you may want to have different text styles for each box design). I'd appreciate to understand better why you had to do what you did because I don't want to introduce anything that will mess up what people have done already when this new more powerful release hits the streets in the near future. Cheers, Mark Stephens Contribs: http://www.oscommerce.com/community/contributions,1680 http://www.oscommerce.com/community/contributions,1467 http://www.oscommerce.com/community/contributions,1422 Link to comment Share on other sites More sharing options...
jonah Posted December 13, 2003 Author Share Posted December 13, 2003 With different skins the header text doesn't look right so rather than having to edit the stylesheet everytime I change skins I thought that it would be easier to just have a box where I could type in the color code and have it make the changes in the stylesheet for me. Another reason that I had done it this way is that I was thinking of making a stylesheet editor in admin. Just too much time on my hands I guess! When is work on the button selector going to begin? I thought of modifying infobox skins contribution so that I can cut an image file containing button sets, but I didn't really want to figure out where to cut over 30 images. Again, too much free time. Link to comment Share on other sites More sharing options...
paulm2003 Posted December 13, 2003 Share Posted December 13, 2003 I don't really want to create a stylesheet for each page. In document does not mean different for each page (could be, but does not have to be), you would just include/require the same stylesheet.php in all output files. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> <style type="text/css"> <!-- <?php require(stylesheet.php); ?> --> </style> </head> <body> Glad you managed to solve it already though, sounds very interesting! I already made a simple PHP stylesheet switch once, but your idea sounds really cool. Especially for the colors. succes! Link to comment Share on other sites More sharing options...
equilla Posted December 13, 2003 Share Posted December 13, 2003 Hi Jonah, now I understand the problem! In fact, it gets worse with the proposed new version of ISM so I am looking at tweeking header/footer.php so that the skins for these can be set in admin at the same time as the infoboxes. The button creator maker mnay get started next week if I get some time whilst travelling to/from the Hague, but I still have some unresolved issues in my mind: 1. Gdlib/.gif issue (no gif write support until next summer) 2. Whether to copy images onto buttons or use Truetype fonts (another server build requirement to have truetype support enabled there...). I do have a photoshop script I put together that can take an image and generate all the buttons texts from it and save them out to file, so that may come in handy too and save some time. If you have too much time on your hands then of course any assistance would be most welcome ;) Cheers, Mark Stephens Contribs: http://www.oscommerce.com/community/contributions,1680 http://www.oscommerce.com/community/contributions,1467 http://www.oscommerce.com/community/contributions,1422 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.