Re: Re: [SMARTY] dyamic include file variable
| From: | Rasmus Schultz | Date: | Thu, 09 Jan 2003 00:51:21 +0000 |
| Subject: | Re: Re: [SMARTY] dyamic include file variable | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-7071@lists.php.net to get a copy of this message | ||
<OFFTOPIC>
>Oh! Well don't I feel dumb. Expesially when I had just figured out not to
>put config variables in curlies when they were already enclosed...
>({$title|default:#pageTitle#}).
>
>You would suggest a different php script for each part of the webpage? As
>in, index.php, /users/user.php, /news/news.php, ect? I was sort of liking
>the 'never leave index' stype, I remember having a look at some Java-style
>MVC and it did go like that (everything from one controller), however in
>that case it also ended up having URLs like site.com/control/news and
>site.com/control/user, which made it look like it was accessing directories
>when it really wasn't. Hmm. Also if memory serves doesn't phpShop run like
>this as well? Not that it matters I suppose. What sort of issues do you
>envision me having? If this is offtopic for the list I'm sorry. I'm just
>starting the project and I don't want to get off on the wrong foot :) (I
>evaluated all sorts of TEs for PHP and I have to say I think Smarty is the
>best, no contest!).
it's a matter of personal preference, and of the requirements for
your site. for something like a PHP shop, of course it's a good
idea, since having only one script makes it pretty easy to
integrate with your own site.
but apart from the problems with proxies and client caches, as
mentioned, there are two reasons I never do this:
first, it's disorganized - you get only one level of organization,
like for example:
site.com/index.php
site.com/user/login.php
site.com/user/logout.php
site.com/user/upload.php
site.com/news/view.php
site.com/news/post.php
here, you have the opportunity to organize your pages in folders.
with a single index.php to display them all, you'd have something
like:
site.com/index.php
site.com/index.php?page=userlogin
site.com/index.php?page=userlogout
site.com/index.php?page=userupload
site.com/index.php?page=newsview
site.com/index.php?page=newspost
so instead of being able to organize your scripts into a user and
news folder, for example, you now have it all in one pile.
secondly, it can be pretty ineffective ... for example, you have
maybe some database scripts in an include - now instead of simply
including this database script in the pages that need it, you now
need to CHECK first if they're needed, and then conditionally
include the necessary support scripts - or worse, load your
database script every time, even when it's not needed ... either
way, the load of each indidual page will grow with the addition
of every library include file. bad, bad, bad.
and finally - look at those URLs, with the questionmarks and
stuff ... let's face it, apart from the fact that they make it
impossible for the user to write down a bookmark for a friend,
much less learn it by heart, they're just not PRETTY! ;)
</OFFTOPIC>