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

pro .tpl eine .php?

 
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
robbo2000
Smarty Rookie


Joined: 02 Nov 2016
Posts: 14

PostPosted: Fri Nov 11, 2016 7:46 pm    Post subject: pro .tpl eine .php? Reply with quote

Hallo zusammen,

ich arbeite mich gerade in Smarty ein und muss sagen, dass mir die Engine sehr gut gefällt.
Meine index.php in meinem Lernprojekt ist allerdings recht groß geworden, da ich anhand von switch und $_REQUEST die einzelnen Seitenaufrufe behandele, entsprechende Funktionen aufrufe und Variablen zuordne…

Ich habe Beispiele gesehen, wo es zu jeder tpl eine php gibt. Hier eines davon: http://webscripts.softpedia.com/Basic-PHP-login-system/download/
Hier wird in jeder php-Datei smarty neu instantiiert. Wie ist hier eure Meinung, was empfehlt ihr und könnt ihr mir Tipps geben, wie man seinen Code besser auf mehrere Dateien verteilt?

Viele Grüße & ein schönes Wochenende
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Nov 11, 2016 10:15 pm    Post subject: Reply with quote

"Our" opinion is that there shouldn't be any PHP (or other "executable") files in the webroot, at all.
At most (read: Apache httpd) there should be one PHP file (usually "index.php", but sometimes just a garbage name unlikely to match any real request) to provide an entry point to your application. For more modern web servers, you can specify this entry point explicitly, thus entirely clearing the webroot of scripts and other stuff that isn't served directly.

Under that light, "TPL per PHP" question loses all sense. You make template files per page type and per content block type, not "per PHP".

If your index grows unwieldy because of request processing, this is probably a sign that you need to separate routing from application logic.
Back to top
View user's profile Send private message
robbo2000
Smarty Rookie


Joined: 02 Nov 2016
Posts: 14

PostPosted: Sun Nov 13, 2016 9:31 pm    Post subject: Reply with quote

Thank you for your reply and for the Tipps. I will do it accordingly to your advice.
Back to top
View user's profile Send private message
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