|
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 |
adrianryser Smarty n00b
Joined: 09 Sep 2004 Posts: 3 Location: Schweiz
|
Posted: Thu Sep 09, 2004 7:17 pm Post subject: Smarty und Ordner? |
|
|
Hallo zusammen
habe eine frage. kann ich weiterhin meine php-files in ordner legen? kann ich im templates-order auch unterordner erstellen? das würde die übersichtlichkeit der quelldateien meines webprojekt erhöhen.
danke für eure hilfe.
grüess adrian |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Sep 09, 2004 10:08 pm Post subject: |
|
|
beides: ja.
deine php-file-struktur beinflusst smarty nicht.
das php kontrolliert smarty, nicht umgekehrt.
unterorder von "templates" sind auch kein problem, man muss nur bedenken, dass {include} nicht relative zum aktuellen template sondern relative zu $smarty->template_dir included. |
|
Back to top |
|
adrianryser Smarty n00b
Joined: 09 Sep 2004 Posts: 3 Location: Schweiz
|
Posted: Fri Sep 10, 2004 6:41 am Post subject: hab ich das richtig verstaden? |
|
|
Hallo
vielen Dank für deine schnelle Antwort. Jedoch habe ich, so glaube ich, etwas nicht richtig verstanden...
Weshalb findet Smarty das angegebene Template nicht? Habe gelesen, dass ich alle Pfade absolut angeben muss. Dieses PHP liegt im Unterordner Admin, und das Template ebenfalls im Ordner Admin, einfach als Unterordner der Templates. Wieso bringt Smarty folgenden Error?
Warning: Smarty error: unable to read resource: "admin/index.tpl" in /home/cust/netdotch/public_html/sisprocom_ch/tools/netgallery/smarty/libs/Smarty.class.php on line 1083
Fatal error: Smarty error: the $compile_dir 'templates_c' does not exist, or is not a directory. in /home/cust/netdotch/public_html/sisprocom_ch/tools/netgallery/smarty/libs/Smarty.class.php on line 1083
Hier meine PHP-Datei:
[php:1:2de15adf0c]<?php
$path = "/home/cust/netdotch/public_html/sisprocom_ch/tools/netgallery";
//Require
require("$path/inc/classes.inc.php");
require("$path/inc/settings.inc.php");
require("$path/inc/functions.inc.php");
//Instances
$smarty = new Smarty;
//Smarty-Special
$smarty->compile_check = true;
$smarty->debugging = true;
//Event
$event = getEvents($tab_events,'id','DESC');
$smarty->assign('event',$event);
//Album
$album = getAlbums($tab_albums,'id','DESC');
$smarty->assign('album',$album);
$smarty->display('/home/cust/netdotch/public_html/sisprocom_ch/tools/netgallery/admin/index.tpl');
?>[/php:1:2de15adf0c] |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Sep 10, 2004 7:15 am Post subject: |
|
|
nicht der pfad im argument für display() soll absolute sein.
der soll relativ zu $smarty->template_dir sein.
aber
$smarty->template_dir und $smarty->compile_dir sollten absolute pfade sein, damit smarty die files findet, egal von wo aus es aufgerufen wurde. |
|
Back to top |
|
adrianryser Smarty n00b
Joined: 09 Sep 2004 Posts: 3 Location: Schweiz
|
Posted: Fri Sep 10, 2004 12:13 pm Post subject: vielen dank |
|
|
danke vielmals, jetzt hats funktioniert!
einen schönen tag wünsche ich und viele grüsse
adrian |
|
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
|