TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-13-2009, 08:42 PM   #1 (permalink)
The Contributor
 
Join Date: Oct 2008
Posts: 75
Thanks: 4
9three is on a distinguished road
Default Using the Zend Loader

I understand that the Zend Loader is to avoid having to use includes/requires all over your page?

I'm having a problem doing that though. This is what a podcast from ZF site said to do:

PHP Code:
<?php

//include paths
ini_set('include_paths'ini_get('include_paths') . PATH_SEPERATOR '../library');
require_once 
'Zend/Loader.php';

Zend_Loader::loadClass('classname');

?>
I don't really want to use the MVC as I don't really like it. I'm just trying to use the loader to avoid doing a whole bunch of requires/includes.

When I use that code I get errors:

Code:
Warning: require_once(Zend/Loader.php) [function.require-once]: failed to open stream: No such file or directory in C:\Users\9three\Desktop\Server\htdocs\tests\index.php on line 5

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader.php' (include_path='.;C:\Users\9three\Desktop\Server\php\pear\') in C:\Users\9three\Desktop\Server\htdocs\tests\index.php on line 5
The library folder is actually one up. Its in htdocs\library\Zend. So I set it to ../Library and in the require is set to Zend/Loader.php.

All though it all matches im still getting the error. What am I doing wrong?
9three is offline  
Reply With Quote
Old 01-13-2009, 09:33 PM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Add the include paths to your Zend Framework in your index.php. Something like the following should work:

php Code:
set_include_path(implode(PATH_SEPARATOR, array(
    'C:/wamp/www/libs/ZendProject/',
    get_include_path())));
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 01-13-2009, 09:43 PM   #3 (permalink)
The Contributor
 
Join Date: Oct 2008
Posts: 75
Thanks: 4
9three is on a distinguished road
Default

All the components listed here:

http://framework.zend.com/manual/en/

I'm assuming that those are the class names. If I wanted to use the Zend_Mail compnent, I would do:

Zend_Loader::loadClass('Mail');

Correct?
9three is offline  
Reply With Quote
Old 01-13-2009, 11:22 PM   #4 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

It would be:

php Code:
Zend_Loader::loadClass('Zend_Mail');

The class names basically follow their directories. Take Zend_Mail. Just by looking at its class name I can tell it's in Zend/Mail.php. Everything in Zend follows this structure.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Zend Studio code completion framework Devels General 1 09-06-2008 05:04 PM
PHP and Zend smrtalex Absolute Beginners 0 08-12-2008 09:02 PM
Anybody familiar with Zend Studio? delayedinsanity General 12 07-07-2008 01:50 PM
Zend Framework in Action (book) freenity The Lounge 2 04-06-2008 11:12 AM
Zend Coding Guidelines sketchMedia General 2 11-14-2007 10:53 AM


All times are GMT. The time now is 11:33 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design