From zhongyumin_2008 at 163.com Sat Apr 4 06:36:34 2009 From: zhongyumin_2008 at 163.com (=?gbk?B?tqy8vsG1uOg=?=) Date: Sat, 4 Apr 2009 14:36:34 +0800 (CST) Subject: [themes] drupal Message-ID: <4755202.490901238826994294.JavaMail.coremail@bj163app21.163.com> -------------- next part -------------- An HTML attachment was scrubbed... URL: From barb at karasssuite.net Wed Apr 8 18:56:10 2009 From: barb at karasssuite.net (barb) Date: Wed, 08 Apr 2009 20:56:10 +0200 Subject: [themes] tpl.php file question Message-ID: <49DCF34A.4090607@karasssuite.net> hello! maybe someone can help me with a tpl.php file bringing out converted audios. i am no php or programmer or anything, but know a few things - so much to find myself round at least. so i am running this script to convert audios (mp3 to ogg, wav to mp3 etc..) and want to print them out through node-audio.tpl.php. i can see the frame and where the files should be shown, but everything is there, except the files. you can see it here: http://okno.be/vodnik-frog i am using drupal6 with mysql and the audio module. this is my code in node-audio.tpl.php: $convertpath = '/var/www/okno.be/public/sites/default/files/audio_converted/'; $file = $node->audio; $filepath = $file->filepath; $type = explode(".", basename($filepath)); if (file_exists($filepath)) { $output .= l($type['1'], $filepath) . ' : '; } $type = 'mp3'; $filepath = $convertpath . $file->filename . '.' . $type; $downloadpath = 'sites/default/files/audio_converted/' . $file->filename . '.' . $type; if (file_exists($filepath)) { $output .= l($type, $downloadpath) . ' : '; } $type = 'ogg'; $filepath = $convertpath . $file->filename . '.' . $type; $downloadpath = 'sites/default/files/audio_converted/' . $file->filename . '.'. $type; if (file_exists($filepath)) { $output .= l($type, $downloadpath); } $output = theme('fieldset', array('#title' => 'Download:', '#children' => $output)); print $output; i would appreciate any hint or help! b# From j.sintjago at xs4all.nl Wed Apr 8 19:45:15 2009 From: j.sintjago at xs4all.nl (Joop Sint Jago) Date: Wed, 8 Apr 2009 21:45:15 +0200 Subject: [themes] tpl.php file question In-Reply-To: <49DCF34A.4090607@karasssuite.net> References: <49DCF34A.4090607@karasssuite.net> Message-ID: <001d01c9b882$8a5c8bf0$9f15a3d0$@sintjago@xs4all.nl> Looking at your source code it appears your template doesn't output any html. Check: your content type is "audio", otherwise node-audio won't work. You are working in a template-file this has a different lay-out then a normal php-scriptfile. Maybe you better post your complete node-audio.tpl.php -----Oorspronkelijk bericht----- Van: themes-bounces at drupal.org [mailto:themes-bounces at drupal.org] Namens barb Verzonden: woensdag 8 april 2009 20:56 Aan: themes at drupal.org Onderwerp: [themes] tpl.php file question hello! maybe someone can help me with a tpl.php file bringing out converted audios. i am no php or programmer or anything, but know a few things - so much to find myself round at least. so i am running this script to convert audios (mp3 to ogg, wav to mp3 etc..) and want to print them out through node-audio.tpl.php. i can see the frame and where the files should be shown, but everything is there, except the files. you can see it here: http://okno.be/vodnik-frog i am using drupal6 with mysql and the audio module. this is my code in node-audio.tpl.php: $convertpath = '/var/www/okno.be/public/sites/default/files/audio_converted/'; $file = $node->audio; $filepath = $file->filepath; $type = explode(".", basename($filepath)); if (file_exists($filepath)) { $output .= l($type['1'], $filepath) . ' : '; } $type = 'mp3'; $filepath = $convertpath . $file->filename . '.' . $type; $downloadpath = 'sites/default/files/audio_converted/' . $file->filename . '.' . $type; if (file_exists($filepath)) { $output .= l($type, $downloadpath) . ' : '; } $type = 'ogg'; $filepath = $convertpath . $file->filename . '.' . $type; $downloadpath = 'sites/default/files/audio_converted/' . $file->filename . '.'. $type; if (file_exists($filepath)) { $output .= l($type, $downloadpath); } $output = theme('fieldset', array('#title' => 'Download:', '#children' => $output)); print $output; i would appreciate any hint or help! b# _______________________________________________ themes mailing list themes at drupal.org http://lists.drupal.org/mailman/listinfo/themes From barb at karasssuite.net Wed Apr 8 19:49:09 2009 From: barb at karasssuite.net (barb) Date: Wed, 08 Apr 2009 21:49:09 +0200 Subject: [themes] tpl.php file question In-Reply-To: <001d01c9b882$8a5c8bf0$9f15a3d0$@sintjago@xs4all.nl> References: <49DCF34A.4090607@karasssuite.net> <001d01c9b882$8a5c8bf0$9f15a3d0$@sintjago@xs4all.nl> Message-ID: <49DCFFB5.30405@karasssuite.net> cau! thx for the quick reply... > Looking at your source code it appears your template doesn't output any > html. it's handled over the php... - and the 'box' is visible..... (you can check it here at this link: http://okno.be/vodnik-frog ) > Check: your content type is "audio", otherwise node-audio won't work. > You are working in a template-file this has a different lay-out then a > normal php-scriptfile. > Maybe you better post your complete node-audio.tpl.php

audio; $filepath = $file->filepath; $type = explode(".", basename($filepath)); if (file_exists($filepath)) { $output .= l($type['1'], $filepath) . ' : '; } $type = 'mp3'; $filepath = $convertpath . $file->filename . '.' . $type; $downloadpath = 'sites/default/files/audio_converted/' . $file->filename . '.' . $type; if (file_exists($filepath)) { $output .= l($type, $downloadpath) . ' : '; } $type = 'ogg'; $filepath = $convertpath . $file->filename . '.' . $type; $downloadpath = 'sites/default/files/audio_converted/' . $file->filename . '.'. $type; if (file_exists($filepath)) { $output .= l($type, $downloadpath); } $output = theme('fieldset', array('#title' => 'Download:', '#children' => $output)); print $output; //end added by bundes ?>
From j.sintjago at xs4all.nl Wed Apr 8 20:11:35 2009 From: j.sintjago at xs4all.nl (Joop Sint Jago) Date: Wed, 8 Apr 2009 22:11:35 +0200 Subject: [themes] tpl.php file question In-Reply-To: <49DCFFB5.30405@karasssuite.net> References: <49DCF34A.4090607@karasssuite.net> <001d01c9b882$8a5c8bf0$9f15a3d0$@sintjago@xs4all.nl> <49DCFFB5.30405@karasssuite.net> Message-ID: <002001c9b886$3a4c7ef0$aee57cd0$@sintjago@xs4all.nl> As far as I know drupal only passes the node object to node-tpl. You will have to process other non-related variables before trying to use them in your tpl file. Furthermore I'm not sure you can use thing like "explode" in a tpl file since it is only intended to provide the presentation of your data and not intended to build it. -----Oorspronkelijk bericht----- Van: themes-bounces at drupal.org [mailto:themes-bounces at drupal.org] Namens barb Verzonden: woensdag 8 april 2009 21:49 Aan: A list for theme developers Onderwerp: Re: [themes] tpl.php file question cau! thx for the quick reply... > Looking at your source code it appears your template doesn't output any > html. it's handled over the php... - and the 'box' is visible..... (you can check it here at this link: http://okno.be/vodnik-frog ) > Check: your content type is "audio", otherwise node-audio won't work. > You are working in a template-file this has a different lay-out then a > normal php-scriptfile. > Maybe you better post your complete node-audio.tpl.php

audio; $filepath = $file->filepath; $type = explode(".", basename($filepath)); if (file_exists($filepath)) { $output .= l($type['1'], $filepath) . ' : '; } $type = 'mp3'; $filepath = $convertpath . $file->filename . '.' . $type; $downloadpath = 'sites/default/files/audio_converted/' . $file->filename . '.' . $type; if (file_exists($filepath)) { $output .= l($type, $downloadpath) . ' : '; } $type = 'ogg'; $filepath = $convertpath . $file->filename . '.' . $type; $downloadpath = 'sites/default/files/audio_converted/' . $file->filename . '.'. $type; if (file_exists($filepath)) { $output .= l($type, $downloadpath); } $output = theme('fieldset', array('#title' => 'Download:', '#children' => $output)); print $output; //end added by bundes ?>
_______________________________________________ themes mailing list themes at drupal.org http://lists.drupal.org/mailman/listinfo/themes From cj at ceejayoz.com Wed Apr 8 20:16:33 2009 From: cj at ceejayoz.com (Chris Sternal-Johnson) Date: Wed, 8 Apr 2009 16:16:33 -0400 Subject: [themes] tpl.php file question In-Reply-To: <-1021283446686765249@unknownmsgid> References: <49DCF34A.4090607@karasssuite.net> <49DCFFB5.30405@karasssuite.net> <-1021283446686765249@unknownmsgid> Message-ID: <60079a9b0904081316s69e3743aobaa003e5276f6310@mail.gmail.com> PHP functions like explode() can be used in .tpl.php files without issues. -- Chris Sternal-Johnson cj at ceejayoz.com On Wed, Apr 8, 2009 at 4:11 PM, Joop Sint Jago wrote: > As far as I know drupal only passes the node object to node-tpl. > You will have to process other non-related variables before trying to use > them in your tpl file. > Furthermore I'm not sure you can use thing like "explode" in a tpl file > since it is only intended to provide the presentation of your data and not > intended to build it. > > > > -----Oorspronkelijk bericht----- > Van: themes-bounces at drupal.org [mailto:themes-bounces at drupal.org] Namens > barb > Verzonden: woensdag 8 april 2009 21:49 > Aan: A list for theme developers > Onderwerp: Re: [themes] tpl.php file question > > cau! > thx for the quick reply... > > > Looking at your source code it appears your template doesn't output any > > html. > > it's handled over the php... - and the 'box' is visible..... (you can > check it here at this link: http://okno.be/vodnik-frog ) > > > Check: your content type is "audio", otherwise node-audio won't work. > > You are working in a template-file this has a different lay-out then a > > normal php-scriptfile. > > Maybe you better post your complete node-audio.tpl.php > > > // $Id: node.tpl.php,v 1.4 2008/09/15 08:11:49 johnalbin Exp $ > > /** > * @file node.tpl.php > * > * Theme implementation to display a node. > * > * Available variables: > * - $title: the (sanitized) title of the node. > * - $content: Node body or teaser depending on $teaser flag. > * - $picture: The authors picture of the node output from > * theme_user_picture(). > * - $date: Formatted creation date (use $created to reformat with > * format_date()). > * - $links: Themed links like "Read more", "Add new comment", etc. output > * from theme_links(). > * - $name: Themed username of node author output from theme_user(). > * - $node_url: Direct url of the current node. > * - $terms: the themed list of taxonomy term links output from > theme_links(). > * - $submitted: themed submission information output from > * theme_node_submitted(). > * > * Other variables: > * - $node: Full node object. Contains data that may not be safe. > * - $type: Node type, i.e. story, page, blog, etc. > * - $comment_count: Number of comments attached to the node. > * - $uid: User ID of the node author. > * - $created: Time the node was published formatted in Unix timestamp. > * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in > * teaser listings. > * - $id: Position of the node. Increments each time it's output. > * > * Node status variables: > * - $teaser: Flag for the teaser state. > * - $page: Flag for the full page state. > * - $promote: Flag for front page promotion state. > * - $sticky: Flags for sticky post setting. > * - $status: Flag for published status. > * - $comment: State of comment settings for the node. > * - $readmore: Flags true if the teaser content of the node cannot hold > the > * main body content. > * - $is_front: Flags true when presented in the front page. > * - $logged_in: Flags true when the current user is a logged-in member. > * - $is_admin: Flags true when the current user is an administrator. > * > * @see template_preprocess() > * @see template_preprocess_node() > */ > ?> >
> > > > >

> >

> > > >
> > > >
> > > > > >
?>
> >
> > >
> >
> > > //added by bundes to show the converted audio downloads > $convertpath = > '/var/www/okno.be/public/sites/default/files/audio_converted/'; > $file = $node->audio; > $filepath = $file->filepath; > $type = explode(".", basename($filepath)); > > if (file_exists($filepath)) { > $output .= l($type['1'], $filepath) . ' : '; > } > $type = 'mp3'; > $filepath = $convertpath . $file->filename . '.' . $type; > $downloadpath = 'sites/default/files/audio_converted/' . > $file->filename . '.' . $type; > if (file_exists($filepath)) { > $output .= l($type, $downloadpath) . ' : '; > } > $type = 'ogg'; > $filepath = $convertpath . $file->filename . '.' . $type; > $downloadpath = 'sites/default/files/audio_converted/' . > $file->filename . '.'. $type; > if (file_exists($filepath)) { > $output .= l($type, $downloadpath); > } > $output = theme('fieldset', array('#title' => 'Download:', > '#children' => $output)); > print $output; > > //end added by bundes > > ?> > > > > >
> > _______________________________________________ > themes mailing list > themes at drupal.org > http://lists.drupal.org/mailman/listinfo/themes > > _______________________________________________ > themes mailing list > themes at drupal.org > http://lists.drupal.org/mailman/listinfo/themes > -------------- next part -------------- An HTML attachment was scrubbed... URL: From j.sintjago at xs4all.nl Wed Apr 8 20:27:33 2009 From: j.sintjago at xs4all.nl (J. Sint Jago) Date: Wed, 8 Apr 2009 22:27:33 +0200 Subject: [themes] tpl.php file question In-Reply-To: <60079a9b0904081316s69e3743aobaa003e5276f6310@mail.gmail.com> References: <49DCF34A.4090607@karasssuite.net> <49DCFFB5.30405@karasssuite.net><-1021283446686765249@unknownmsgid> <60079a9b0904081316s69e3743aobaa003e5276f6310@mail.gmail.com> Message-ID: OK, thanks _____ Van: themes-bounces at drupal.org [mailto:themes-bounces at drupal.org] Namens Chris Sternal-Johnson Verzonden: woensdag 8 april 2009 22:17 Aan: A list for theme developers Onderwerp: Re: [themes] tpl.php file question PHP functions like explode() can be used in .tpl.php files without issues. -- Chris Sternal-Johnson cj at ceejayoz.com On Wed, Apr 8, 2009 at 4:11 PM, Joop Sint Jago wrote: As far as I know drupal only passes the node object to node-tpl. You will have to process other non-related variables before trying to use them in your tpl file. Furthermore I'm not sure you can use thing like "explode" in a tpl file since it is only intended to provide the presentation of your data and not intended to build it. -----Oorspronkelijk bericht----- Van: themes-bounces at drupal.org [mailto:themes-bounces at drupal.org] Namens barb Verzonden: woensdag 8 april 2009 21:49 Aan: A list for theme developers Onderwerp: Re: [themes] tpl.php file question cau! thx for the quick reply... > Looking at your source code it appears your template doesn't output any > html. it's handled over the php... - and the 'box' is visible..... (you can check it here at this link: http://okno.be/vodnik-frog ) > Check: your content type is "audio", otherwise node-audio won't work. > You are working in a template-file this has a different lay-out then a > normal php-scriptfile. > Maybe you better post your complete node-audio.tpl.php

audio; $filepath = $file->filepath; $type = explode(".", basename($filepath)); if (file_exists($filepath)) { $output .= l($type['1'], $filepath) . ' : '; } $type = 'mp3'; $filepath = $convertpath . $file->filename . '.' . $type; $downloadpath = 'sites/default/files/audio_converted/' . $file->filename . '.' . $type; if (file_exists($filepath)) { $output .= l($type, $downloadpath) . ' : '; } $type = 'ogg'; $filepath = $convertpath . $file->filename . '.' . $type; $downloadpath = 'sites/default/files/audio_converted/' . $file->filename . '.'. $type; if (file_exists($filepath)) { $output .= l($type, $downloadpath); } $output = theme('fieldset', array('#title' => 'Download:', '#children' => $output)); print $output; //end added by bundes ?>
_______________________________________________ themes mailing list themes at drupal.org http://lists.drupal.org/mailman/listinfo/themes _______________________________________________ themes mailing list themes at drupal.org http://lists.drupal.org/mailman/listinfo/themes -------------- next part -------------- An HTML attachment was scrubbed... URL: From inforazor at gmail.com Thu Apr 9 00:56:46 2009 From: inforazor at gmail.com (sebastian) Date: Wed, 08 Apr 2009 17:56:46 -0700 Subject: [themes] how to stop a 'view' from showing a field? Message-ID: <49DD47CE.9070008@gmail.com> Hello listers, Hope this is the right place to ask this question. I am building a theme and I have little icons that I want to have appearing when there is a 'File - CCK' field present. The field is optional in the content-type. I have created a view for the page that shows the content, and when the file-cck field is empty, it still shows all the surrounding
and tags, which triggers my CSS and then I still show the little custom PDF icon; only I want it to be blank. When I click on the View for the field: file-cck (generic files) I only see the options: - Exclude from display - Rewrite output field - Output this field as a link - Trim to max length - Link this to its node - Label [none/drop down] - Format [generic files] I can't see from this list any way to have it be conditional; ie: only display Field formatting [Div+a href] if there is actually any data present. Thanks for your help, hopefully this is an easy one. :) Kind, From nevets at tds.net Thu Apr 9 01:07:20 2009 From: nevets at tds.net (Steve Ringwood) Date: Wed, 08 Apr 2009 20:07:20 -0500 Subject: [themes] how to stop a 'view' from showing a field? In-Reply-To: <49DD47CE.9070008@gmail.com> References: <49DD47CE.9070008@gmail.com> Message-ID: <49DD4A48.3090907@mailbag.com> If this is for views 2 you can provide a template file that over rides the theming for that field, click "information" (next to "Theme" in "Basic settings" column) for the file name(s) you can use. From web at rootwork.org Thu Apr 9 01:07:44 2009 From: web at rootwork.org (Ivan Boothe) Date: Wed, 8 Apr 2009 21:07:44 -0400 Subject: [themes] how to stop a 'view' from showing a field? In-Reply-To: <49DD47CE.9070008@gmail.com> References: <49DD47CE.9070008@gmail.com> Message-ID: Sebastian, You'll probably need to do this through views template. Here's the handbook page on this theming: http://drupal.org/node/352970 Basically you'll want to target that field with a template and put in conditional code or otherwise change the tags surrounding the field output. (If you have any questions after reading the handbook page let me know, as I wrote a lot of what is there and I'm looking for ways to improve anything that's unclear.) --ivan -- Rootwork: Powering grassroots networks from the bottom up ivan at rootwork.org http://www.rootwork.org phone: 202.730.9465 Skype: rootwork Twitter: rootwork On Apr 8, 2009, at 8:56 PM, sebastian wrote: > Hello listers, > > Hope this is the right place to ask this question. > > I am building a theme and I have little icons that I want to have > appearing when there is a 'File - CCK' field present. > > The field is optional in the content-type. I have created a view for > the page that shows the content, and when the file-cck field is > empty, it still shows all the surrounding
and tags, > which triggers my CSS and then I still show the little custom PDF > icon; only I want it to be blank. > > When I click on the View for the field: file-cck (generic files) > > I only see the options: > > - Exclude from display > - Rewrite output field > - Output this field as a link > - Trim to max length > - Link this to its node > - Label [none/drop down] > - Format [generic files] > > I can't see from this list any way to have it be conditional; ie: > only display Field formatting [Div+a href] if there is actually any > data present. > > Thanks for your help, hopefully this is an easy one. > :) > > Kind, > _______________________________________________ > themes mailing list > themes at drupal.org > http://lists.drupal.org/mailman/listinfo/themes From inforazor at gmail.com Thu Apr 9 02:20:31 2009 From: inforazor at gmail.com (sebastian) Date: Wed, 08 Apr 2009 19:20:31 -0700 Subject: [themes] how to stop a 'view' from showing a field? In-Reply-To: <49DD4A48.3090907@mailbag.com> References: <49DD47CE.9070008@gmail.com> <49DD4A48.3090907@mailbag.com> Message-ID: <49DD5B6F.7090709@gmail.com> Thank you Steve, I've looked into the theming of the fields, and I have copied a new: "view-view-fields.tpl.php" file to my theme folder. I can get it to react, but I am lacking some basic PHP wisdom. I want to make a conditional statement, so that if the "title" property of the field is empty, don't display anything. My problem is I can't see how to access the title. This is definitely wrong [line 2 is the important one], but here is how I am trying it: class == "field-pdf-fid" ): ?> title != "" ): ?> <inline_html;?> class="views-field-class; ?>"> label): ?> element_type is either SPAN or DIV depending upon whether or not // the field is a 'block' element type or 'inline' element type. ?> <element_type; ?> class="field-content">content; ?>element_type; ?>> inline_html;?>> Thanks a bunch Steve! p.s. I can't see how to combine && and || conditionals or 'else' statements in PHP code written like this without throwing a huge error. I'm used to seeing PHP code written more as a flow without constant breaks... anyways, not critical for now as I can work around it, but it is bugging me. Also, isn't the "->" an assignment operation? It's use here baffles me... Yes: I'm a wee green newbie php person, sigh. Kind, Sebastian. Steve Ringwood wrote: > If this is for views 2 you can provide a template file that over rides > the theming for that field, click "information" (next to "Theme" in > "Basic settings" column) for the file name(s) you can use. > _______________________________________________ > themes mailing list > themes at drupal.org > http://lists.drupal.org/mailman/listinfo/themes > From inforazor at gmail.com Thu Apr 9 04:23:22 2009 From: inforazor at gmail.com (sebastian) Date: Wed, 08 Apr 2009 21:23:22 -0700 Subject: [themes] how to stop a 'view' from showing a field? In-Reply-To: References: <49DD47CE.9070008@gmail.com> Message-ID: <49DD783A.7070007@gmail.com> Hi Ivan, Thanks for the link, I've been trussing about for a few hours, but I can't get anything meaningful to output. I added: ' . htmlentities(print_r($rows, 1)) . ''; ?> To the views-view.tpl.php and got this output: Array ( [0] => template_file [1] => variables [2] => template_files [3] => view [4] => zebra [5] => id [6] => directory [7] => is_admin [8] => is_front [9] => logged_in [10] => db_is_active [11] => user [12] => rows [13] => css_name [14] => name [15] => display_id [16] => empty [17] => exposed [18] => header [19] => footer [20] => more [21] => feed_icon [22] => attachment_before [23] => attachment_after [24] => pager [25] => admin_links_raw [26] => admin_links [27] => dom_id ) Which doesn't really help me [i think], unless I am expected to dig into each level from here?? If I look at the comments in the Views->theme->information->views-view.tpl.php I see no change to the comments written there, though I do see the above Array stuff re-printed to the comments area. If I put the above code instead into: views-view-fields.tpl.php Then I get no output change when I run the page [strage?] and if i look at Views->theme->information->views-view-fields.tpl.php or at views-view.tpl.php I see no change to the comments at the top, nor any output at the bottom [ie no change at all] Am I putting it in the wrong file? If I try add be 'smart' and add: ' . htmlentities(print_r($fields, 1)) . ''; ?> To the bottom of the: views-view-fields.tpl.php file, I break the page... [get a 100% "white" page] Sigh, Still trying to figure out how I can simply identify variables... :P Thanks! Sebastian. Ivan Boothe wrote: > Sebastian, > > You'll probably need to do this through views template. Here's the > handbook page on this theming: > > http://drupal.org/node/352970 > > Basically you'll want to target that field with a template and put in > conditional code or otherwise change the tags surrounding the field output. > > (If you have any questions after reading the handbook page let me know, > as I wrote a lot of what is there and I'm looking for ways to improve > anything that's unclear.) > > --ivan > > > -- > Rootwork: Powering grassroots > networks from the bottom up > > ivan at rootwork.org > http://www.rootwork.org > phone: 202.730.9465 > > Skype: rootwork > Twitter: rootwork > > > > On Apr 8, 2009, at 8:56 PM, sebastian wrote: > >> Hello listers, >> >> Hope this is the right place to ask this question. >> >> I am building a theme and I have little icons that I want to have >> appearing when there is a 'File - CCK' field present. >> >> The field is optional in the content-type. I have created a view for >> the page that shows the content, and when the file-cck field is empty, >> it still shows all the surrounding
and tags, which >> triggers my CSS and then I still show the little custom PDF icon; only >> I want it to be blank. >> >> When I click on the View for the field: file-cck (generic files) >> >> I only see the options: >> >> - Exclude from display >> - Rewrite output field >> - Output this field as a link >> - Trim to max length >> - Link this to its node >> - Label [none/drop down] >> - Format [generic files] >> >> I can't see from this list any way to have it be conditional; ie: only >> display Field formatting [Div+a href] if there is actually any data >> present. >> >> Thanks for your help, hopefully this is an easy one. >> :) >> >> Kind, >> _______________________________________________ >> themes mailing list >> themes at drupal.org >> http://lists.drupal.org/mailman/listinfo/themes > > _______________________________________________ > themes mailing list > themes at drupal.org > http://lists.drupal.org/mailman/listinfo/themes > From barb at karasssuite.net Thu Apr 9 15:31:01 2009 From: barb at karasssuite.net (barb) Date: Thu, 09 Apr 2009 17:31:01 +0200 Subject: [themes] tpl.php file question In-Reply-To: <002001c9b886$3a4c7ef0$aee57cd0$@sintjago@xs4all.nl> References: <49DCF34A.4090607@karasssuite.net> <001d01c9b882$8a5c8bf0$9f15a3d0$@sintjago@xs4all.nl> <49DCFFB5.30405@karasssuite.net> <002001c9b886$3a4c7ef0$aee57cd0$@sintjago@xs4all.nl> Message-ID: <49DE14B5.90701@karasssuite.net> > As far as I know drupal only passes the node object to node-tpl. > You will have to process other non-related variables before trying to use > them in your tpl file. mhm - i thought so already, but wasnt't sure. so if i see this right, i have to preprocess the variables in the template.php in order to make new variables available for the node script? i am doing this for the first time and have hardly any experience in php - so i am really puzzled about making new variables available thru template.php. any help would be appreciated or a link to a good manual? (or do i have to learn php from scratch ;) i've checked out quite some manuals but i don't really understand the processing.... thx b# From j.sintjago at xs4all.nl Thu Apr 9 18:18:45 2009 From: j.sintjago at xs4all.nl (J. Sint Jago) Date: Thu, 9 Apr 2009 20:18:45 +0200 Subject: [themes] tpl.php file question In-Reply-To: <49DE14B5.90701@karasssuite.net> References: <49DCF34A.4090607@karasssuite.net> <001d01c9b882$8a5c8bf0$9f15a3d0$@sintjago@xs4all.nl> <49DCFFB5.30405@karasssuite.net><002001c9b886$3a4c7ef0$aee57cd0$@sintjago@xs4all.nl> <49DE14B5.90701@karasssuite.net> Message-ID: In Pro Drupal Development this process is explained in detail. Maybe it is hard to grasp because you have to understand the Theme Registry. A sidestep: Assuming node-audio is a CCk-node, did you consider using CCk-computed field.? -----Oorspronkelijk bericht----- Van: themes-bounces at drupal.org [mailto:themes-bounces at drupal.org] Namens barb Verzonden: donderdag 9 april 2009 17:31 Aan: A list for theme developers Onderwerp: Re: [themes] tpl.php file question > As far as I know drupal only passes the node object to node-tpl. > You will have to process other non-related variables before trying to use > them in your tpl file. mhm - i thought so already, but wasnt't sure. so if i see this right, i have to preprocess the variables in the template.php in order to make new variables available for the node script? i am doing this for the first time and have hardly any experience in php - so i am really puzzled about making new variables available thru template.php. any help would be appreciated or a link to a good manual? (or do i have to learn php from scratch ;) i've checked out quite some manuals but i don't really understand the processing.... thx b# _______________________________________________ themes mailing list themes at drupal.org http://lists.drupal.org/mailman/listinfo/themes From inforazor at gmail.com Thu Apr 9 20:06:14 2009 From: inforazor at gmail.com (sebastian) Date: Thu, 09 Apr 2009 13:06:14 -0700 Subject: [themes] displaying a 'View' of a specific content type node? Message-ID: <49DE5536.3060809@gmail.com> Hello, this is a simple question I believe. I've taken a pause from trying to figure out how to get variable name outputs and instead I am focusing on a more feature I'd like to get working. I'm struggling with finding good documentation, and the drupal.org documentation seems very fragmented -- maybe it's just me, but I can't seem to find out what the best approach is for the following: I have a view set up which displays nodes of a certain taxonomy. I have customized which fields are present and themed them all just fine. Now I want to have it so that if a user clicks the attached image, or the title of the node [or a link in the body of the content] that the user goes to a new page that displays another view of JUST this one node. Preferably I'd like to have control over the view of the single-node view, just like I have control over the taxonomy-filtered view I have already made. Since I need to turn on 'link image to node' and 'link title to node', this makes Drupal open the node's page, example: ?q=node/27 So how can I redirect or capture this 'click' and have the user see a view of JUST node 27 when they click a title, formatted and displaying only the fields I declare in a view? I am aware that there are tpl.php files for nodes and node-types; but I'm not sure that this is the right way to go...? So, my question is one of approach: how would I go about doing this? capturing from the view, or by patching up a tpl.php file? Please remember I am a total Drupal 6 newbie... so please don't assume I know much... This is my first website in drupal; I'm quite good at CSS, and an expert in (object orientated) Actionscript/Flash; but a total newbie in PHP and Drupal. So thank you in advance for your patience and assistance! Kind, Sebastian. From justin.gruenberg at gmail.com Thu Apr 9 21:10:23 2009 From: justin.gruenberg at gmail.com (Justin Gruenberg) Date: Thu, 9 Apr 2009 16:10:23 -0500 Subject: [themes] displaying a 'View' of a specific content type node? In-Reply-To: <49DE5536.3060809@gmail.com> References: <49DE5536.3060809@gmail.com> Message-ID: <96cd751f0904091410w3f2b4561icd439af9bf39430d@mail.gmail.com> On Thu, Apr 9, 2009 at 3:06 PM, sebastian wrote: > > I am aware that there are tpl.php files for nodes and node-types; but I'm > not sure that this is the right way to go...? For changing the appearance of single node or type of node you want to edit the template files. You'd probably want to edit node-[your content type].tpl.php or if you only want to style a single node, you can do node-[nid].tpl.php. I haven't fiddled with theming D6, but you might have to clear your theme cache. From bchoc at t4tcolorado.org Thu Apr 9 23:02:13 2009 From: bchoc at t4tcolorado.org (Brian Choc) Date: Thu, 9 Apr 2009 17:02:13 -0600 Subject: [themes] displaying a 'View' of a specific content type node? In-Reply-To: <96cd751f0904091410w3f2b4561icd439af9bf39430d@mail.gmail.com> References: <49DE5536.3060809@gmail.com> <96cd751f0904091410w3f2b4561icd439af9bf39430d@mail.gmail.com> Message-ID: <507b282e0904091602p1f273dbdwe113297fdd368345@mail.gmail.com> I agree, theming the node probably makes more sense than showing a View of one page and theming the View (related content might be a reason to want to do this, though). If you do want to have a View of just one node, you could use the Arguments option to pass the NID to your view and have it just show that one node. Brian On Thu, Apr 9, 2009 at 3:10 PM, Justin Gruenberg wrote: > On Thu, Apr 9, 2009 at 3:06 PM, sebastian wrote: > > > > I am aware that there are tpl.php files for nodes and node-types; but I'm > > not sure that this is the right way to go...? > > For changing the appearance of single node or type of node you want to > edit the template files. You'd probably want to edit node-[your > content type].tpl.php or if you only want to style a single node, you > can do node-[nid].tpl.php. > > I haven't fiddled with theming D6, but you might have to clear your theme > cache. > _______________________________________________ > themes mailing list > themes at drupal.org > http://lists.drupal.org/mailman/listinfo/themes > -------------- next part -------------- An HTML attachment was scrubbed... URL: From inforazor at gmail.com Fri Apr 10 04:32:14 2009 From: inforazor at gmail.com (sebastian) Date: Thu, 09 Apr 2009 21:32:14 -0700 Subject: [themes] displaying a 'View' of a specific content type node? In-Reply-To: <507b282e0904091602p1f273dbdwe113297fdd368345@mail.gmail.com> References: <49DE5536.3060809@gmail.com> <96cd751f0904091410w3f2b4561icd439af9bf39430d@mail.gmail.com> <507b282e0904091602p1f273dbdwe113297fdd368345@mail.gmail.com> Message-ID: <49DECBCE.3090100@gmail.com> Hello Brian [others] thank you so much for your input, and pointing me the way of arguments. If I were to go down the Views' path, how would I do this? If a user clicks the title, they get sent to the Node, not to a View; how can I make it so that the user sees the View, with the correct NID, instead of the Node's default [non-Views] page? Am I forced to hand-code the title/image links to something other than the default [links to Node NID]? If so, how would I do that? I'd like to figure that out even if I do end up theming the node tpl instead, Thanks for any insight you or anyone might be able to offer, Cheers, Sebastian. Brian Choc wrote: > I agree, theming the node probably makes more sense than showing a View > of one page and theming the View (related content might be a reason to > want to do this, though). > > If you do want to have a View of just one node, you could use the > Arguments option to pass the NID to your view and have it just show that > one node. > > Brian > > > > > On Thu, Apr 9, 2009 at 3:10 PM, Justin Gruenberg > > wrote: > > On Thu, Apr 9, 2009 at 3:06 PM, sebastian > wrote: > > > > I am aware that there are tpl.php files for nodes and node-types; > but I'm > > not sure that this is the right way to go...? > > For changing the appearance of single node or type of node you want to > edit the template files. You'd probably want to edit node-[your > content type].tpl.php or if you only want to style a single node, you > can do node-[nid].tpl.php. > > I haven't fiddled with theming D6, but you might have to clear your > theme cache. > _______________________________________________ > themes mailing list > themes at drupal.org > http://lists.drupal.org/mailman/listinfo/themes > > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > themes mailing list > themes at drupal.org > http://lists.drupal.org/mailman/listinfo/themes From ckng at fordrupal.com Fri Apr 10 05:24:54 2009 From: ckng at fordrupal.com (Ng Chin Kiong) Date: Fri, 10 Apr 2009 13:24:54 +0800 Subject: [themes] how to stop a 'view' from showing a field? In-Reply-To: <346d496f0904092203g261a0eb4ra48c31759e279e9a@mail.gmail.com> References: <346d496f0904092203g261a0eb4ra48c31759e279e9a@mail.gmail.com> Message-ID: <346d496f0904092224q2d0051d0rfca4d68a134e442@mail.gmail.com> sebastian, Actually don't need to touch view or view template. The more 'natural' way is to check it under phptemplate_preprocess_node, if the field's content does not exist, add an additional CSS class to the node (says 'no-field-A'). This way you theme the node + the view or other ways that you retrieve a node. In your CSS, just theme .no-field-A .field-A { display: none; } Cheers, CK Ng forDrupal Premium Themes (http://fordrupal.com) - we make drupal beautiful On Fri, Apr 10, 2009 at 2:19 AM, wrote: > > > Message: 1 > Date: Wed, 08 Apr 2009 17:56:46 -0700 > From: sebastian > Subject: [themes] how to stop a 'view' from showing a field? > To: themes at drupal.org > Message-ID: <49DD47CE.9070008 at gmail.com> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Hello listers, > > Hope this is the right place to ask this question. > > I am building a theme and I have little icons that I want to have > appearing when there is a 'File - CCK' field present. > > The field is optional in the content-type. I have created a view for the > page that shows the content, and when the file-cck field is empty, it > still shows all the surrounding
and tags, which triggers > my CSS and then I still show the little custom PDF icon; only I want it > to be blank. > > When I click on the View for the field: file-cck (generic files) > > I only see the options: > > - Exclude from display > - Rewrite output field > - Output this field as a link > - Trim to max length > - Link this to its node > - Label [none/drop down] > - Format [generic files] > > I can't see from this list any way to have it be conditional; ie: only > display Field formatting [Div+a href] if there is actually any data > present. > > Thanks for your help, hopefully this is an easy one. > :) > > Kind, > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From inforazor at gmail.com Fri Apr 10 06:53:37 2009 From: inforazor at gmail.com (sebastian) Date: Thu, 09 Apr 2009 23:53:37 -0700 Subject: [themes] how to stop a 'view' from showing a field? In-Reply-To: <346d496f0904092224q2d0051d0rfca4d68a134e442@mail.gmail.com> References: <346d496f0904092203g261a0eb4ra48c31759e279e9a@mail.gmail.com> <346d496f0904092224q2d0051d0rfca4d68a134e442@mail.gmail.com> Message-ID: <49DEECF1.3000506@gmail.com> Sigh, I'm a fairly smart person, at least, I thought I was... but the more I try and figure out things in Drupal, the more lost I become. My site is 90%+ done, but these last ordeals are really painful to unravel... Where is the phptemplate_preprocess_node? I've been looking everywhere to find this, is it a field in the admin tool? or: A *.tpl.php file I am supposed to make from scratch? ie: http://drupal.org/node/223430 If its the later, I have no idea what is going on with all these 10 preprocessors... are there examples of these files? Thanks, Sebastian. Ng Chin Kiong wrote: > sebastian, > > Actually don't need to touch view or view template. The more 'natural' > way is to check it under phptemplate_preprocess_node, if the field's > content does not exist, add an additional CSS class to the node (says > 'no-field-A'). This way you theme the node + the view or other ways that > you retrieve a node. > > In your CSS, just theme > .no-field-A .field-A { > display: none; > } > > > Cheers, > CK Ng > > forDrupal Premium Themes (http://fordrupal.com) > - we make drupal beautiful > > > On Fri, Apr 10, 2009 at 2:19 AM, > wrote: > > > > Message: 1 > Date: Wed, 08 Apr 2009 17:56:46 -0700 > From: sebastian > > Subject: [themes] how to stop a 'view' from showing a field? > To: themes at drupal.org > Message-ID: <49DD47CE.9070008 at gmail.com > > > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Hello listers, > > Hope this is the right place to ask this question. > > I am building a theme and I have little icons that I want to have > appearing when there is a 'File - CCK' field present. > > The field is optional in the content-type. I have created a view for the > page that shows the content, and when the file-cck field is empty, it > still shows all the surrounding
and tags, which triggers > my CSS and then I still show the little custom PDF icon; only I want it > to be blank. > > When I click on the View for the field: file-cck (generic files) > > I only see the options: > > - Exclude from display > - Rewrite output field > - Output this field as a link > - Trim to max length > - Link this to its node > - Label [none/drop down] > - Format [generic files] > > I can't see from this list any way to have it be conditional; ie: only > display Field formatting [Div+a href] if there is actually any data > present. > > Thanks for your help, hopefully this is an easy one. > :) > > Kind, > > > > ------------------------------------------------------------------------ > > _______________________________________________ > themes mailing list > themes at drupal.org > http://lists.drupal.org/mailman/listinfo/themes From justin.gruenberg at gmail.com Fri Apr 10 07:09:51 2009 From: justin.gruenberg at gmail.com (Justin Gruenberg) Date: Fri, 10 Apr 2009 02:09:51 -0500 Subject: [themes] displaying a 'View' of a specific content type node? In-Reply-To: <49DECBCE.3090100@gmail.com> References: <49DE5536.3060809@gmail.com> <96cd751f0904091410w3f2b4561icd439af9bf39430d@mail.gmail.com> <507b282e0904091602p1f273dbdwe113297fdd368345@mail.gmail.com> <49DECBCE.3090100@gmail.com> Message-ID: <96cd751f0904100009s333f3ae8n5ab0be782ec46c12@mail.gmail.com> On Thu, Apr 9, 2009 at 11:32 PM, sebastian wrote: > If I were to go down the Views' path, how would I do this? If a user clicks > the title, they get sent to the Node, not to a View; how can I make it so > that the user sees the View, with the correct NID, instead of the Node's > default [non-Views] page? Am I forced to hand-code the title/image links to > something other than the default [links to Node NID]? If so, how would I do > that? > > I'd like to figure that out even if I do end up theming the node tpl > instead, If you were to use views to do this you'd need to set up an entirely new view. You would need to use arguments from the URL to specify what node you want to display (probably the node id). You would have to build a link to this view in your taxonomy view. You would then be able to theme your new view . . . and you'd be exactly where you're at right now if you just theme the node page. Unless I'm misunderstanding your question, doing this in views would just reimplement what drupal already does. Your best bet is to make a node template. You can use the existing node.tpl.php as an example. Also, if you look at the api docs ( http://api.drupal.org/api/file/modules/node/node.tpl.php/6 ) you can see all the variables that will be in scope. I'd also suggest using the Devel module ( http://drupal.org/project/devel ) which is like FireBug for drupal and it'll show you what files to create/modify to theme just about anything in drupal. From hello at fresh-off.com Fri Apr 10 07:53:06 2009 From: hello at fresh-off.com (brendan, fresh-off.com) Date: Fri, 10 Apr 2009 00:53:06 -0700 Subject: [themes] targeting variables in my node-blog.tpl.php file In-Reply-To: <49DCF34A.4090607@karasssuite.net> References: <49DCF34A.4090607@karasssuite.net> Message-ID: <000601c9b9b1$6350a7f0$29f1f7d0$@com> 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From j.sintjago at xs4all.nl Fri Apr 10 08:45:37 2009 From: j.sintjago at xs4all.nl (J. Sint Jago) Date: Fri, 10 Apr 2009 10:45:37 +0200 Subject: [themes] targeting variables in my node-blog.tpl.php file In-Reply-To: <000601c9b9b1$6350a7f0$29f1f7d0$@com> References: <49DCF34A.4090607@karasssuite.net> <000601c9b9b1$6350a7f0$29f1f7d0$@com> Message-ID: <0DA8C384771540D7B6E36F5F32380778@joopdesktop> You have to override the theme function in your template.php file. I think you can not target it directly in node-blog.tpl.php Copy the original function to your theme and rename it: themename_node_submitted() and make the changes you want. If you install dev module you can see on your page which theme_functions are responsible for the theming of the particular items such as $links etc. _____ Van: themes-bounces at drupal.org [mailto:themes-bounces at drupal.org] Namens brendan, fresh-off.com Verzonden: vrijdag 10 april 2009 9:53 Aan: 'A list for theme developers' Onderwerp: [themes] targeting variables in my node-blog.tpl.php file 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ckng at fordrupal.com Fri Apr 10 09:04:18 2009 From: ckng at fordrupal.com (Ng Chin Kiong) Date: Fri, 10 Apr 2009 17:04:18 +0800 Subject: [themes] how to stop a 'view' from showing a field? In-Reply-To: <49DEECF1.3000506@gmail.com> References: <346d496f0904092203g261a0eb4ra48c31759e279e9a@mail.gmail.com> <346d496f0904092224q2d0051d0rfca4d68a134e442@mail.gmail.com> <49DEECF1.3000506@gmail.com> Message-ID: <346d496f0904100204q1fa8986n4c5cae70f39c9149@mail.gmail.com> Sebastian , You may get better response in support forum. phptemplate_preprocess_node() should go inside your template.php Google and Drupal handbook is your friends =) http://drupal.org/node/223430 http://drupal.org/node/337022 /* this goes into template.php */ function phptemplate_preprocess_node(&$vars, $hook) { $node_classes = array(); // may need to check content of $vars['node']->field_MYFIELD? if ($vars['node']->type == "YOUR_CONTENT_TYPE" && $vars['node']->field_MYFIELD) { $node_classes[] = 'node-no-MYFEILD'; } $node_classes = array_filter($node_classes); $vars['node_classes'] = implode(' ', $node_classes); } /* this goes in your node.tpl.php */
Cheers, CK Ng forDrupal Premium Themes (http://fordrupal.com) - we make drupal beautiful On Fri, Apr 10, 2009 at 2:53 PM, sebastian wrote: > Sigh, I'm a fairly smart person, at least, I thought I was... but the more > I try and figure out things in Drupal, the more lost I become. My site is > 90%+ done, but these last ordeals are really painful to unravel... > > Where is the phptemplate_preprocess_node? > > I've been looking everywhere to find this, is it a field in the admin tool? > > or: A *.tpl.php file I am supposed to make from scratch? > ie: http://drupal.org/node/223430 > > If its the later, I have no idea what is going on with all these 10 > preprocessors... are there examples of these files? > > Thanks, > > Sebastian. > > Ng Chin Kiong wrote: > >> sebastian, >> >> Actually don't need to touch view or view template. The more 'natural' way >> is to check it under phptemplate_preprocess_node, if the field's content >> does not exist, add an additional CSS class to the node (says 'no-field-A'). >> This way you theme the node + the view or other ways that you retrieve a >> node. >> >> In your CSS, just theme >> .no-field-A .field-A { >> display: none; >> } >> >> >> Cheers, >> CK Ng >> >> forDrupal Premium Themes (http://fordrupal.com) >> - we make drupal beautiful >> >> >> On Fri, Apr 10, 2009 at 2:19 AM, > themes-request at drupal.org>> wrote: >> >> >> >> Message: 1 >> Date: Wed, 08 Apr 2009 17:56:46 -0700 >> From: sebastian > >> Subject: [themes] how to stop a 'view' from showing a field? >> To: themes at drupal.org >> Message-ID: <49DD47CE.9070008 at gmail.com >> > >> Content-Type: text/plain; charset=ISO-8859-1; format=flowed >> >> Hello listers, >> >> Hope this is the right place to ask this question. >> >> I am building a theme and I have little icons that I want to have >> appearing when there is a 'File - CCK' field present. >> >> The field is optional in the content-type. I have created a view for >> the >> page that shows the content, and when the file-cck field is empty, it >> still shows all the surrounding
and tags, which triggers >> my CSS and then I still show the little custom PDF icon; only I want it >> to be blank. >> >> When I click on the View for the field: file-cck (generic files) >> >> I only see the options: >> >> - Exclude from display >> - Rewrite output field >> - Output this field as a link >> - Trim to max length >> - Link this to its node >> - Label [none/drop down] >> - Format [generic files] >> >> I can't see from this list any way to have it be conditional; ie: only >> display Field formatting [Div+a href] if there is actually any data >> present. >> >> Thanks for your help, hopefully this is an easy one. >> :) >> >> Kind, >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> themes mailing list >> themes at drupal.org >> http://lists.drupal.org/mailman/listinfo/themes >> > _______________________________________________ > themes mailing list > themes at drupal.org > http://lists.drupal.org/mailman/listinfo/themes > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ckng at fordrupal.com Fri Apr 10 09:08:50 2009 From: ckng at fordrupal.com (Ng Chin Kiong) Date: Fri, 10 Apr 2009 17:08:50 +0800 Subject: [themes] targeting variables in my node-blog.tpl.php file In-Reply-To: <000601c9b9b1$6350a7f0$29f1f7d0$@com> References: <49DCF34A.4090607@karasssuite.net> <000601c9b9b1$6350a7f0$29f1f7d0$@com> Message-ID: <346d496f0904100208s54704521k80475a949d12537@mail.gmail.com> 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 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: From inforazor at gmail.com Fri Apr 10 17:58:56 2009 From: inforazor at gmail.com (sebastian) Date: Fri, 10 Apr 2009 10:58:56 -0700 Subject: [themes] displaying a 'View' of a specific content type node? In-Reply-To: <96cd751f0904100009s333f3ae8n5ab0be782ec46c12@mail.gmail.com> References: <49DE5536.3060809@gmail.com> <96cd751f0904091410w3f2b4561icd439af9bf39430d@mail.gmail.com> <507b282e0904091602p1f273dbdwe113297fdd368345@mail.gmail.com> <49DECBCE.3090100@gmail.com> <96cd751f0904100009s333f3ae8n5ab0be782ec46c12@mail.gmail.com> Message-ID: <49DF88E0.5040507@gmail.com> Wow, the Devel module is excellent! Thanks!!! Phew, finally feeling like I am able to make progress now! Not solved but now I am finally able to move forward again. :D I am heeding your advice on making a node-product_module.tpl.php file, and this is now going in the right direction [now that I finally could see where the node.tpl.php file that was being used was!!] Thank you!! Sebastian. Justin Gruenberg wrote: > On Thu, Apr 9, 2009 at 11:32 PM, sebastian wrote: >> If I were to go down the Views' path, how would I do this? If a user clicks >> the title, they get sent to the Node, not to a View; how can I make it so >> that the user sees the View, with the correct NID, instead of the Node's >> default [non-Views] page? Am I forced to hand-code the title/image links to >> something other than the default [links to Node NID]? If so, how would I do >> that? >> >> I'd like to figure that out even if I do end up theming the node tpl >> instead, > > If you were to use views to do this you'd need to set up an entirely > new view. You would need to use arguments from the URL to specify > what node you want to display (probably the node id). You would have > to build a link to this view in your taxonomy view. You would then be > able to theme your new view . . . and you'd be exactly where you're at > right now if you just theme the node page. > > Unless I'm misunderstanding your question, doing this in views would > just reimplement what drupal already does. > > Your best bet is to make a node template. You can use the existing > node.tpl.php as an example. Also, if you look at the api docs ( > http://api.drupal.org/api/file/modules/node/node.tpl.php/6 ) you can > see all the variables that will be in scope. I'd also suggest using > the Devel module ( http://drupal.org/project/devel ) which is like > FireBug for drupal and it'll show you what files to create/modify to > theme just about anything in drupal. > _______________________________________________ > themes mailing list > themes at drupal.org > http://lists.drupal.org/mailman/listinfo/themes > From inforazor at gmail.com Fri Apr 10 19:12:04 2009 From: inforazor at gmail.com (sebastian) Date: Fri, 10 Apr 2009 12:12:04 -0700 Subject: [themes] displaying a 'View' of a specific content type node? In-Reply-To: <49DF88E0.5040507@gmail.com> References: <49DE5536.3060809@gmail.com> <96cd751f0904091410w3f2b4561icd439af9bf39430d@mail.gmail.com> <507b282e0904091602p1f273dbdwe113297fdd368345@mail.gmail.com> <49DECBCE.3090100@gmail.com> <96cd751f0904100009s333f3ae8n5ab0be782ec46c12@mail.gmail.com> <49DF88E0.5040507@gmail.com> Message-ID: <49DF9A04.70109@gmail.com> As a follow up to the wonders of Devel, I've identified a function called: theme_text_formatter_plain() Which devel could not tell me where it was located... :( After some hunting on google, I found that it was in: /cck/modules/text/text.module Is it also possible to override the PHP code in a module? When I try and do so by using: mythemename_text_formatter_plain() in the mythemename/template.php file, nothing happens... [ie it still runs the text.module code's version of the function] taking a step back, what I am trying to do should be very simple... I have a cck/text field, i have fckeditor installed. I want the webadmin to be able to insert HTML like content into it, and have it displayed as HTML. Unfortunately the text field's properties [under content-type, edit, display fields, manage] do not offer HTML output, I only see: * Plain text * Filtered text If I select Filtered text, I get an error on the content-creation page for the content type in question. If I select plain text, it converts all of the html to its HTML-safe escape characters... If I click 'display fields' sub tab in the content-type's sub edit pages, I see in the drop down: 'default', 'plain text' and 'hidden'. default and plain result in no chance of the output. How can I stop the text field from converting the input into 'plain' or 'safe'? Thanks again, Sebastian. sebastian wrote: > Wow, the Devel module is excellent! Thanks!!! Phew, finally feeling like > I am able to make progress now! Not solved but now I am finally able to > move forward again. > :D > > I am heeding your advice on making a node-product_module.tpl.php file, > and this is now going in the right direction [now that I finally could > see where the node.tpl.php file that was being used was!!] > > Thank you!! > > Sebastian. > > Justin Gruenberg wrote: >> On Thu, Apr 9, 2009 at 11:32 PM, sebastian wrote: >>> If I were to go down the Views' path, how would I do this? If a user >>> clicks >>> the title, they get sent to the Node, not to a View; how can I make >>> it so >>> that the user sees the View, with the correct NID, instead of the Node's >>> default [non-Views] page? Am I forced to hand-code the title/image >>> links to >>> something other than the default [links to Node NID]? If so, how >>> would I do >>> that? >>> >>> I'd like to figure that out even if I do end up theming the node tpl >>> instead, >> >> If you were to use views to do this you'd need to set up an entirely >> new view. You would need to use arguments from the URL to specify >> what node you want to display (probably the node id). You would have >> to build a link to this view in your taxonomy view. You would then be >> able to theme your new view . . . and you'd be exactly where you're at >> right now if you just theme the node page. >> >> Unless I'm misunderstanding your question, doing this in views would >> just reimplement what drupal already does. >> >> Your best bet is to make a node template. You can use the existing >> node.tpl.php as an example. Also, if you look at the api docs ( >> http://api.drupal.org/api/file/modules/node/node.tpl.php/6 ) you can >> see all the variables that will be in scope. I'd also suggest using >> the Devel module ( http://drupal.org/project/devel ) which is like >> FireBug for drupal and it'll show you what files to create/modify to >> theme just about anything in drupal. >> _______________________________________________ >> themes mailing list >> themes at drupal.org >> http://lists.drupal.org/mailman/listinfo/themes >> > From justin.gruenberg at gmail.com Fri Apr 10 20:50:22 2009 From: justin.gruenberg at gmail.com (Justin Gruenberg) Date: Fri, 10 Apr 2009 15:50:22 -0500 Subject: [themes] displaying a 'View' of a specific content type node? In-Reply-To: <49DF9A04.70109@gmail.com> References: <49DE5536.3060809@gmail.com> <96cd751f0904091410w3f2b4561icd439af9bf39430d@mail.gmail.com> <507b282e0904091602p1f273dbdwe113297fdd368345@mail.gmail.com> <49DECBCE.3090100@gmail.com> <96cd751f0904100009s333f3ae8n5ab0be782ec46c12@mail.gmail.com> <49DF88E0.5040507@gmail.com> <49DF9A04.70109@gmail.com> Message-ID: <96cd751f0904101350k17d987e2k84b78d6aa5417ef1@mail.gmail.com> On Fri, Apr 10, 2009 at 2:12 PM, sebastian wrote: > As a follow up to the wonders of Devel, I've identified a function called: > mythemename_text_formatter_plain() in the mythemename/template.php file, > nothing happens... [ie it still runs the text.module code's version of the > function] > You have to clear the theme cache. Check: http://drupal.org/node/173880#theme-registry -- although it seems like your problem is just with the input format, and you probably do not need to override any theme functions for your problem. > How can I stop the text field from converting the input into 'plain' or > 'safe'? This is a problem with input formats. You're using a WYSIWYG editor, which is going to output HTML to Drupal. You need to set your input format (usually right under the field in your node/add form) to Full HTML. I'm not sure about your specific case. From inforazor at gmail.com Fri Apr 10 20:52:12 2009 From: inforazor at gmail.com (sebastian) Date: Fri, 10 Apr 2009 13:52:12 -0700 Subject: [themes] displaying a 'View' of a specific content type node? In-Reply-To: <96cd751f0904100009s333f3ae8n5ab0be782ec46c12@mail.gmail.com> References: <49DE5536.3060809@gmail.com> <96cd751f0904091410w3f2b4561icd439af9bf39430d@mail.gmail.com> <507b282e0904091602p1f273dbdwe113297fdd368345@mail.gmail.com> <49DECBCE.3090100@gmail.com> <96cd751f0904100009s333f3ae8n5ab0be782ec46c12@mail.gmail.com> Message-ID: <49DFB17C.2080600@gmail.com> > If you were to use views to do this you'd need to set up an entirely > new view. You would need to use arguments from the URL to specify > what node you want to display (probably the node id). You would have > to build a link to this view in your taxonomy view. You would then be > able to theme your new view . . . and you'd be exactly where you're at > right now if you just theme the node page. > > Unless I'm misunderstanding your question, doing this in views would > just reimplement what drupal already does. Hiya, well, one reason for wanting to use Views to display a node is so that I don't have to re-style all of the horrendous levels of CSS depth all over again to make the detail [node] page look the same as my taxonomy-filtered view... I've started theming the Node view, now that I can affect the output, and the styling with the CSS is taking hours; and yes, I am using Firebug for firefox; The entire topology of class names and ID's are different in the standard node output than in the standard View of nodes... could in part be due to my own oversight of the CSS-topology-logic employed, but still... sigh. :( Setting up a new View would probably only take me 15 min as that is at least straight forward, and I can mimic the CSS output exactly... not to mention use a 'Page' so that I can retain taxonomy links in a different column; But I still didn't understand from your description how I would "build a link to this view in my taxonomy view"? How do I link to a View and pass an argument instead of to a nodes NID page? Thanks for your help, Sebastian From inforazor at gmail.com Sat Apr 11 20:07:08 2009 From: inforazor at gmail.com (sebastian) Date: Sat, 11 Apr 2009 13:07:08 -0700 Subject: [themes] displaying a 'View' of a specific content type node? In-Reply-To: <96cd751f0904101350k17d987e2k84b78d6aa5417ef1@mail.gmail.com> References: <49DE5536.3060809@gmail.com> <96cd751f0904091410w3f2b4561icd439af9bf39430d@mail.gmail.com> <507b282e0904091602p1f273dbdwe113297fdd368345@mail.gmail.com> <49DECBCE.3090100@gmail.com> <96cd751f0904100009s333f3ae8n5ab0be782ec46c12@mail.gmail.com> <49DF88E0.5040507@gmail.com> <49DF9A04.70109@gmail.com> <96cd751f0904101350k17d987e2k84b78d6aa5417ef1@mail.gmail.com> Message-ID: <49E0F86C.1060002@gmail.com> Ok I finally was able to see the input for 'full or filtered html' when I changed my admin theme for content to garland... hmmm; Thanks for all your help on this one. :) Sebatian. Justin Gruenberg wrote: > On Fri, Apr 10, 2009 at 2:12 PM, sebastian wrote: >> As a follow up to the wonders of Devel, I've identified a function called: >> mythemename_text_formatter_plain() in the mythemename/template.php file, >> nothing happens... [ie it still runs the text.module code's version of the >> function] >> > > You have to clear the theme cache. Check: > http://drupal.org/node/173880#theme-registry -- although it seems like > your problem is just with the input format, and you probably do not > need to override any theme functions for your problem. > >> How can I stop the text field from converting the input into 'plain' or >> 'safe'? > > This is a problem with input formats. You're using a WYSIWYG editor, > which is going to output HTML to Drupal. You need to set your input > format (usually right under the field in your node/add form) to Full > HTML. I'm not sure about your specific case. > _______________________________________________ > themes mailing list > themes at drupal.org > http://lists.drupal.org/mailman/listinfo/themes > From hello at fresh-off.com Tue Apr 14 01:01:50 2009 From: hello at fresh-off.com (brendan, fresh-off.com) Date: Mon, 13 Apr 2009 18:01:50 -0700 Subject: [themes] targeting variables in my node-blog.tpl.php file In-Reply-To: <346d496f0904100208s54704521k80475a949d12537@mail.gmail.com> References: <49DCF34A.4090607@karasssuite.net> <000601c9b9b1$6350a7f0$29f1f7d0$@com> <346d496f0904100208s54704521k80475a949d12537@mail.gmail.com> Message-ID: <000001c9bc9c$9890b430$c9b21c90$@com> 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 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: super_user.gif Type: image/gif Size: 90101 bytes Desc: not available URL: From ckng at fordrupal.com Tue Apr 14 03:57:03 2009 From: ckng at fordrupal.com (Ng Chin Kiong) Date: Tue, 14 Apr 2009 11:57:03 +0800 Subject: [themes] New Premium Community Theme - Platino Message-ID: <346d496f0904132057i16232f3jc2ba1a7afce1f76a@mail.gmail.com> We're adding the first community theme to our themes collection - Platino. Platino is a community centric theme, simple yet customizable, and appealing to community users. Although it is designed from ground up to be community based, it is an equally able theme for corporate, brochure, or personal site. forDrupal Premium Themes - main site forDrupal Platino Theme - demo of Platino Available for D6 only. A quick list of features (complete info on the demo site): - XHTML 1.0 Strict, CSS 2.0 Valid - 25 Regions - jQuery Menu - Block Highlights - Form Tooltips - Customize using Theme Settings - Workable as Administration theme - Drupal 6.x and Acquia - Professional Typography - PSD file and Demo Site included - Tested in IE6/7/8, FF, Safari, Chrome, Opera Cheers, CK Ng forDrupal Premium Themes (http://fordrupal.com) - we make drupal beautiful -------------- next part -------------- An HTML attachment was scrubbed... URL: From hello at fresh-off.com Tue Apr 14 05:50:37 2009 From: hello at fresh-off.com (brendan, fresh-off.com) Date: Mon, 13 Apr 2009 22:50:37 -0700 Subject: [themes] targeting variables in my node-blog.tpl.php file In-Reply-To: <000001c9bc9c$9890b430$c9b21c90$@com> References: <49DCF34A.4090607@karasssuite.net> <000601c9b9b1$6350a7f0$29f1f7d0$@com> <346d496f0904100208s54704521k80475a949d12537@mail.gmail.com> <000001c9bc9c$9890b430$c9b21c90$@com> Message-ID: <000601c9bcc4$f080baf0$d18230d0$@com> 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 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: From ckng at fordrupal.com Tue Apr 14 09:58:44 2009 From: ckng at fordrupal.com (Ng Chin Kiong) Date: Tue, 14 Apr 2009 17:58:44 +0800 Subject: [themes] targeting variables in my node-blog.tpl.php file In-Reply-To: <000601c9bcc4$f080baf0$d18230d0$@com> References: <49DCF34A.4090607@karasssuite.net> <000601c9b9b1$6350a7f0$29f1f7d0$@com> <346d496f0904100208s54704521k80475a949d12537@mail.gmail.com> <000001c9bc9c$9890b430$c9b21c90$@com> <000601c9bcc4$f080baf0$d18230d0$@com> Message-ID: <346d496f0904140258va68a7d6j919b7a7c855b062d@mail.gmail.com> If you want to remove blog_usernames_blog from $link, put this in template.php /* duplicate theme_links() and add the 3rd line (marked with HERE) */ function phptemplate_links($links, $attributes = array('class' => 'links')) { $output = ''; // HERE: just add this line, the rest are from theme_links() unset($links['blog_usernames_blog']); if (count($links) > 0) { $output = ''; $num_links = count($links); $i = 1; foreach ($links as $key => $link) { $class = $key; // Add first, last and active classes to the list of links to help out themers. if ($i == 1) { $class .= ' first'; } if ($i == $num_links) { $class .= ' last'; } if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '' && drupal_is_front_page()))) { $class .= ' active'; } $output .= ' $class)) .'>'; if (isset($link['href'])) { // Pass in $link as $options, they share the same keys. $output .= l($link['title'], $link['href'], $link); } else if (!empty($link['title'])) { // Some links are actually not links, but we wrap these in for adding title and class attributes if (empty($link['html'])) { $link['title'] = check_plain($link['title']); } $span_attributes = ''; if (isset($link['attributes'])) { $span_attributes = drupal_attributes($link['attributes']); } $output .= /*''.*/ $link['title'] /*.''*/; } $i++; $output .= "\n"; } $output .= ''; } return $output; } For changing $submitted, add to your template.php function phptemplate_node_submitted($node) { // make your changes return t('By !username (posted on @datetime)'), array( '!username' => theme('username', $node), '@datetime' => format_date($node->created), )); } For phptemplate_preprocess_node, if you want to introduce new variables or modify existing one. Of course it can be used to change submitted as well, but not $links as it has been generated. function phptemplate_preprocess_node(&$vars, $hook) { $author = theme('username', $vars['node']); $date = format_date($vars['node']->created, 'medium'); $vars['submitted'] = $author . ' - ' . $date; } Cheers, CK Ng forDrupal Premium Themes (http://fordrupal.com) - we make drupal beautiful On Tue, Apr 14, 2009 at 1:50 PM, brendan, fresh-off.com wrote: > 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 > > > > _______________________________________________ > themes mailing list > themes at drupal.org > http://lists.drupal.org/mailman/listinfo/themes > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hello at fresh-off.com Thu Apr 16 00:36:13 2009 From: hello at fresh-off.com (brendan, fresh-off.com) Date: Wed, 15 Apr 2009 17:36:13 -0700 Subject: [themes] targeting variables in my node-blog.tpl.php file In-Reply-To: <346d496f0904140258va68a7d6j919b7a7c855b062d@mail.gmail.com> References: <49DCF34A.4090607@karasssuite.net> <000601c9b9b1$6350a7f0$29f1f7d0$@com> <346d496f0904100208s54704521k80475a949d12537@mail.gmail.com> <000001c9bc9c$9890b430$c9b21c90$@com> <000601c9bcc4$f080baf0$d18230d0$@com> <346d496f0904140258va68a7d6j919b7a7c855b062d@mail.gmail.com> Message-ID: <000001c9be2b$59701a80$0c504f80$@com> WOW!!! THANKS EVERY SO MUCH!!! I would have never gotten that far on my own! I really, really, really appreciate that CK Ng!!!! Brendan From: themes-bounces at drupal.org [mailto:themes-bounces at drupal.org] On Behalf Of Ng Chin Kiong Sent: Tuesday, April 14, 2009 2:59 AM To: A list for theme developers Subject: Re: [themes] targeting variables in my node-blog.tpl.php file If you want to remove blog_usernames_blog from $link, put this in template.php /* duplicate theme_links() and add the 3rd line (marked with HERE) */ function phptemplate_links($links, $attributes = array('class' => 'links')) { $output = ''; // HERE: just add this line, the rest are from theme_links() unset($links['blog_usernames_blog']); if (count($links) > 0) { $output = ''; $num_links = count($links); $i = 1; foreach ($links as $key => $link) { $class = $key; // Add first, last and active classes to the list of links to help out themers. if ($i == 1) { $class .= ' first'; } if ($i == $num_links) { $class .= ' last'; } if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '' && drupal_is_front_page()))) { $class .= ' active'; } $output .= ' $class)) .'>'; if (isset($link['href'])) { // Pass in $link as $options, they share the same keys. $output .= l($link['title'], $link['href'], $link); } else if (!empty($link['title'])) { // Some links are actually not links, but we wrap these in for adding title and class attributes if (empty($link['html'])) { $link['title'] = check_plain($link['title']); } $span_attributes = ''; if (isset($link['attributes'])) { $span_attributes = drupal_attributes($link['attributes']); } $output .= /*''.*/ $link['title'] /*.''*/; } $i++; $output .= "\n"; } $output .= ''; } return $output; } For changing $submitted, add to your template.php function phptemplate_node_submitted($node) { // make your changes return t('By !username (posted on @datetime)'), array( '!username' => theme('username', $node), '@datetime' => format_date($node->created), )); } For phptemplate_preprocess_node, if you want to introduce new variables or modify existing one. Of course it can be used to change submitted as well, but not $links as it has been generated. function phptemplate_preprocess_node(&$vars, $hook) { $author = theme('username', $vars['node']); $date = format_date($vars['node']->created, 'medium'); $vars['submitted'] = $author . ' - ' . $date; } Cheers, CK Ng forDrupal Premium Themes (http://fordrupal.com) - we make drupal beautiful On Tue, Apr 14, 2009 at 1:50 PM, brendan, fresh-off.com wrote: 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 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 _______________________________________________ themes mailing list themes at drupal.org http://lists.drupal.org/mailman/listinfo/themes -------------- next part -------------- An HTML attachment was scrubbed... URL: From barb at karasssuite.net Thu Apr 23 17:30:41 2009 From: barb at karasssuite.net (barb) Date: Thu, 23 Apr 2009 19:30:41 +0200 Subject: [themes] tpl.php file question - solved!!! In-Reply-To: References: <49DCF34A.4090607@karasssuite.net> <001d01c9b882$8a5c8bf0$9f15a3d0$@sintjago@xs4all.nl> <49DCFFB5.30405@karasssuite.net><002001c9b886$3a4c7ef0$aee57cd0$@sintjago@xs4all.nl> <49DE14B5.90701@karasssuite.net> Message-ID: <49F0A5C1.6000509@karasssuite.net> ahojte! > In Pro Drupal Development this process is explained in detail. Maybe it is > hard to grasp because you have to understand the Theme Registry. > > A sidestep: Assuming node-audio is a CCk-node, did you consider using > CCk-computed field.? sintjago! thx so much for your help! i looked at cck-computed field but was rather hesitant to use it. so in the end after asking around and trying to define the variables in template.php (and starting finally to learn php basics myself) i got the solution. it was really simple actually. to find out, how the node.tpl.php is actually build up, this was included in the code of node-audio.tpl.php: global $user; if ($user->uid == '1') { print "
";
print_r($node);
print "
"; } so - there the nice code lay, and then it got clear, that the solution was, to include into the $file - this here: $file = $node->audio['file']; so template.php was left out. maybe not an 'aesthetic' solution but rather dirty, but it's doing the job for me. so this is the whole code, and this the output: http://okno.be/vodnik-vitaminC2 audio['file']; $filepath = $file->filepath; $type = explode(".", basename($filepath)); // print_r($filepath); if (file_exists($filepath)) { $output .= l($type['1'], $filepath) . ' : '; } $type = 'mp3'; $filepath = $convertpath . $file->filename . '.' . $type; $downloadpath = 'sites/default/files/audio_converted/' . $file->filename . '.' . $type; if (file_exists($filepath)) { $output .= l($type, $downloadpath) . ' : '; } $type = 'ogg'; $filepath = $convertpath . $file->filename . '.' . $type; $downloadpath = 'sites/default/files/audio_converted/' . $file->filename . '.'. $type; if (file_exists($filepath)) { $output .= l($type, $downloadpath); } $output = theme('fieldset', array('#title' => 'Download:', '#children' => $output)); print $output; //end added by bundes ?>