|
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 |
Fireche Smarty n00b
Joined: 07 Jun 2015 Posts: 4
|
Posted: Mon Jun 08, 2015 5:35 pm Post subject: Main Directory definieren |
|
|
Hallo..ich würde gerne das Hauptvezeichnis mit einer Variable festelegen.
Sodass ich dann zB schreiben kann: {$var}\pfad\pfad\xx
Nun ist meine Frage..wie genau speichere ich den Pfad des Verzeichnis in einer Variable und wie greife ich dann darauf zu?
lg, danke |
|
Back to top |
|
Grizzly Smarty Pro
Joined: 15 Apr 2011 Posts: 172 Location: Germany
|
Posted: Thu Jun 18, 2015 7:23 am Post subject: |
|
|
Also Variablen initialisieren so wie "immer" mit Smarty.
Ich würde dir allerdings für diesen Fall empfehlen eine Datei im "Stammverzeichnis" anzulegen und dort eine Konstante zu definieren und dann am Anfang jeder Datei (index.php) diese dann einzubinden:
Code: | define("MY_ROOT_DIR", realpath(dirname(__FILE__))); |
Danach musst du diese nicht mehr "zuweisen", da Konstanten in Smarty direkt zur Verfügung stehen:
Code: | {$smarty.const.MY_ROOT_DIR} |
|
|
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
|