zend-framework

Appending or Prepending HTML Tags to Zend Form Element

For the purposes of styling I have the need to put an opening <div> at the beginning of one element, and a closing </div> tag at the end of another. Looking over the docs for HtmlDecorator I can't seem to figure out how to get it right, or if this is even the right decorator to use. It seems wasteful to have to create my own decorator si...

How to set controller/action to Page Not Found

I have a controller and action which I'm accessing through a custom URL. The original route is still accessible though at the default location zend.com/controller/action How can I change this to simulate a "Page not found" when the user tries to access this URL? Is it possible? ...

Storing static text for Zend Framework frontpage

I'm working on a small website and need to display blocks of static text on the front page. These blocks will be styled later as paragraphs or bullets and so on. Where do you suggest I store this text? Do they go as variable in each view where they are used? I could do that, but I'd prefer to have a central location for all this text. ...

How do I call other Controllers within a Zend Framework Process and retrieve their rendered view?

Hi there, I have the following setup: An endless running PHP process that looks at a job queue which contains module names, controller names, action names and a parameter array. For every job I want to call the given controllers action and retrieve the rendered view for further processing. I was thinking about bootstrapping an instan...

logged out when form get submitted..... Strange problem

I am facing strange problem. I have form which has lots of hidden field and text field and one file field. And there are total six fields for selecting tagging on file which is to be uploaded. When user select less parameter or less tags then form get submitted properly. but when user select more parameters in all six fields and submit ...

Zend framework modules and Reflection

Hello, i'm a bit confused about modules, namespace and reflection. $obj = new default_Model_foo(); $obj->bar(); The code above runs properly, but i need to add reflection; I've got these variables: $moduleName = "default"; $modelName = "foo"; $function = "bar"; I would like to instantiate a class at runtime, how can do it? Tha...

How to use dompdf within Zend-Framework?

Hi. I have the following code inside my controller but I can't open the pdf it produces. $html = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head><body>trial</body></html>"; $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->render(); $dompdf->stream("sample.pdf"); ...

Changing Zend_Form behavior to call JS function upon submit

Hello, I would like to change the default behavior of Zend_Form, so that whenever the submit button is clicked, form submission is prevented and an arbitrary JavaScript function is called. This would be done for all forms on the site, however the actual JS function to call may change from form to form. What would be the most proper way...

using session variables in predispatch of zend framework controller gives Fatal Error

I am using zend framework v1.9.6 and written a piece of code in preDispatch method of one of the controllers as if(!isset($_SESSION['myvar']){ //do something and assign a value to the session variable } ..so that the code executes only once. However I am getting a fatal error at the end of the page everytime except for when th...

Zend_Json_Server and dojo.rpc.JsonService, can a served class return an object?

I am trying to serve up my user repository via zend_json_server. The problem is the service is returning empty objects. What have i missed? server side: $repo = App_User_Repository::getInstance(); $server = new Zend_Json_Server(); $server->setClass($repo); if ('GET' == $_SERVER['REQUEST_METHOD']) { $server->setTarget('/ser...

Control access to files available for download

I have a folder that contains uploaded documents that my ZF application can spit out to logged in users. I want them to be able to use a link like http://server/documents/filename.pdf and download the file, but I want to have a controller DocumentsController that enables the existing user cookies to verify that they are logged in and hav...

Zend_Auth - When I set a custom storage namespace it does not exist when I redirect to a new controller

In my entry controller I set: This works: $authadapter = new Test_Auth_Adapter_DbTable($db); $auth = Zend_Auth::getInstance(); $result = $auth->authenticate($authadapter); $data = $authadapter->getResultRowObject(null, 'password'); $auth->getStorage()->write($data); $this->_redirector->gotoUrl('/main'); This does not: $authadapter ...

Zend Studio + Zend Framework

How to save answers from path mapping dialog? Now, always, I need to choose about 10 files before I can start debugging my Zend Framework application. It's really irritated. I found something interesting in Window -> Preferences -> PHP Servers -> Edit -> Path Mapping but I don't know how to use it. :-( I have my Zend library in "/usr/loc...

Throwing exceptions from model/view/controller in a Zend Framework application

In the Zend Framework library, the current practice (circa 1.10.8) is that library components throw exceptions that extend Zend_Exception. E.g. the Zend_Layout component throws a Zend_Layout_Exception In my own ZF library, where I'm adding my own ZF components or extending existing components, I'm throwing a Mylibrary_Exception (it's...

Zend DB Format Subselect

Hi, I am trying to add a field via a subselect but cant figure out how to format the subquery in Zend DB. E.g. in MySql it looks like this: SELECT a.columnA, b.columnB, **(SELECT c.columnC FROM tableC c WHERE c.test = 1) AS total** FROM tableA AS a INNER JOIN tableB on b.id = a.id The Zend DB format is: ->select() ->from(array('a'=>...

How Do I Find Common Dates/Days in Two Date Ranges ( startdate1 - enddate1) & ( startdate2 - enddate2)

I want to find out common days/dates between two periods for example [period1 - 25/10/2010 - 25-11-2010 ] and [ period2 - 10-11-2010 - 10-12-2010 ]...here 15 days 26-10 to 10-11 are common....how can I find it in PHP or Zend Framework..... Thanks in Advance...... ...

My Own PHP MVC Framework for learning purpose only

Hi, I am a great fan of Zend framework and somehow i have modified it in my own way. I have been using it from around a year but still i lack knowledge of some internal workings. So i decided to design my own framework to understand inner things. I just want from you guys to provide resources about it, articles, tutorial or any book. I...

Display data in table on a subform

Hi all, I've got a question regarding sub forms. Currently I've got 2 sub forms and one parent form. On one of the sub forms I want to get data from the model and this needs to be displayed in a table, the first column needs to have a radio button as I want to know which row has been selected. But as a table isn't a form element how ca...

how to have a normal form's action to follow zend custom routing?

Hello gurus! i've picked up zend framework and being playing with it, and here is a situation i'll like to achieve. i have default and user modules, user has a different layout user_layout that i load in predispatch of NovelsController of user modules.i have a small form in the user_layout that post dates (from and to ) to showAction...

PHP implode array to generate mysql IN criteria

I have a function like the following: public function foo ($cities = array('anaheim', 'baker', 'colfax') ) { $db = global instance of Zend_Db_Adapter_Pdo_Mysql... $query = 'SELECT name FROM user WHERE city IN ('.implode(',',$cities).')'; $result = $db->fetchAll( $query ); } This works out fine until someone passes $cities...