Php css switch?

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
User avatar
-ds-
Registered User
Posts: 554
Joined: Wed Sep 14, 2005 7:12 pm

Php css switch?

Post by -ds- » Tue May 16, 2006 8:07 pm

I'e been trying, but not enough php knowledge is stopping me.

Basically I want a couple of links in my overall_header.tpl file that allow me to switch the css (eg.: Text size: small, medium, large)

I would have 4 different stylesheets (default, small, medium, large) and try and switch them using a cookie to store the users choice for other pages.

The script I have to do this is from here: http://www.sperling.com/examples/styleswitch/


For the switcher file ( I thought this could be modified to saved as includes/css_switch.php and then simply include it in the includes/page_header.php) I have

Code: Select all

<?php
$set = ( isset($_GET['set']) ? $_GET['set'] : "style1" );
setcookie ('thestyle', $set, time()+31536000, '/', '', 0);
header("Location: $_SERVER[HTTP_REFERER]");
?>


I have tried rewriting this to this:

Code: Select all

<?php

if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
}

define('HEADER_INC', TRUE);

//
// CSS Switch MOD
//
// change 'yourdomain.com' to your domain name
//
setcookie ('sitestyle', $set, time()+31536000, '/', 'yourdomain.com', '0'); 


$css_style = echo (!$sitestyle) ? 'defaultstyle' : $sitestyle;

$stylesheet = $css_style '.css'


$template->assign_vars(array(
		'STYLESHEET' => $stylesheet));
//
// CSS Switch MOD
//

?>
Then something like this for the overall_header.tpl code:

Code: Select all

<link rel="stylesheet" href="templates/subSilver/{STYLESHEET}" type="text/css">
<link rel="stylesheet" href="templates/subSilver/{T_HEAD_STYLESHEET}" type="text/css" title="default">
<link rel="alternate stylesheet" href="templates/subSilver/small.css" type="text/css" title="small">

... etc ...
Is something like this possible?

Or maybe help me rewrite this:

http://www.gr0w.com/articles/code/css_s ... ript_free/


I would be very greateful and it would be a nice addition to phpbb, as I can't find any mods that do anything similar.

User avatar
-ds-
Registered User
Posts: 554
Joined: Wed Sep 14, 2005 7:12 pm

Post by -ds- » Wed May 17, 2006 6:01 pm

anyone know or care to lend a helping hand??

User avatar
-ds-
Registered User
Posts: 554
Joined: Wed Sep 14, 2005 7:12 pm

Post by -ds- » Sun May 21, 2006 10:39 pm

Noone interested in something like this????

User avatar
-ds-
Registered User
Posts: 554
Joined: Wed Sep 14, 2005 7:12 pm

Post by -ds- » Tue May 30, 2006 4:30 am

:roll:

User avatar
-ds-
Registered User
Posts: 554
Joined: Wed Sep 14, 2005 7:12 pm

Post by -ds- » Sat Jun 03, 2006 4:40 pm

:oops:

User avatar
-ds-
Registered User
Posts: 554
Joined: Wed Sep 14, 2005 7:12 pm

Post by -ds- » Tue Jun 13, 2006 2:11 pm

hello?

sickmusic
Registered User
Posts: 24
Joined: Fri Oct 25, 2002 1:22 pm
Location: London, UK
Contact:

Post by sickmusic » Tue Jun 13, 2006 7:02 pm


Post Reply

Return to “[2.0.x] MOD Requests”