zend-framework

new Zend_Loader_Autoloader not finding files

I just upgraded from ZF 1.7 to ZF 1.9, and almost everything works fine... except for Autoloader. Old: require_once('Zend/Loader.php'); Zend_Loader::registerAutoload(); New: require_once 'Zend/Loader/Autoloader.php'; $loader = Zend_Loader_Autoloader::getInstance(); $loader->registerNamespace('MySiteName_'); $loader->setFal...

MVC model where to put data specific checks

I'm writing my first application with Zendframework. My question is about the Model–View–Controller (MVC) architectural pattern. I currently have a model with refer to a database table. Here's the classes that I currently have : Model_Person Model_PersonMapper Model_DbTable_Person Now, I see a lot of examples on the net, but all of...

Spaces in filename in Zend Framework action similar to readfile

I grabbed this bit of code from the PHP.net readfile page: <?php // Action controller public function someAction() { $response = $this->_response; // Disable view and layout rendering $this->_helper->viewRenderer->setNoRender(); $this->_helper->layout()->disableLayout(); // Process the file $file = 'whatever....

Application-wide locales with Gettext and Zend_Translate?

I have a custom directory, eg /www/phpstuff which is in my include_path. Inside of this phpstuff directory is a folder i18n. It contains server-side level .mo files. Zend_Translate lets you specify a directory in the second parameter of the constructor, I can't really do Zend_Translate( 'gettext', 'i18n/', 'en' ); It tries to read f...

Zend Db avoiding sql injections

Hi, I have the following code: public function checkLoginDetails($email, $password) { $select = $this->select (); $select->where ( "password=?", md5($password) ); $select->where ( "email=?", $email ); return $this->fetchRow($select); } email and password come directly from the user. Do I need to filter email with, say, mysql_real...

How to do file uploads with PHP and the Zend Framework?

I am using Zend Framework 1.9.6. I think I've got it pretty much figured out except for the end. This is what I have so far: Form: <?php class Default_Form_UploadFile extends Zend_Form { public function init() { $this->setAttrib('enctype', 'multipart/form-data'); $this->setMethod('post'); $description ...

Is my OpenID correct?

Evening all. I'm implementing OpenID using the Zend Framework and Zend Auth. All is working fine except i'm a little worried that i might be storing an incorrectly modified OpenID against a user. I'm in testing mode at the moment, so i'm authenticating using my own Yahoo! OpenID. Yahoo! says my OpenID is this: "https://me.yahoo.com/a/...

Problems with setting the path for Zend framework, needed for Youtube API

Hi I copied & pasted this text here. It seems the editor seems to format some parts randomly. ;) I downloaded ZendGdata 1.9.6, extracted it & uploaded it to my site's root folder ..., which I need for use with Youtube API to get videos onto my site. I must say I’m new to all this, and so I would appreciate taking this into account. Th...

Zend Framework, Doctrine Help needed

i am following the tutorial from http://www.zendcasts.com/introducing-doctrine-1-2-integration/2009/11/ i have a doctrine.php that "bootstraps?" doctrine ... sry i dont really fully understand the tut yet // Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . ...

Best practice to create absolute URLs with Zend framework?

Is there a best practice for creating absolute URLs using the Zend framework? I wonder if there is some helper or if this would just be concatenating the scheme, host, etc. from the $_SERVER variable and then add the relative path generated by Zend. ...

Zend: index generation and the pros and cons of Zend_Search_Lucene

I've never came across an app/class like Zend Search Lucene before, as I've always queried my database. Zend_Search_Lucene operates with documents as atomic objects for indexing. A document is divided into named fields, and fields have content that can be searched. A document is represented by the Zend_Search_Lucene_Do...

PHP: Storing file locations...what if overwritten?

I am currently using the Zend Framework and have an upload file form. An authenticated user has the ability to upload a file, which will be stored in a directory in the application, and the location stored in the database. That way it can be displayed as a file that can be downloaded. <a href="/upload-location/filename.pdf">Download</a>...

PHP, Zend Framework: How to set the upload max filesize?

I'm setting the upload max filesize in my form: $file = new Zend_Form_Element_File('file'); $file->setLabel('File to upload:') ->setRequired(true) ->addValidator('NotEmpty') ->addValidator('Count', false, 1) ->addValidator('Size', false, 10485760) //10MB = 10,485,760 bytes ->setMaxFileSize(10485760) ->setDestinat...

Zend Framework load plugin

I am trying to load a Plugin but I get the following error: Fatal error: Class 'Site_Plugin_ViewSetup' not found in C:\dev\library\Zend\Application\Resource\Frontcontroller.php on line 92 I configured the file (last line): [production] includePaths.library = APPLICATION_PATH "/../lib" bootstrap.path = APPLICATION_PATH "/Boot...

PHP: How to rename a file uploaded with Zend_Form_Element_File?

Form: //excerpt $file = new Zend_Form_Element_File('file'); $file->setLabel('File to upload:') ->setRequired(true) ->addValidator('NotEmpty') ->addValidator('Count', false, 1) ->setDestination(APPLICATION_UPLOADS_DIR); $this->addElement($file); Controller: //excerpt if ($form->isValid($request->getPost()) { $newFi...

Zend DB Select with multiple table joins

Hey all, Trying to replicate the following query using Zend_Db_Select. Any pointers? SELECT compounds.id as compounds_id, reactions.id as reactions_id, reaction_compound.number as reaction_compound_number FROM compounds, reactions, reaction_compound WHERE compounds.id IN (68,74,112) AND compounds.id = reaction_compoun...

Change Module Name in Zend Framework

ZF 1.9.6 Trying to change the module based on the user agent of the request. When I try to get the request object from the Front, I get NULL. Currently I'm trying to set the module name from the Bootstrap _initModule method I created. $front = Zend_Controller_Front::getInstance(); $request = $front->getRequest(); // This is NULL $reque...

Zend Framework: How to execute the code from a different action?

This is what I want to do: class IndexController extends Zend_Controller_Action { public function indexAction() { //some code $this->view->var = 'something'; } public function differentAction() { //here, I want to execute the indexAction, but render the differentAction view script } } H...

Zend Framework: Error in my database query syntax, please help!

I keep getting this error in my application and can't figure out what it means and where it's happening. I know it's in one of my models but I don't understand the error. SQLSTATE[HY093]: Invalid parameter number: no parameters were bound Have you ever run into this problem? Update: I think I've narrowed it down to this code: $db = ...

Zend Framework: error_reporting

Could anyone tell me where to place error_reporting(E_ALL) on a ZF production site? I'm thinking it should go in application/default/bootstrap.php but it's not logging anything in the error_log file located in htdocs/logs. the file is there but it remains empty. the access_log file in the same dir does get new entries. The rights of er...