I am pretty happy with the flexibility of PHPTemplate. However, I would like to have two seperate style sheets. One would load for the majority of the site and be fixed width and in the center. Whenever you enter the admin section you would get a more flexible full window width style sheet. Does anyone have any suggestions on how to accomplish this in PHPTemplate?

My ideal situation would be a PHP snippet that would look at the current page URI and check for the '/admin/' string. Based on that check it would print the default style sheet call or the admin style sheet call.

I just can't find any information on how PHPTemplate calls styles other than that it only looks for a single file called, style.css. In my page.tpl.php file all I have is :

<?php print $styles ?>.

Comments

bryan kennedy’s picture

So I guess I sorta answered my own question. Here is what I came up with:

I replaced
<?php print $styles ?>
with
see code at : http://ltc.smm.org/geeks_drupal/code.txt

I had to provide a link to the code since it won't post in the forum b/c of the PHP.

That works for me but I don't know if there is an easier way to do this for a non-php user who might want this functionality. Any ideas are appreciated.

chrisada’s picture

AT CivicSpace http://www.civicspacelabs.org the front page is fixed width but some pages, e.g. download, are fluid. I have no idea how they did it though.

Chris

adrian’s picture

is use the following in your conf.php

$args = explode('/', $_GET['q']);
if ($args[0] == 'admin') {
  $GLOBALS['custom_theme'] = 'mytheme/admin';
}

Ideally you would use the args() function, but i am not sure if it is already defined at that point.

The print $styles is to print the style tags. by setting your theme to mytheme/style, it will automatically use themes/mytheme/admin/style.css instead of themes/mytheme/style.css

this works for all kinds f themes, and not just phptemplate.
--
The future is so Bryght, I have to wear shades.

bryan kennedy’s picture

I get this script right up to the

$GLOBALS['custom_theme'] = 'mytheme/admin';

part.

Do I need to call the custom_theme var somewhere in my template? I made a folder inside my theme directory called admin and placed the new style.css file in there. But the page doesn't call it. Forgive my ignorance; I did some searching and couldn't find any reference to this information.

boris mann’s picture

Basically, duplicate your entire theme directory and replace the CSS file.

There may be a better way to do it with stylesheets only, but this definitely works. As well, you can have completely different layouts.

Now, if we make this accessible via a regex system similar to the block selection screen, it would make it very easy to select different themes for different sections.

adrian’s picture

it uses the default specified theme, only if a custom theme hasnt been specified.

a theme can be either 'themename' (like chameleon) , or 'themename/stylename' (like marvin).

Stylesheet switching is inherent in the theme system design.

--
The future is so Bryght, I have to wear shades.

adrian’s picture

drupal supports the feature natively now

http://webschuur.drupaldevs.org

Also, i really like the theme for your site, it impresses me more everytime i go there. =)

(i wrote phptemplate btw).

--
The future is so Bryght, I have to wear shades.

bryan kennedy’s picture

hey folks,

thanks for all the help. i really like phptemplate. once we get some really definitive documentation out there and a final version on the projects page it is gonna kick a**. when i get a chance i will write a version of this discussion into the handbook section on phptemplate.

just for clarity, am I right in assuming that to switch themes in the more native drupal way I would link to a page like this

<a href="/node/123?theme=mythemename">Switch to the My Theme, Theme</a>