|
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 |
moshelakin Smarty n00b
Joined: 29 Dec 2021 Posts: 1
|
Posted: Wed Dec 29, 2021 3:26 pm Post subject: Does every page on a site has to |
|
|
Hello,
I'm trying to teach myself PHP and Smarty. I'm starting out with something simple: A simple site with just a few pages (home, about, contact, etc.). I have created a template and views for the header and footer and I'm pulling the content dynamically from a MySQL database.
This is a rather simple question but I cannot seem to find an answer:
What is the recommended way to add more pages? Should I have an index.php, then a about.php, a contact.php, etc? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Dec 31, 2021 5:01 am Post subject: |
|
|
Commonly accepted modern practice is to have a single entry file, which will catch all requests not served by static content, and route them to appropriate controllers.
Depending on your webserver, here's how you implement it:
Apache httpd:
Code: | <VirtualHost …>
FallbackResource /router.php
</VirtualHost> |
nginx:
Code: | server {
try_files /index.html $uri @app;
location @app {
include extras/fastcgi_php_fpm;
fastcgi_param SCRIPT_FILENAME "/full/path/to/router.php";
fastcgi_pass …;
}
} |
P.S.
That's no Smarty question, though. |
|
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
|