Hello Steve,
Maybe is nothing, but in your last email you are using Resources:
$object = new App_Resources_Widgets_Test
And in the one before you are using Resource:
 // 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);
    }
Is there a typo? Resources vs Resource ?

Have a nice day,
Gabriel

On 12.04.2012 14:54, sjwdavies wrote:
Hi Marco,

The autoloader is working fine as loading the class, when it exists, using
the following works perfectly:

$object = new App_Resources_Widgets_Test

Cheers,
Steve

On 12 April 2012 12:50, Marco Pivetta [via Zend Framework Community] <
[email protected]> wrote:

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] <[hidden
email] <http://user/SendEmail.jtp?type=node&node=4551639&i=0>> 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.
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>



------------------------------
 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-tp4551622p4551639.html
 To unsubscribe from Check If Class Exists, click here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4551622&code=c2p3ZGF2aWVzQGdtYWlsLmNvbXw0NTUxNjIyfDcxMTQzMTU2NQ==>
.
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-tp4551622p4551652.html
Sent from the Zend Framework mailing list archive at Nabble.com.


--
Gabriel-Cristian CROITORU

Senior Software Engineer
E-mail: [email protected]
Signature
Tel. +40 (0)31 71 00 114
Fax. +40 (0)31 71 00 115
http://www.zitec.com
[email protected]

Reply via email to