This forum is for assistance with theme development.

To Block or not to Block?

I’m relatively new to Drupal and am trying to wrap my brain around the best way to do things, which I’m finding out there are many. I need to have an image appear on each page depending on a variable set within that node. I created a CCK node type with this image field, so that’s not a problem. Getting it to appear on the page is not the problem, it’s figuring out the best way to do it that seems to be burning substantial brain cycles.

My initial go at it was to create a region in my theme, then create a block containing the logic I needed to determine which image to display and have that block display in that region in my page.tpl.php file. Okay so far – except that I just realized no $node variables are available in my block. I’m assuming I need to either create a module to create the block content or somehow use the _phptemplate_variables function in my template.php file. I’m trying to not only think about the logic, but the overhead involved in my approach. I could easily put the PHP logic right in my page.tpl.php file (where I know I have all the $node variables available), but I was trying to keep as much logic out of my PHP file as possible (good idea?). However, that approach seems to be the easiest approach with the least overhead. Regarding overhead, I’m referring to the Block method where the block would have to be called (overhead), I need to theme it for my purposes (more overhead), then I need to make the $node variables available to it (again, more overhead).

How does a theme check to see if users are logged in?

For my page.tpl.php, I want to show certain sections only if somebody is logged into the website.

I tried:

 if ($user->uid) { 
echo "internal stuff goes here";
 } 

...but this did not work.

Any suggestions as to how I could get this to work?

Is there some elegant way how to show tags, categories separated?

Hi, I am using in site with few vocabularies.
Is there some elegant way how to format in theme for node showing of tags, categories?

For example:

Instead of something like this:

 term1_in_voc1 tag3_in_voc4 term2_in_voc1 tag2_in_voc4 tag1_in_voc4

I need that I can put terms from each vocabulary separate or that some vocabularies will not be shown:

need pipes in my menu

Hi everyone. I have been searching and fiddling for days on this issue. I have failed and must now ask for help. I have a menu that I am displying in my footer. I am using this code in the page.tpl.php file:

<?php 
$menuhtml = theme_menu_tree(60);
print $menuhtml;
?>

I would like to add pipes between the menu items. Can someone tell me what code I could add to make this a reality?

I tried this based on code I found in a theme that had piped secondary links. It did not work though.

Change primary links theme

Hello everyone,

I am trying to create the tab look that this site current has. I was wondering if there is an easier way to do it other than the one I am currently having problems with.

First i created a background image for the a href tag. display:block; float:left; , however the first tab is shifted a little higher then the rest of the tabs.

Is there a different way to go about this? I am new to the drupal and PHP but have a pretty good HTML background.

Need to add ID to UL element in menu

Hi all...

I'm trying to add an ID to an UL element of a menu.

I see Drupal uses menu.inc to construct the menus, but, i need a special ID in the first or main UL of a list for a specific drop-down app.

Any ideas about how to add an ID to the first UL of a specific list?

Thanks!

Pages

Subscribe with RSS Subscribe to RSS - Theme development