• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Control CSS server side

meow

Rebutted, enshrined
NLC
Do you know where I can get server side scripts that let the user change Style Sheet or disable CSS by clicking a link? Not ASP. I've been searching for hours. :(
 
easy way is to use php

in your page have link to css '<?=$style?>.css'

so if you have a link page.php3?style=1 it'll use 1.css etc

you'd have to add ?style=<?=$style ?> to all the links though and have some basic error checking for valid $style

with the code you've being posting recently you should have no difficulties ;)
 
Lucifer, you are my favorite! ;) *meow purring friendly*
I knew there would be an easy way. Only I don't get sh*t. I've never even installed a php script. Would you please help me some more? *still purring*

With link do you refer to link rel or the a href they should click on? Could you post a complete sample of how it would look like? *meow purring like a helicopter*

Eh...what smart code should I have posted? The only programming I know a little about is in a language that is so limited that no one knows it exists. :)
 
O, Prince of Darkness. I worship thee.
Can I come and live with you? :D

The .htaccess? But I didn't manage to get the crap to work.

Will you teach me how to do it with Perl/SSI now? :p That is possible, right? And to the weekend maybe some basic classes in Perl? He he. ;)

Thank you very much!

Purrrrrrrrrrrrrr! ;)
meow
proud owner of 500MB/10GB Unix space to the total cost of $14 - eat it suckers! :D
 
WHOOOPIE!!! Wow. Now I'm in love. :eek:

Thank you so very much. I've asked about this at several places and all I have got is 100 line long ASP scripts. I knew it had to be simpler than that.

Huh, my 500Megs are quite empty. The Directoris one I got because I want a playground and learn some more useful scripting than the unknown language I have been fiddling with. Then Yupapa dropped another one in my knee. Wasn't planned. I had just signed up for one of the free accounts, not applied for anything. Guess he is just a nice fellow.

Boy, are you good or what?!? I'm off buying black candles. :D
 
do it the php way

put the code <? ... ?> in a file called css.php3
make sure it has the <? ?> bits

put <? include "css.php3"; ?> in the header of all your pages so that they include it (php is very tricky ;))
use a path if needed

add ?colour=$colour to all your hrefs on the pages and name them *.php3

smile :)

you might need to use <?php instead of <? depending on your setup <?php always works but is harder to spell


Boy, are you good or what?!?

thinks...
 
Put the stuff in an external php file and include it with a snip of inline.php? Yes sir. I'll do tomorrow.

I after much ado got the first php thing to work. I tried at Directoris and f2s. Turned out that f2s decided to cache my pages for the second time ever and that Directoris has php4 . I renamed the file to php and then it worked.

Question: does the extension .php always work? If so way bother with php3, php4 and so on? If I use .php'n' must n match the verion of PHP installed on the server even if the server has an later version than I declare to use?

This was fun. :p
 
the extension is just what your server wants to use you can set *.meow files to be run as php

my server doesn't let me use .php but's fine with .php3 even though they upgraded to php4 just .php isn't set up as an extension. It's a pain cos I have done things on my machine .php and .php3 are ok and i'd done the pages as .php so it didn't work on the server till I swapped them.

it's like the <? <?php thing depends on your setup

the extension doesn't effect the version of php used unless you had more than one copy and set diff extensions to call different ones (who would?)

I did a line wrong on that last post :eek:

add ?colour=$colour to all your hrefs on the pages

?colour=<?=$colour?>

needs the <? ?> to go into php otherwise it's just good old html

<?= same as <? echo but doesn't work in php3 hence my servers upgrading should get them to let .php be an extension too but involes sending email :(
 
Aha, same thing with the extension as with SSI? So theoretically it could be .html? Then severs use the version number just to show off their software...Stupid. Looks ugly.

Thanks for the update. I haven't got around to test that one yet. I think you just saved me some pain (again). :)
 
Originally posted by meow
So theoretically it could be .html?

yep but your server would grind trying to process all that html as php (which it is - almost)

I quite like php3 it makes it look complicated also I've always had a soft spot for mp3 php4 is ugly though
 
Originally posted by lucifer
the extension is just what your server wants to use you can set *.meow files to be run as php

Okay, I'm going to guess that I'm just being dense and not getting how to do this...But could you explain it in a little more detail?

Angela, who would love you forever if you did.
 
from my httpd.conf config file for apache web server

Code:
# PHP

ScriptAlias /php/ "c:/usr/php/" 

AddType application/x-httpd-php .php 

AddType application/x-httpd-php .php3 

AddType application/x-httpd-php .phtml 

Action application/x-httpd-php "/php/php.exe"


this sets .php .php3 .phtml files to be run by php and the output sent to the browser

if I add

Code:
AddType application/x-httpd-php .meow

then it runs .meow files as php :D
 
Originally posted by lucifer
then it runs .meow files as php :D
What a perfectly lovely idea! :D

Whould this work in an .htaccess? Heavely guessing here...:eek:

AddType application/x-httpd-php .php .php3 .phtml .meow
AddHandler server-parsed .php .php3 .phtml .meow
 
meow

here is the updated css.php

Code:
<?
# ERROR CHECK AND INCLUDE CSS
if ($col=="red" || $col=="green" || $col=="blue"){
	echo "<link rel='stylesheet' href='$col.css' type='text/css'>";
}

# GET CURRENT PAGE INFO FOR CHANGER
$pageinf=parse_url($REQUEST_URI);
$pageurl=$pageinf['path'] . "?col";

# SET UP VARS TO INCLUDE ON PAGES
$changelink="<a href='$pageurl=red'>red</a> | <a href='$pageurl=green'>green</a> | <a href='$pageurl=blue'>blue</a>";

$link="?col=$col";
?>

new features

links between your pages become :D

<A href="mypage.php<?=$link?>">...</a> :)

and put <?=$changelink?> on the page where you want the colour changer :cool:

limitations

the colour changer link kills all query info on the url you could change it so it doesn't :(


if you have session tracing stuff on your php setup you could do away with having to rewrite the links by having them re-written on the fly but when you have seach and replace you don't really need it

I think you have a rival - cat fight ?!!?
 
Back
Top