mrmaus
4. Dezember 2009 um 23:06
1
hallo,
ich nutze drupal und habe in einer .php datei folgenden auschnitt gefunden:
Free Download - <?php print $head_title ?>
der seitentitel wird dort gesetzt, aber wo die variable? im gleichem script die variable nicht anzutreffen!
das ganze sript:
[PHP]
<?php
// $Id: page.tpl.php,v 1.25 2008/01/24 09:42:53 goba Exp $
?>
Free Download - <?php print $head_title ?>
<?php print $head ?>
<?php print $styles ?>
<?php print $scripts ?>
<?php if (isset($primary_links)) : ?>
<?php print theme('links', $primary_links, array('class' => 'links primary-links')) ?>
<?php endif; ?>
<?php if ($breadcrumb != ""): ?>
<?php print $breadcrumb ?>
<?php endif; ?>
<?php if ($logo) : ?>
<?php endif; ?>
<?php if ($site_name) : ?>
<h1 class='site-name'><a href="<?php print $front_page ?>" title="<?php print t('Home') ?>"><?php print $site_name ?></a></h1>
<?php endif; ?>
<?php if ($site_slogan) : ?>
<div class="slogan"><?php print($site_slogan) ?></div>
<?php endif;?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="cont-row">
<table width="100%" >
<tr>
<td width="200">
<div class="left2">
<?php if ($left != ""): ?>
<table width="100%">
<tr>
<td width="100%">
<?php print $left ?>
</td>
</tr>
</table>
<?php endif; ?>
<div class="search-box">
<?php if ($search_box): print $search_box; endif; ?>
</div>
</div>
</td>
<td width="">
<div class="cent">
<div class="border-left">
<div class="border-right">
<div class="border-top">
<div class="border-bot">
<div class="corner-top-left">
<div class="corner-top-right">
<div class="corner-bot-left">
<div class="corner-bot-right">
<?php if ($is_front != ""): ?>
<div id="custom"><?php print $custom ?></div>
<?php endif; ?>
<?php if ($mission != ""): ?>
<div id="mission"><?php print $mission ?></div>
<?php endif; ?>
<?php if ($tabs): print '<div id="tabs-wrapper" class="clear-block">'; endif; ?>
<?php if ($title): print '
<h2'. ($tabs ? ' class="with-tabs title"' : '') .'>'. $title .'</h2>
'; endif; ?>
<?php if ($tabs): print '<ul class="tabs primary">'. $tabs .'</ul></div>'; endif; ?>
<?php if ($tabs2): print '<ul class="tabs secondary">'. $tabs2 .'</ul>'; endif; ?>
<?php if ($show_messages && $messages != ""): ?>
<?php print $messages ?>
<?php endif; ?>
<?php if ($help != ""): ?>
<div id="help"><?php print $help ?></div>
<?php endif; ?>
<!-- start main content -->
<?php print $content; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="footer">
<div class="foot">
<?php if ($footer_message || $footer) : ?>
<span><?php print $footer_message;?></span>
<?php endif; ?>
</div>
</div>
<?php print $closure;?>
[/PHP]
threadi
4. Dezember 2009 um 23:33
2
Vermutlich wird diese Datei included, und vor dem include() wird die Variable gesetzt.
Genau, die von mrmaus gepostete Datei ist ein Drupal-Theme-Template. Die Variablen, die dort zur Verfügung stehen, werden vom Drupal-System automatisch gesetzt (ich denke, in include/themes.inc, aber das ist mehr oder weniger unwesentlich).
Die Variable $head_title enthält unter anderem den Wert, der in admin/settings/site-information für den Namen der Seite gesetzt wurde.