Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Main Directory definieren

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
Fireche
Smarty n00b


Joined: 07 Jun 2015
Posts: 4

PostPosted: Mon Jun 08, 2015 5:35 pm    Post subject: Main Directory definieren Reply with quote

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
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Thu Jun 18, 2015 7:23 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP