Search Results

Search found 1652 results on 67 pages for 'zend decorators'.

Page 8/67 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Zend Framework: Autoloading module resources in config.ini?

    - by Olagato
    Is it possible, to configure the following behaviour in application.ini? <?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected function _initAdminModuleAutoloader() { $this->_resourceLoader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'Admin', 'basePath' => APPLICATION_PATH . '/modules/admin', )); $this->_resourceLoader->addResourceTypes(array( 'model' => array( 'namespace' => 'Model', 'path' => 'models' ) )); } } ?> If so, can you please show us an example? Thanks.

    Read the article

  • How do I reuse code in Zend Framework

    - by Mario
    I am working on a web application which requires the user to login before they see or do anything. No part of this app should be accessible without being logged in. (Except of course, the login controller) Currently I am using sessions to handle the authentication and I have put code in each controller in the init() function to check if their session is valid. This was a temporary workaround, but it is redundant and inefficient. I would like my init() function to be similar to the following, but I am not sure how to achieve it: public function init() { // If user not logged in redirect to login controller $myLibrary = Zend_Library_MyLibrary(); $myLibrary->CheckAuth(); } So my question really has two parts: Where is the best place to store code that will be used in multiple controllers? How do I then call that function from a controller? Thanks.

    Read the article

  • Zend Framework: Zend_DB Error

    - by Sergio E.
    I'm trying to learn ZF, but got strange error after 20 minutes :) Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'Configuration array must have a key for 'dbname' that names the database instance' What does this error mean? I got DB information in my config file: resources.db.adapter=pdo_mysql resources.db.host=localhost resources.db.username=name resources.db.password=pass resources.db.dbname=name Any suggestions? EDIT: This is my model file /app/models/DbTable/Bands.php: class Model_DbTable_Bands extends Zend_Db_Table_Abstract { protected $_name = 'zend_bands'; } Index controller action: public function indexAction() { $albums = new Model_DbTable_Bands(); $this->view->albums = $albums->fetchAll(); } EDIT All codes: bootstrap.php protected function _initAutoload() { $autoloader = new Zend_Application_Module_Autoloader(array( 'namespace' => '', 'basePath' => dirname(__FILE__), )); return $autoloader; } protected function _initDoctype() { $this->bootstrap('view'); $view = $this->getResource('view'); $view->doctype('XHTML1_STRICT'); } public static function setupDatabase() { $config = self::$registry->configuration; $db = Zend_Db::factory($config->db); $db->query("SET NAMES 'utf8'"); self::$registry->database = $db; Zend_Db_Table::setDefaultAdapter($db); Zend_Db_Table_Abstract::setDefaultAdapter($db); } IndexController.php class IndexController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ } public function indexAction() { $albums = new Model_DbTable_Bands(); $this->view->albums = $albums->fetchAll(); } } configs/application.ini, changed database and provided password: [development : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 db.adapter = PDO_MYSQL db.params.host = localhost db.params.username = root db.params.password = pedro db.params.dbname = test models/DbTable/Bands.php class Model_DbTable_Bands extends Zend_Db_Table_Abstract { protected $_name = 'cakephp_bands'; public function getAlbum($id) { $id = (int)$id; $row = $this->fetchRow('id = ' . $id); if (!$row) { throw new Exception("Count not find row $id"); } return $row->toArray(); } }

    Read the article

  • Zend Framework - Database Table Singleton

    - by Sonny
    I have found myself doing this in my code to 'cache' the work done when instantiating my Zend_Db_Table models: if (Zend_Registry::isRegistered('x_table')) { $x_table = Zend_Registry::get('x_table'); } else { $x_table = new Default_Model_DbTable_X; Zend_Registry::set('x_table', $x_table); } It bothered me that this method isn't very DRY and it dawned on me today that a singleton pattern would probably be a better way to do this. Problem is, I've never written a singleton class. When I did some web searches, I found some offhand comments about Zend_Db_Table singletons, but no real examples. I already have meta-data caching configured. How do I make my Zend_Db_Table models singletons? Are there pitfalls or downsides?

    Read the article

  • Zend Routes conflict

    - by meder
    I have defined 2 custom routes. One for threads/:id/:name and the other for threads/tags/:tagName however the second one conflicts with the first because if I enable both then the first breaks and treats :id literally as an action, not obeying the \d+ requirement ( I also tried using pure regex routes, see bottom ). Action "1" does not exist and was not trapped in __call() I tried re-arranging the order of the routes but if I do that then the threads/tags/:tagName doesnt correctly capture the tagName. I also tried disabling default routes but the routes still don't properly work after that. Here's my route init function: protected function _initRoutes() { $fc = Zend_Controller_Front::getInstance(); $router = $fc->getRouter(); $router->addRoute( 'threads', new Zend_Controller_Router_Route('threads/:id/:name', array( 'controller' => 'threads', 'action' => 'thread', ), array( 'id' => '\d+' ) ) ); $router->addRoute( 'threads', new Zend_Controller_Router_Route('threads/tags/:tagName', array( 'controller' => 'threads', 'action' => 'tags', ), array( 'tagName' => '[a-zA-Z]+' ) ) ); } I also tried using a pure regex route but was unsuccessful, most likely because I did it wrong: $router->addRoute( 'threads', new Zend_Controller_Router_Route_Regex( 'threads/(\d+)/([a-zA-Z]+)', array( 'controller' => 'threads', 'action' => 'thread', ), array( 1 => 'tagName', 2 => 'name' ) ) );

    Read the article

  • Can't retrieve more than 2 gmail messages using Zend framework imap access - server dies - doens't r

    - by Ali
    Hi guys I'm working on a google apps application. Basically I've set it up so users can add multiple gmail addresses and check on their inboxes in the application. It works fine with a google apps email address however when I add a gmail address it just dies out. I'm using this code here: $mail = new Zend_Mail_Storage_Imap($mail_options); $all_messages = array(); $page = isset($_GET['page'])?$_GET['page']:1; $limit = isset($_GET['limit'])?$_GET['limit']:20; $offset = (($page-1)*$limit)+1; $end = ($page*$limit)>$c?$c:($page*$limit); for ($i=$offset;$i<=$end;$i++){ $h2t = new html2text(); $h2t->set_allowed_tags('<a>'); if(!$mail[$i]) break; else{ $one_message = $mail->getMessage($i); $one_message->id = $i; $one_message->UID = $mail->getUniqueId($i); $one_message->parts = array(); $one_message->body = ''; $count = 1; foreach (new RecursiveIteratorIterator($mail->getMessage($i)) as $ii=>$part) { try { $tpart = $part; //$tpart->_content = ''; $one_message->parts[$count] = $tpart; $count++; // check for html body if (strtok($part->contentType, ';') == 'text/html') { $b = $part->getContent(); if($part->contentTransferEncoding == 'quoted-printable') $b = quoted_printable_decode($b); $one_message->html_body = $b; $h2t->set_html($b); $one_message->body = $h2t->get_text(); } //check for text body if (strtok($part->contentType, ';') == 'text/plain') { $b = $part->getContent(); if($part->contentTransferEncoding == 'quoted-printable') $b = quoted_printable_decode($b); $one_message->text_body = $b; $one_message->body = $b;//$part->getContent(); } } catch (Zend_Mail_Exception $e) { // ignore } } $all_messages[] = $one_message; } } No matter what the emails it dies out on retrieving just 2 emails... whats going on here?

    Read the article

  • how to delete findDependentRowset result in Zend Framework

    - by Behrang
    I have place model & entry model that entry is parent everything is fine but how can I delete the result row $categoryPlacements in place model: $entryModel = new Model_EntryModel(); $entryRow = $entryModel-find ( $entryId )-current (); $categoryPlacements = $entryRow-findDependentRowset($this); in this case i want to delete the $categoryPlacements result in place model I can use categoryPlacements-toarray() and then delete but is another easy way?

    Read the article

  • Zend Framework Custom Validation Class Error Message

    - by remlabm
    The validation fails as it should but does not return the error message. $form->addElement('text', 'phone_number', array( 'required' => true, 'validators' => array( array('NotEmpty', true, array('messages' => 'Enter a valid Phone Number')), array('regex', false, array('pattern' => '/\([0-9]{3}\)\s[0-9]{3}-[0-9]{4}/', 'messages' => 'Enter a valid Phone Number' )), 'CheckPhoneNumber'), ), )); Custom Class: class Custom_Validators_CheckPhoneNumber extends Zend_Validate_Abstract{ const IN_USE = 'inUse'; protected $_messageTemplates = array( self::IN_USE => "'%value%' is currently in use" ); public function isValid($value) { $this->_setValue($value); $user_check = Users::getActive(preg_replace("/[^0-9]/", "", $value)); if($user_check->id){ $this->_error(self::IN_USE); return false; } return true; } } Just fails does not give the "IN_USE" error.

    Read the article

  • Zend framework - duplication in translated url

    - by tomasr
    I have these URLs cz/kontroler/akce en/controller/action Is used transatable route and works it like charm. But problem is, that when you will write cz/controller/akce it works as well. In generally when you have cz/something-in-czech en/something-in-english which route to someController, will be works still cz/some en/some because it is really name of controller. How solve this duplicity content issue?

    Read the article

  • Media RSS and Zend

    - by user303774
    Hi, I have a Magento application running atop Zend framework. I like to generate Media RSS feed in Zend (In orded to feed the Cooliris application). Does anyone know if Zend framework supports Media RSS feed? (I didn't find anything in http://framework.zend.com/manual/1.10/en/zend.feed.html, but maybe I dint look in the right place?) Tx, Sty

    Read the article

  • Render view in higher script path with Zend Framework

    - by sander
    Lets assume the following code within a controller: $this->view->addScriptPath('dir1/views/scripts'); $this->view->addScriptPath('dir2/views/scripts'); $this->render('index.phtml'); Where dir1/views/scripts contains 2 files: -index.phtml -table.phtml And dir2/views/scripts: -table.phtml Now, it will render the index.phtml in dir1 since dir 2 doesn't have an index.phtml. Index.phtml looks something like: <somehtml> <?= $this->render('table.phtml') ?> </somehtml> This is where the confusion starts for me. I would expect it to render the table.phtml in the last directory added to the script path stack, but it doesn't. Is there a simple solution/explanation to my problem?

    Read the article

  • Zend Framework Db Select Join table help

    - by tester2001
    I have this query: SELECT g.title, g.asin, g.platform_id, r.rank FROM games g INNER JOIN ranks r ON ( g.id = r.game_id ) ORDER BY r.rank DESC LIMIT 5` Now, this is my JOIN using Zend_Db_Select but it gives me array error $query = $this-select(); $query-from(array('g' = 'games'), array()); $query-join(array('r' = 'ranks'), 'g.id = r.game_id', array('g.title', 'g.asin', 'g.platform_id', 'r.rank')); $query-order('r.rank DESC'); $query-limit($top); $resultRows = $this-fetchAll($query); return $resultRows; Anyone know what I could be doing wrong? I want to get all the columns in 'games' to show and the 'rank' column in the ranks table.

    Read the article

  • [Zend Framework] How to format Zend_db Rowset output?

    - by rasouza
    I have a model which is referenced to a table registries extending Zend_Db and some methods which bascially uses fetchAll() all the time. What happens is: my table has a DATE field and I'd like it to output already formated when I call $row-reg_date. Is it possible by doing something in the model or do I have to manually format?

    Read the article

  • Zend Database Adapter - Complex MySQL Query

    - by Sonny
    I have defined a function in my Navigation model that executes a query, and I was wondering if there's a more "Zendy" way of generating/executing the query. The query I'm using was proposed by Bill Karwin on another thread here for setting arbitrary record order. I tried using a prepared statement, but the values in the SIGN() function got quoted. I'm using the PDO adapter for MySQL. /** * */ public function setPosition($parentId, $oldPosition, $newPosition) { $parentId = intval($parentId); $oldPosition = intval($oldPosition); $newPosition = intval($newPosition); $this->getAdapter()->query(" UPDATE `navigation` SET `position` = CASE `position` WHEN $oldPosition THEN $newPosition ELSE `position` + SIGN($oldPosition - $newPosition) END WHERE `parent_id` = $parentId AND `position` BETWEEN LEAST($oldPosition, $newPosition) AND GREATEST($oldPosition, $newPosition) "); return $this; }

    Read the article

  • Zend Framework: How to display multiple actions, each requiring different authorizations levels, on

    - by Iain
    Imagine I have 4 database tables, and an interface that presents forms for the management of the data in each of these tables on a single webpage (using the accordion design pattern to show only one form at a time). Each form is displayed with a list of rows in the table, allowing the user to insert a new row or select a row to edit or delete. AJAX is then used to send the request to the server. A different set of forms must be displayed to different users, based on the application ACL. My question is: In terms of controllers, actions, views, and layouts, what is the best architecture for this interface? For example, so far I have a controller with add, edit and delete actions for each table. There is an indexAction for each, but it's an empty function. I've also extended Zend_Form for each table. To display the forms, I then in the IndexController pass the Forms to it's view, and echo each form. Javascript then takes care of populating the form and sending requests to the appropraite add/edit/delete action of the appropriate controller. This however doesn't allow for ACL to control the display or not of Forms to different users. Would it be better to have the indexAction instantiate the form, and then use something like $this-render(); to render each view within the view of the indexAction of the IndexController? Would ACL then prevent certain views from being rendered? Cheers.

    Read the article

  • zend one controller many views

    - by Sherif
    hi there when i build my web site it was handling only one interface but now i need to handle many interface i can detect which site to communicate and isolate it from other sites but i stuck with this : all the sites have the same views ... is there are a way so i can rander from the same controller different views .. something like application application controller model site_1_view site_2_view is this possible ??!!

    Read the article

  • Jquery/JavaScript's role in MVC (zend)

    - by user7543288
    I have my doubts if this question should have went into the programmers.stackexchange.com or not…but I would like to ask all you experienced developers out there, how do you see the connection that jquery - javascript has with the MVC. How would you explain it to a n00b? does it bridge the communication between the View and the Controller? or what? I have done my research and I believe this is the best article explaining it http://www.alistapart.com/articles/javascript-mvc/ but I would like to hear your point of view..

    Read the article

  • session set for some Actions in Zend framework

    - by user202127
    I'm working on a website , in CV part users have some articles that only logged in users can download them.I want to make changes to the log in Action or preDispatch() to set session for guess users to download the articles, can some one tell me how it can be or give me some reference links. here is my preDispatch(): public function preDispatch() { $userInfo=$this->_auth->getStorage()->read(); $identity= $this->_auth->getIdentity(); if(!$this->_auth->hasIdentity()) { return $this->_helper->redirector('login','login'); } if(!isset($userInfo["member_id"]) || strlen($userInfo["member_id"])==0) { return $this->_helper->redirector('forbidden','login'); } $this->_accessType=2; }

    Read the article

  • How to style forms in the Zend framework?

    - by user505988
    Hi, I really like the idea of putting forms into a seperate class that manages validation etc, but I don't like everything ending up in a DL and also not being able to use square bracket notation in post elements like <input type='checkbox' name='data[]'>. Is there another way of generating forms - like in views so I can style them the way I want, but also keeping the validation aspect? Also how would I load this view into my current view (using partial view somehow?)

    Read the article

  • Making a zend routes default paramaters display in the URL

    - by NaNuk
    I have a route defined as below. $route['manage-vehicles'] = new Zend_Controller_Router_Route( 'vehicles/manage/page/:page', array( 'controller' => 'vehicles', 'action' => 'manage', 'page' => '1' ) ); When the 'page' parameter is not specifically defined (e.g. in a menu constructed using the navigation component), the resultant URL is /vehicles/manage/page I would much prefer or the URL not to to display the default paramater key in this scenario i.e. /vehicles/manage Any ideas how to accomplish this would be appreciated? Thanks.

    Read the article

  • Zend Framework 1.1 Modules setup

    - by jiewmeng
    i used zend_tool to setup a project then to create module blog with index controller etc but i guess the default config setup by zend_tool does not work with modules so i edited it resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" resources.frontController.moduleDirectoryControllerName = "controllers" i guess these are required for modules? also i moved the folders, controllers, models, views into the modules/ folder but i get a blank screen when i try to go to http://servername which shld load Default module's index controller and action. even if i try to go http://servername/nonexistentpage it also shows a blank screen instead of a 404

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >