[themes] targeting variables in my node-blog.tpl.php file

brendan, fresh-off.com hello at fresh-off.com
Tue Apr 14 05:50:37 UTC 2009


Here's as far as I was able to get using CK Ng's suggestion:

 

function phptemplate_preprocess_node(&$vars, $hook) {

  //try to remove 'blog_usernames_blog' from links array

  $vars['links'] = unset($links[0]);

}

 

 

it throws this error on the template.php page:

Parse error: syntax error, unexpected T_UNSET

 

As I said, writing php from scratch is difficult for me.  Am I even on the
right track?

 

Thanks for any help!

 

Brendan

 

 

From: themes-bounces at drupal.org [mailto:themes-bounces at drupal.org] On Behalf
Of brendan, fresh-off.com
Sent: Monday, April 13, 2009 6:02 PM
To: 'A list for theme developers'
Subject: Re: [themes] targeting variables in my node-blog.tpl.php file

 

Thanks for your responses CK  Ng and J. Sint Jago!

I don't think my PHP skills are good enough to write the necessary function
from scratch. However, I'm usually able to modify existing examples.  

 

CK, Based on your response to Sebastian and the reading on Drupal.org, it
seems I need to add phptemplate_preprocess_node() to template.php.  But  I'm
not sure exactly how its supposed to be written.

 

Using the Devel Mod I got the following info (or see attached screenshot): 

 

---

parents: node.tlp.php < page.tlp.php

function called:  theme_links()

Candidates Function names:  myTheme_links < phptemplate_links < theme_links

 

Next it lists 2 arrays for the theme_links() function.  Those elements are:
links array & attributes array

The links array has 3 elements, the first of which is the array I don't want
to display:  blog_usernames_blog 

----

 

 

I think that's all of the information I need, but I'm still not sure what to
do next, or where to find an example of the code to modify and insert into
template.php to keep it from showing blog_usernames_blog.

 

I'm stuck, any further suggestions?

 

 

From: themes-bounces at drupal.org [mailto:themes-bounces at drupal.org] On Behalf
Of Ng Chin Kiong
Sent: Friday, April 10, 2009 2:09 AM
To: A list for theme developers
Subject: Re: [themes] targeting variables in my node-blog.tpl.php file

 

brendan,

 

You can use template preprocessor. See my latest reply on "Re: how to stop a
'view' from showing a field?"

 


Cheers,
CK Ng

forDrupal Premium Themes (http://fordrupal.com)
- we make drupal beautiful

On Fri, Apr 10, 2009 at 3:53 PM, brendan, fresh-off.com
<hello at fresh-off.com> wrote:

Hello, 

I can't seem to figure out how to effectively target two different values in
my node-blog.tpl.php file:

 

$submitted

$links

 

For the $submitted value, I'd like to insert some xhtml tags in there so
that I can target them with CSS.  

 

Currently it writes the data to the page like this:

 

---

Submitted by super_user on April 9, 2009 - 2:49pm

---

 

But I'd like to get some xhtml tags around the User and the Month.  It would
also be nice if I could delete the hour - but that's not as important.

 

For the $links value, I'd like to figure out how to remove the Author.
Currently, the $links value writes:"Author's Blog", "Read More...", and "Add
comments" to the teaser.  How do I remove just the "Authors blog" info from
the $links value?   

 

Unfortunately, I know enough PHP to get myself confused a lot, and I've been
googling and searching Drupal.org all day with no luck.  

Hopefully the nice folks on this list can help!!

 

 

brendan, fresh-off.com

Creative Direction & Consultation: Web | Print | Brand

 

http://fresh-off.com

hello at fresh-off.com

206.328.1067

seattle.usa

 

 


_______________________________________________
themes mailing list
themes at drupal.org
http://lists.drupal.org/mailman/listinfo/themes

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.drupal.org/pipermail/themes/attachments/20090413/94057f12/attachment.htm>


More information about the themes mailing list