This forum is for assistance with theme development.

Multiple page template problem

heyy, Im setting up multiple page templates ready to customize each of them separately.

Im using Drupal 5.0 - (BlueMarine theme as a base). I've removed the print $header so I can see when a selected page has loaded that the correct template.tpl.php has been targeted.

Im targeting pages like this article says to. Renaming templates to 'page-node-1.tpl.php 'page-node-2....' ect.. but I want to target the index/front page.
So far ive tryed using this code in page.tpl.php:

Garland Background img.

Does anyone know how to ad a background image to garland and/or minnelli.

thanks in advance

TextEdit on My Mac won't open one file.tpl.php properly, but all others in the theme?

I am curious about this and should mention I am new to Macs, but I am playing with the 'aquasoft' theme, and can open all the txt files in the theme, but when I open page.tpl.php TextEdit seems to be attempting to display symbols rather than ascii text. So I get a couple dots, a line, and some question marks in blue boxes rather than the code that I need to edit. Very strange. Any Mac users out there know why this is??

Thanks

Switching stylesheets based on arbitrary path elements (arguments)

I am using Drupal 4.7 with CCK and pathauto (and thus clean URLs). I am using a heavily customized theme based originally on the Spread Firefox theme.

Right now I am using customized template.php and page.tpl.php files to display particular templates (page-[content-type].tpl.php) depending on the content type. Since I'm using pathauto, these don't appear as "node/nid" (although you can still go to those addresses) but as the arbitrary name of the page (e.g. http://example.com/whatever).

What I want to be able to do is to tack on something in the URL to serve users the SAME template with a DIFFERENT stylesheet. Moreover, I want to be able to have MORE THAN ONE of these.

So if someone were to go to http://example.com/whatever?print=y or http://example.com/whatever/print or something of that sort, one would get print.css rather than the default theme and Drupal stylesheets. And if one were to go to http://example.com/whatever?silliness=y or http://example.com/whatever/silliness, one would get silliness.css.

This is basically a "stylesheet switcher," except that I want to be able to control it through the URL, and I don't want it to set a cookie (as most switchers do) because I only need the alternate stylesheet for that one page.

Multiple funtions in templates.php returns blank page?

I have installed page_title-4.7.x-1.x-dev and flatforum-4.7.x-1.x-dev. The modules were tested and work flawlessly; however both require additions to templates.php.

The problem is that the two functions work when used separately but when both are added to templates.php I get a blank page when viewing the site. Please have a look at the code below; any help will be greatly appreciated.


<?php

/*
page_title.module addition
*/
function _phptemplate_variables($hook, $vars) {
$vars = array();
if ($hook == 'page') {
if (module_exist('page_title')) {
$vars['head_title'] = page_title_page_get_title();
}
}
return $vars;
}

/*
flatforum.module addition
*/
// $Id: template.php,v 1.7 2006/05/11 18:17:29 ayman Exp $
function _phptemplate_variables($hook, $vars) {
static $is_forum;
$variables = array();
if (!isset($is_forum)) {
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == '') {
$nid = arg(1);
}
if (arg(0) == 'comment' && arg(1) == 'reply' && is_numeric(arg(2))) {
$nid = arg(2);
}
if ($nid) {
$node = node_load(array('nid' => $nid));
}
$is_forum = ($node && $node->type == 'forum');
_is_forum($is_forum);
}
if ($is_forum) {
switch ($hook) {
case 'comment' :
$variables['template_file'] = 'node-forum';

Providing theme options

I am designing a new theme for my website and am interested in contributing a generic version of it. It involves sytylized blocks with a variety of motifs and color schemes. I want to provide certain options to users of the theme. I currently have in the block.tpl.php file:

$columns = '1'; // 1 = right, 2 = left, 3 = both
$color = 'white'; //white, red, pink, etc.

Then I have logic that looks for these and adds the apprpriate class name in the HTML code. It's not a big deal for a user to open up the one file and change a couple values. Great...

Pages

Subscribe with RSS Subscribe to RSS - Theme development