[themes] tpl.php file question
Joop Sint Jago
j.sintjago at xs4all.nl
Wed Apr 8 20:11:35 UTC 2009
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
<?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()
*/
?>
<div id="node-<?php print $node->nid; ?>" class="<?php print $classes;
?>"><div class="node-inner">
<?php print $picture; ?>
<?php if (!$page): ?>
<h2 class="title">
<a href="<?php print $node_url; ?>" title="<?php print $title
?>"><?php print $title; ?></a>
</h2>
<?php endif; ?>
<?php if ($unpublished): ?>
<div class="unpublished"><?php print t('Unpublished'); ?></div>
<?php endif; ?>
<?php if ($submitted or $terms): ?>
<div class="meta">
<?php if ($submitted): ?>
<div class="submitted">
<?php print $submitted; ?>
</div>
<?php endif; ?>
<?php if ($terms): ?>
<div class="terms terms-inline"><?php print t(' in ') . $terms;
?></div>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="content">
<?php print $content; ?>
</div>
<?php
//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
?>
<?php print $links; ?>
</div></div> <!-- /node-inner, /node -->
_______________________________________________
themes mailing list
themes at drupal.org
http://lists.drupal.org/mailman/listinfo/themes
More information about the themes
mailing list