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