This forum is for assistance with theme development.

Trying to make forum nodes adopt comment templates... HELP!

I'm not too strong in PHP, so I'm sure this is just a coding error on my part. I'm trying to have my forum nodes mimick the module nodes in layout and design. I've already done a bit of tweaking on the comment module and I'd like it to apply to forum nodes as well.

In my node.tpl.php I attempted to include an "if/then" statement, but I can't seem to get the syntax right.

I have something like this:

testing drupal cvs with marvin theme

getting this msg: warning: Missing argument 3 for theme_menu_local_task() in /home/jwilde/public_html/ideascape/includes/menu.inc on line 696. each time I open a page with tabs on the node, eg, access control with the three tabs - permissions, roles, access rules. Any ideas? www.advancinginsights.com

Thanks Jim

phpTemplate CSS IE width: 95% textarea issue

I'm having CSS issues with Internet Explorer and using CSS to set the textarea to 95%. It looks pretty without text, but as soon as you type it expands beyond its set area.

I've tested this with the drupal site, and ofcourse it works great. I just wondered what trick you used, or what pit I've falled into.

New PHPTemplate functionality

I have been readying the next version of PHPTemplate for the 4.6 release (the RC should be out very soon now). You can get this in CVS now, but it is NOT meant for 4.5. I am still undecided wether to back port it.

  1. Did away with the template caching. I did some benchmarking and it appears that file_exists() is nowhere near as heavy an overhead as I thought. This means you don't have to go to admin/themes to have the cache refresh.
  2. $seqid and $zebra variables are now available to all templates without needing to do the template.php hack (see: http://drupal.org/node/16383).
  3. $node object available in page.tpl.php on node view pages. This allows for some very creative layouts, and styling the entire page different for different node types (by adding a node-$node->type class to the body for instance).
  4. Automatic loading of node-$type.tpl.php files. You can create different templates for story / blog / etc. nodes. Practically, I still think CSS would be better for this, but it has been requested often, so here it is.
  5. Automatically uses a favicon.ico if found in the theme directory.

How do you create two page.tpl.php for a theme?

In Protecting content from non-logged in users when using phptemplate overrides there is talk about how to customize the template.php so that anonymous users cannot see private information on the site, since overiding via phptemplate goes around permissions.

I'd like to extend this to allow more customization in two ways

  1. display different page layouts for anonymous and logged in users (eg- display left and right columns only for logged in users).
  2. create different page layouts depending on what is on the page (eg- blog)

To approach task #1 i've tried this in my template.php:

/**
* check if the user is logged in before invoking the template override
*/
global $user;
if($user->uid) { // check to see if the user is logged in
	function phptemplate_page($content, $title = NULL, $breadcrumb = NULL) {
  	return _phptemplate_callback('page', $vars);
	}
}

elseif (!  $user->uid) {
	function phptemplate_page($content, $title = NULL, $breadcrumb = NULL) {
 	 return _phptemplate_callback('page_anon', $vars);
	}
}

This, in theory, would call page_anon.tpl.php for anonymous users and page.tpl.php for registered users. But I get this error:

Fatal error: Cannot redeclare phptemplate_page() (previously declared in *edit*/themes/engines/phptemplate/phptemplate.engine:143) in *edit*/themes/my_theme/template.php on line 15

The line # is actually corresponding to the first mention of phptemplate_page, i've edited out the parts that you can see by following the link above.

So am I to assume that it's not possible to customize the call to page.tpl.php? Or am I missing something else?

I think the problem will also help solve task #2.

template.php is giving me problems

I apologize for the double post. I shoudl have posted this problem in this forum, but it appears to be too late.

I am having a problem with template.php and theming modules. PLease read about my problem here:

http://drupal.org/node/18276

Can anyone help?

Thanks in advance!

Mateo

Pages

Subscribe with RSS Subscribe to RSS - Theme development