Dysan Posted January 1, 2008 Share Posted January 1, 2008 Using PHP, is it possible to load different CSS files, upon different images being clicked? Altogether, there will be 4 different text size settings, can the user can select, depending on how big the text needs to be, in order for the user to see correctly. Upon each image being clicked, how do I load a different style sheet (CSS File)? Quote Link to comment https://forums.phpfreaks.com/topic/83925-adjust-text-size-load-css-file/ Share on other sites More sharing options...
teng84 Posted January 1, 2008 Share Posted January 1, 2008 you can create external link for your CSS and call them if they are called.. so you will put the names of your file in a variable and call it when needed.. or maybe if you only mean class do it the same you may store your class name in an array and call them when needed Quote Link to comment https://forums.phpfreaks.com/topic/83925-adjust-text-size-load-css-file/#findComment-427106 Share on other sites More sharing options...
phpQuestioner Posted January 1, 2008 Share Posted January 1, 2008 You can have each image to be a link with a query string to query your PHP conditional validation; something like: <a href="<?php echo "". $_SERVER['PHP_SELF'] .""; ?>?layout=1"><img src="smallfont.jpg" border="0"></a> <a href="<?php echo "". $_SERVER['PHP_SELF'] .""; ?>?layout=2"><img src="regularfont.jpg" border="0"></a> <a href="<?php echo "". $_SERVER['PHP_SELF'] .""; ?>?layout=3"><img src="largefont.jpg" border="0"></a> <a href="<?php echo "". $_SERVER['PHP_SELF'] .""; ?>?layout=4"><img src="xlargefont.jpg" border="0"></a> <link rel="stylesheet" type="text/css" href="<?php $layout = $_GET['layout']; if ($layout == "1") { echo "stylesheet1.css"; } else if ($layout == "2") { echo "stylesheet2.css"; } else if ($layout == "3") { echo "stylesheet3.css"; } else if ($layout == "4") { echo "stylesheet4.css"; } else { echo "stylesheet1.css"; } ?>"\> I would also set a cookie or create a session; that would keep displaying the style sheet they choose; until the cookie or session expired. This way, they do not have to keep reseting the font size to their prefered viewing size. Quote Link to comment https://forums.phpfreaks.com/topic/83925-adjust-text-size-load-css-file/#findComment-427110 Share on other sites More sharing options...
Dysan Posted January 1, 2008 Author Share Posted January 1, 2008 Is it possible to do this with just one file, and select a diffrent declaration upon a image being clicked? Quote Link to comment https://forums.phpfreaks.com/topic/83925-adjust-text-size-load-css-file/#findComment-427138 Share on other sites More sharing options...
teng84 Posted January 1, 2008 Share Posted January 1, 2008 yes ! and its better if you will post some of your codes.. actually phpquestioner is almost there! Quote Link to comment https://forums.phpfreaks.com/topic/83925-adjust-text-size-load-css-file/#findComment-427158 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.