|
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 |
robbo2000 Smarty Rookie
Joined: 02 Nov 2016 Posts: 14
|
Posted: Fri Nov 11, 2016 7:46 pm Post subject: pro .tpl eine .php? |
|
|
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 |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Nov 11, 2016 10:15 pm Post subject: |
|
|
"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 |
|
robbo2000 Smarty Rookie
Joined: 02 Nov 2016 Posts: 14
|
Posted: Sun Nov 13, 2016 9:31 pm Post subject: |
|
|
Thank you for your reply and for the Tipps. I will do it accordingly to your advice. |
|
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
|