alps hypertexte
functions.php und die sidebar.php (beides muss im Theme-Verzeichnis liegen). Dabei wird empfohlen, möglichst ul/li-Markup für die Seitenleiste einzusetzen. Andernfalls müssen in der functions.php die geänderten Parameter mitgegeben werden. Die sidebar.php zeigt folgendes Gebilde
<ul id="sidebar">
<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar() ) : ?>
<li id="about">
<h2>About</h2>
<p>This is my blog.</p>
</li>
<li id="links">
<h2>Links</h2>
<ul>
<li><a href="http://example.com">Example</a></li>
</ul>
</li>
<?php endif; ?>
</ul>
functions.php beinhaltet:
<?php
if ( function_exists('register_sidebar') )
register_sidebar();
?>
I HAVE A THEME WITH MORE THAN ONE SIDEBAR. HOW DO I MAKE THEM ALL DYNAMIC?
Oh, that's easy. Instead of register_sidebar() you should use
register_sidebars(n) where n is the number of sidebars. Then place the
appropriate number in the dynamic_sidebar() function, starting with 1. There are
several ways to dse these functions but they aren't all documented here. You can
even give your sidebars names rather than numbers, which lets you maintain a
different set of saved sidebars for each theme. But if you need to know so much
about the plugin, why aren't you reading the source code?
functions.php bei 2 Widgets-Leisten so aus:
<?php
if ( function_exists('register_sidebar') )
register_sidebars(2, array('name'=>'Sidebar %d'));
?>
<ul id="sidebar1">
<?php if (function_exists('dynamic_sidebar')
&& dynamic_sidebar(1) ) : else : ?>
...
<?php endif; ?>
</ul>
<ul id="sidebar2">
<?php if (function_exists('dynamic_sidebar')
&& dynamic_sidebar(2) ) : else : ?>
...
<?php endif; ?>
</ul>
{if $leftSidebarElements > 0}
{serendipity_printSidebar side="left"}
{/if}
{if $rightSidebarElements > 0}
{serendipity_printSidebar side="right"}
{/if}
config.inc.php mit folgendem Inhalt erstellen (wenn schon Anweisungen vorhanden sind, einfach dazu packen)
$template_config = array(
array(
'var' => 'sidebars',
'title' => 'Sidebars',
'type' => 'string',
'default' => 'left,hide,right,third,forth'
)
);
{serendipity_printSidebar side="third"}
{serendipity_printSidebar side="forth"}
neueste Leser-Kommentare: