Well, that's your autoloader failing. Are you sure you have set it up
correctly?
Marco Pivetta

http://twitter.com/Ocramius

http://marco-pivetta.com



On 12 April 2012 13:42, sjwdavies [via Zend Framework Community] <
[email protected]> wrote:

> Hi List,
>
> I'm trying to simply check is a class exists, using the following code:
>
>     // Add the widget content if it exists
>     if(class_exists('App_Resource_Widgets_' . $trimmedWidgetName)) {
>         $widgetContent = App_Resource_Widgets::$trimmedWidgetName();
>         $content = str_replace($widgetName, $widgetContent, $content);
>     }
>
> However it throws an error when the class doesn't exist:
>
> Warning: include_once(App\Resource\Widgets\Test.php)
> [function.include-once]: failed to open stream: No such file or directory
> in M:\Zend_Framework\library\Zend\Loader.php on line 134
>
> If I pass FALSE to the class_exists method, it doesn't throw the error -
> but doesn't construct my class either.
>
> I don't really want to use an @ to surpress this error, but is there a way
> to get around this?
>
> Thanks in advance,
> Steve
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/Check-If-Class-Exists-tp4551622p4551622.html
>  To unsubscribe from Zend Framework Community, click 
> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Check-If-Class-Exists-tp4551622p4551639.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to