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

Ajax + Templatepfad

 
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
Evergreen123
Smarty n00b


Joined: 16 May 2012
Posts: 4

PostPosted: Wed May 16, 2012 11:48 am    Post subject: Ajax + Templatepfad Reply with quote

Hallo zusammen,

ich bastel mir gerade ein CMS zurecht. Nun möchte ich einen bestimmten Bereich mit AJAX nachladen. Dafür benutze ich jQuery

Code:
   var request = $.ajax({
     url: "inc/search.sidebar.images.php",
     type: "POST",
   });


das funktioniert soweit.

in der search.sidebar.images.php soll dann das Template $smarty->display('bit.sidebar.images.tpl') erstellt werden. Nun habe ich das Problem das er folgende Fehlermeldung ausspuckt:

Quote:
<b>Warning</b>: Smarty error: unable to read resource: "bit.sidebar.images.tpl" in <b>D:\xampp\htdocs\cms\libs\Smarty.class.php</b> on line <b>1093</b><br>


Soweit ist mir das auch klar das er es nicht findet. benutze ich jetzt den absoluten Pfad bekomm ich die nächste Meldung:

Quote:
Fatal error</b>: Smarty error: the $compile_dir 'templates_c' does not exist, or is not a directory. in <b>D:\xampp\htdocs\cms\libs\Smarty.class.php</b> on line <b>1093</b><br>


Kann ich nicht an einer Stelle angeben das die Smarty relevanten Order (templates, templates_c und libs) in /cms/ liegen?
Denn alle php-datein in /cms/ funktionieren ohne Probleme. Nur sobald ich in Unterordner Scripte ausführe findet er die Smarty Ordner nicht mehr.

Hoffe es ist halbwegs verständlich was ich meine.

Danke schonmal Smile
Back to top
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Wed May 23, 2012 1:20 pm    Post subject: Reply with quote

Ich weiß zwar nicht genau wie bei dir der Aufbau ist, aber ich denke du hast irgendwo in der index.php oder so ein Smarty Object und tust es auch dort "konfigurieren" und beim aufruf der "search.sidebar.images.php" hast du diese Konfigurationen nicht mehr, da das Smarty-Object nun in der "search.sidebar.images.php" (neu) erstellt wurde.

Du müsstes d. h. du müsstest dann dein Smarty-Object neu konfigurieren.

Aber besser wäre es, wenn du immer über die index.php gehst und je nach Parameter eine andere Datei einbindest. Und das Smarty-Object ist ein Singleton

der aufrufe wäre dann nicht mehr "inc/search.sidebar.images.php" sondern z. B. "index.php?page=SearchSidebarImages"
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