This forum is for assistance with theme development.

node.tpl.php changes not working for some reason

Hi folks,

I tried modifying my node.tpl.php file within my drupal theme to change the look and feel of certain pages. For some reason, my changes are not working. I uploaded the node.tpl.php file to the correct directory on my server. I also created a node-$story.tpl.php file to modify the pages that have story nodes on them to no effect either. The Drupal handbook says I also need to modify the template.php file in my theme to get the node-$story.tpl.php file to take effect, but I must have my php snippet incorrect cuz nothing is happening.

First line of generated page always blank?

Hi all,

i have a weird problem. My page.tpl.php file begins with a doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
right there on line #1.. but when my page executes, the generated html has line 1 as blank, with the DOCTYPE appearing on line #2

This makes the validator burp at me.. while i know it is *techically* compliant, it bothers me that i can't get rid of that blank first line.

any suggestions?
thanks!

Adding dynamic link (Login/Profile) to primary/secondary-links menu

Hi there,

I just started working on a theme for my Drupal website. I've a question about the HeaderMenu.
I want to add a "Login" link in the secondary-links of the Headermenu.
When you're already Logged in, the secondary link wont say "Login" anymore but something like "Profile"

I've been working on the page.tpl.php file for some time now and I came up with the following:
With the function bram_verzint_iets() I check if a user is logged in or not. If not I add the array("Login","path to login page",array("Login here")) to $secondary_links. (The array is filled in the same way as all array's in $secondary_links)

page.tpl.php:
if (isset($secondary_links)) :

 $secondary_links[] = bram_verzint_iets();//my coding <----------
 

print theme('links', $secondary_links, array('class' => 'links secondary-links'))
endif;

template.php:

function bram_verzint_iets()
{
	global $user;
	$output='';
	
	if(!$user->uid){
		$output=array("Login","login",array("Ledenlogin"));//path to login node isnt right, still searching for right path.	
             }
	else{
		$output=array("Profiel","user/".$user->uid,array("Bekijk je profiel"));
	}
	return $output; //output is array format
}

Whats wrong with that php function? Want to limit views output for one Term ...

I use a function in template.php to theme a views output.
(see also here, that is where the code is from: http://drupal.org/node/42603)

Now I want to limit the output for one term ("newsletter") for that term should only one node be shown. All other terms should be processed without limit.

Output should be as follows:
Term 1
-- node 1
-- node 2
-- all other nodes assigned with term 1
Term 'newsletter'
-- node 1 (No other nodes!!)
Term 3
-- node 1
-- node 2
-- all other nodes!

I changed the function and added

  if ($node->term_data_name == 'newsletter') {
      $set[$node->term_data_name][] = $node;
      continue;    } 

But that doesn't limit the Output for 'newsletter' all nodes are shown.
If I change the continue to break, Output stops at all after printing one node with term newsletter.

here is the function:

<?php
* This function goes in your template.php file
*/
function phptemplate_views_view_list_aktuelles_6_block($view, $nodes, $type) {
$fields = _views_get_fields();
$taken = array();

// Group our nodes
$set = array();
foreach ($nodes as $node) {
if ($node->term_data_name == 'newsletter') { //this is what I added!
$set[$node->term_data_name][] = $node; //..

themeing cck- user picture

I'm theming a cck type which is parent to usernode (using node family).

I'm trying to display user picture in it

<?php $children = nodefamily_relation_load($nid); ?>
    <?php
      foreach ($children as $childnode) {        
        
        print $childnode->name."<br/>";
        print $childnode->picture."<br/>";
      }
   ?>

Out put is

Pages

Subscribe with RSS Subscribe to RSS - Theme development