This forum is for assistance with theme development.

Using phpTemplate to detect section

Hi,

I've been working on a new site (4.7 using phpTemplate) which has a fairly standard layout with a Blog/Articles section and a forum. But I've been wanting the forum to have a different layout, the FlatForum module got me halfway there, but I need the forum page template to be different too.

So I made a little script in the page.tpl.php file to detect if the user was on the a forum page and deliver a different template if they were. Here is the code I'm using, it basically uses the url to detect if it is a forum page or if the node type is 'forum':


<?php

//////////////////////
// DETECT FORUM PAGE //
//////////////////////

$ukf_url_expode = explode('/', url($_GET['q'], NULL, NULL, NULL)); 
$ukf_url_expode_rev = array_reverse($ukf_url_expode); 


$ukf_url_nid = $ukf_url_expode_rev[0];

$sql = "SELECT vocabulary_node_types.vid
		FROM node, vocabulary_node_types
		WHERE $ukf_url_nid = node.nid 
		AND node.type = vocabulary_node_types.type";

$result = mysql_query($sql);
$row = mysql_fetch_row($result);

if ($ukf_url_expode[0] == 'forum' or $row[0] == '1' ):


//////////////////////
// START FORUM PAGE //
//////////////////////
?> 

**Forum Template Code**

<?php 
///////////////////////
// START NORMAL PAGE //
///////////////////////

**Normal Template code**

<?php
 endif;
?>
else: 
?> 

So far it is working fine, but I'm a designer really, not a programmer (I just learn what I need to as I go along) so I'd like the opinion of someone more versed in PHP as to whether it is a good idea to use this system on a production site or if it is a horrible hack that'll cause me problems later.

Change background according taxonomy or path?

Hi all,

I recently visited the joomla page, and I view one nice feature that I want to implement in my drupal system. Is the possibility of changing the background according with the taxonomy or path.

For example you can view this page from joomla.

http://www.joomla.org/ (orange bg)
http://www.joomla.org/content/blogcategory/0/33/ (blue bg)

Can this be done in drupal using a single theme?

Thanks, Simon.

node-blog.tpl.php breaks with comments - ?

Ho there. Using 4.6.5. I imagine this must have come up before, though I can't find anything via search.

I've given my blogs their own theme using blog.tpl.php and node-blog.tpl.php. This works great for a display of blog entries. But it breaks down when comments get involved. Comment actions appear to use a URL which is a regular node, not a blog node - so my theme vanishes. (My blog theme incorporates a changed html structure, so the reversion destroys the layout. If it were purely CSS I could probably have fixed it via extra classes etc.)

How to filter node title through SmartyPants?

I installed SmartyPants module for translating straight quotes to "curly" quotes. I enabled the filter for Filtered HTML input format and it's working correctly for the body text of my flexinode content.

However, the title is displayed without filtering. How can I make Drupal filter it too?

Themeing with AJAX in 4.7 Beta2 (and beyond)

OK, it has probablly been addressed before:

Are there any examples of AJAX in Drupal 4.7 beta2 besides the collapsable fieldsets, which to my understanding is not AJAX? For instance:

• Where can I see autocomplete or progress implemented?
• How would I go about theming some comments additions without refereshing the page? Does anyone know if that possible with the drupal.js files?

Change the way taxonomy lists nodes

Hi,

I used taxonomy on my site, but i want to change the way taxonomy lists the nodes.
What i mean is when someone browses to 'taxonomy/term/', the nodes from that term are displayed in a standard node view (title, teaser, etc..)
However, i would like to display them in the form of a table, to save page space and be able to display some more on 1 page.

How would i manage to do this?
So far i wrote my own modules and showed things the way i wanted, but this is a modification close to the core i think, so i don't know how i would do this...

Pages

Subscribe with RSS Subscribe to RSS - Theme development