|
Posted by Henk verhoeven on 05/29/07 21:46
Sean Quinn schreef:
> (..) I am having one
> heck of a time when attempting to reference static resources such as
> javascript scripts, or style sheets, I haven't tried images but I
> suspect I will have problems with those as well.
> (..)
> The static resources are presented properly. Using the MVC framework,
> the default action for the above front controller is the index Action--
> now if I explicitly tell the browser what action to execute and I tell
> it to execute the index action like so:
>
> http://www.example.com/index/ or http://www.example.com/index.php/index
>
> My static resources suddenly disappear. The only explanation for this
> that I have, is the fact that no longer would the styles be found
> under the ./styles directory but the ./../styles directory.
Hi Quinn,
I agree. The problem is url rewriting. Like Zend Framework i use url
rewriting (but only for websites) so i also have that problem (for
websites). My solution is to make all paths to static resources
absolute. With phpPeanuts this is simple, as it has a function
pntGetBaseUrl and i have standard locations for the static resources. In
the rare case i deviate from this i can override the standard function
on a single place in the website code and use an adapted version of the
function.
> Thus,
> despite the fact that the system is getting the content in both
> examples above (the one that works, and the one that doesn't) from the
> same action controller, the only thing different is the interpreted
> path shown in the URL bar. I can't figure out whether it is something
> I am doing wrong, or whether it is the nature of the MVC architecture
> that paths to static resources can't be derived from the Front
> Controller in the root directory.
They can, see http://nl2.php.net/manual/en/function.header.php
But do you want to? All bytes of those resources will be streaming
through your php scripts, using processor cycles for something the
webserver software was optimized to do efficiently.
(..)
> 1) Is the Zend Framework stable, and developed enough to use over
> CakePHP, Solar, or any other framework out there, and what would
> people recommend if they feel that Zend's framework isn't quite ready
> yet?
Imho ZF does not really do very much. PhpPeanuts comes with a whole
bunch of generic Pages, Parts, Actions and Dialogs, so (for database
applications) it gives you much more of a structure to build on (and
much more to learn about - larger investment, more profit if it fits
your purpose).
The ZF may be a nice start for building CMS based websites, but there
are complete CMS's available that give you a much bigger headstart. I
guess there must be some that support url rewriting for search engine
friendly url's too.
> 2) Under ZF, or any other framework for that matter, while it may be
> the single index.php file that gets executed to initiate the
> Controllers and Views, why wouldn't it have the correct path for a
> static resource always in the same place?
> Is this a shortcoming of
> the MVC architecture, the framework implementing it, or my own short
> sighted implementation?
It's ZF using url rewriting, not MVC. Your implementation will have to
compensate. It must be a common problem, Zend should have documented how
to handle it.
It is not necessary to use url rewriting for the MVC Architecture.
PhpPeanuts uses a single index.php for each 'application' and does the
rest with parameters (normal ones, behind the question mark). How the
parameters are interpreted is basically up to the front controller and
it can manipulate the copy of their values it passes to the following
controller (recursively), so it is about as flexible as with ZF.
Because phpPeanuts does not depend on url rewriting it does not have
this problem resources problem. Furthermore it can be used with IIS and
(other) servers that do not support url rewriting.
However, it has some support for using url rewriting, but it is only
meant for specific applications that require custom conrollers/handlers
anyway, see my above remark about websites.
>
> Thanks in advance!
>
Thanks for a chance to give my opinion on the ZF.
Greetings,
Henk Verhoeven,
www.phpPeanuts.org.
N.B. phpPeanuts is an application framework, not a CMS. You can use it
to build a CMS and build websites with the resulting CMS, but the
tutorials will be of little help. If you need a CMS, you better look for
a CMS.
Navigation:
[Reply to this message]
|