|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
DabuLeader Smarty n00b
Joined: 20 Jan 2005 Posts: 3
|
Posted: Wed Jan 26, 2005 7:17 am Post subject: id="you are here" |
|
|
Hallo Zusammen,
Aus der Datenbank generiere ich eine Menu. Dieses soll intelligent sein. D.h.
immer auf der aktuellen Seite soll ein id="you are here" stehen. Damit ich die aktuelle Position mit css formatieren kann.
<ul>
<li>Seite1</li>
<li id="you are here">Seite2</li>
<li>Seite3</li>
</ul>
die schlechteste aller lösung wäre {php}{/php} einzubauen. Gibt es noch eine bessere? Über ein Plugin?
Ist es überhaupt möglich das Menu einmal aus der Datenbank zu generiren, und erst danach die funktion you are here einzubauen. |
|
Back to top |
|
coach Smarty Regular
Joined: 03 Jun 2004 Posts: 65
|
Posted: Thu Jan 27, 2005 4:35 pm Post subject: |
|
|
Hi,
wie generierst du das Menu? Im aufzurufenden PHP-Script oder mittels {include_php}?
Coach |
|
Back to top |
|
DabuLeader Smarty n00b
Joined: 20 Jan 2005 Posts: 3
|
Posted: Fri Jan 28, 2005 6:40 am Post subject: |
|
|
Ich generiere es im php script.
Mittlerweile habe ich eine Lösung gefunden. Ich hole mir im php script das Menu. Übergebe das Menu an das tpl-file und eine Variable. Die Variable gibt an welches die aktuelle Seite ist. Im tpl-file mache ich eine {if} abfrage und vergleiche meine Variable. Bei gleichheit erscheint <li id="you are here">.
Das ganze tpl-file cache ich und die Datenbankabfrage im php script setzte ich in eine if(!$smarty->is_cached abfrage){datenbankabfrage}.
Könnte man das ganze auch in eine plugin funktion legen? |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|