Page 1 of 1

changing font size through user

Posted: Sun 23. Jan 2005, 16:52
by aks
Hello,
a user of my site should be able to change the font size through clicking a link/button. I found a description to achieve this in the forum but because I am a novice, in phpcms, php .. and css, I failed to get it work.

I refer to these postings of ssyfrig and brans in the forum (in German language) about changing the style of a site:
http://www.phpwcms.de/forum/viewtopic.p ... t=vorlagen

This was how ssyfrig succeeded:

---
Step 1
Download of file styleswitcher.js from http://www.alistapart.com/articles/alternate/

Step 2
Adjust file „index.php“, line 77-82

echo "<html>\n<head>\n<title>".$content["pagetitle"]."</title>\n";
echo '<meta http-equiv="Content-Type" content="text/html; charset=';
echo PHPWCMS_CHARSET."\">\n<script src=\"";
echo $phpwcms["templates"].'inc_js/frontend.js" type="text/javascript"></script>'."\n";
echo '<link rel="stylesheet" type="text/css" href="'.$phpwcms["templates"]."inc_css/".$block["css"]."\">\n";
echo $block["htmlhead"]."</head>\n\n<body".$content["body"].">\n";

Step 3
In the backend at admin > templates > html head add

<link rel="alternate stylesheet" type="text/css" href="../cssswitch/frontend2.css" title="wacky"/>
<script src="cssswitch/styleswitcher.js" type="text/javascript"></script>

Step 4
In article or template add

<a href="#"
onclick="setActiveStyleSheet('default');
return false;">change style to default</a>

<a href="#"
onclick="setActiveStyleSheet('paul');
return false;">change style to paul</a>

---
I (aks) created a folder “cssswitch”, path: phpwcms/cssswitch, with the files “styleswitcher.jos” and “frontend2.css” in it.

The link “change style”.. appears but nothing happens when I click it. Any ideas why not? Maybe wrong location of folder?

Thanks

Posted: Sun 23. Jan 2005, 17:26
by frold
may we see a demo?

Posted: Sun 23. Jan 2005, 18:00
by aks
frold wrote:may we see a demo?
->
http://www.garves.de/phpwcms1/index.php
(that´s a site just for learning phpwcms)

Posted: Sun 23. Jan 2005, 23:23
by ssyfrig
Hi

Here can u see a demo http://phpwcms.syfrig.net/
On the main page you can switch between default and wacky.

Sven

Posted: Sun 23. Jan 2005, 23:32
by ssyfrig
Hi

I am not sure, but ..

this is your Link

Code: Select all

<a href="#" onclick="setActiveStyleSheet('paul'); return false;">change style to paul</a>
and this these your css informations

Code: Select all

<link rel="alternate stylesheet" type="text/css" href="../cssswitch/frontend2.css" title="wacky"/>
you should change paul to wacky in your link.

hope this help
Sven

Posted: Mon 24. Jan 2005, 16:45
by aks
ssyfrig wrote: you should change paul to wacky in your link.
Ok, now it works!
First I changed paul to wacky. Thanks for that tip, ssyfrig!
Then, after some trial and error, I deleted "../" in step 3:

Before
<link rel="alternate stylesheet" type="text/css" href="../cssswitch/frontend2.css" title="wacky"/>
<script src="cssswitch/styleswitcher.js" type="text/javascript"></script>

After
<link rel="alternate stylesheet" type="text/css" href="cssswitch/frontend2.css" title="wacky"/>
<script src="cssswitch/styleswitcher.js" type="text/javascript"></script>

Cheers!