[Solar-talk] __autoload()
Rodrigo Moraes
rodrigo.moraes at gmail.com
Wed Jul 12 10:07:26 PDT 2006
On 7/12/06, Paul M Jones wrote:
> I don't think a framework ought
> to implement it, because there are too many assumptions about how the
> target project is organized.
I totally agree and understand that a framework should not implement
__autoload().
> As a result, I think it's best if projects develop their own
> __autoload(). It's trivial to re-implement the Solar::loadClass()
> file-finding logic inside a project-specific __autoload(), and then
> you can combine that with whatever file-finding logic you might need
> for 3rd-party libs.
Ok, I'll do it. My question (not very clear) was more relative to if
it there us a standard way to use only Solar methods inside my
project's __autoload() (given that it also adheres to Pear class
namings).
Sorry for insist a bit. The main problem seems to be the view template
path stack and the exception throwed on Solar::run(), which happens on
every attempt to load a class using a template path, and not in the
end of template paths tries. If there was a workaround to improve
this... it would be possible to use Solar::loadClass() inside
__autoload(). Am I right?
> Having said all that, perhaps it would be possible to provide a call
> that spl_autoload() can use, instead of the standard PHP __autoload().
>
> http://php.net/spl_autoload
Thanks for the ponting this.
> [*] The main reason for the exceptions is so that you can get a stack
> trace to see where the loading was attempted from. With require(),
> you get an error that the require failed, but it doesn't tell you
> what file/line/etc; with loadClass(), when it fails, the stack trace
> tells you exactly where the failure originates.
Some days ago I entered the Solar website and saw well formated errors
in the top of the page (fixed minutes later). I'm not used to
exceptions and would like to know how to have better / formatted /
easier ro read errors like that. Now I have that
everything-in-one-line thing which is difficult to read and could be
more useful. Sorry, this is a very exceptions-newbie question. Could
anybody share how to have nice formatted errors or how to integrate
them well in Solar (turn them on / off)?
thanks a lot,
rodrigo moraes / brazil
More information about the solar-talk
mailing list