GGshow reloaded GGshow reloaded

July 4, 2012

Zend Framework – CLI – Module

  • Create module
    zf create module <moduleName>
  • Create dbTable class in module
    zf create db-table <className> <tableName> <moduleName>
  • Create model in module
    zf create model <mapperName> <moduleName>
  • Create controller in module
    zf create controller <controllerName> index-action-included[=1] <moduleName>
  • Create form in module
    zf create form <formName> <moduleName>
  • Create action in module
    zf create action <actionName> <controllerName>[=Index] view-included[=1] <moduleName>
  • Create view in module
    zf create view <controllerName> <actionName> <moduleName>
Filed under: PHP,Web,Zend Framework — Tags: , , , , , , , , — GG @ 2:50 pm

Zend Framework – View

To get the view object

  1. witin view script
    $view = $this;
  2. within action controller
    $view = $this->view;
  3. within bootstrap
    $this->bootstrap(‘view’);
    $view = $this->getResource(‘view’);
  4. within resource plugin
    $this->getBootstrap()->bootstrap('view');
    $view = $this->getBootstrap()->getResource('view');
Filed under: PHP,Web,Zend Framework — Tags: , , , , — GG @ 2:30 pm

Zend Framework – View Helper – Layout

To get layout object

  • within view script
    $layout = $this->layout()
  • within action controller
    $layout = $this->_helper->layout()
    $layout = $this->_helper->getHelper(‘Layout’)->getLayoutInstance()
  • within bootstrap
    $layout = $bootstrap->getResource(‘Layout’);
  • elsewhere
    $layout = Zend_Layout::getMvcInstance();

To assign variable to layout object

$layout->var = ‘value’;
$layout->assign(‘var’, ‘value’);

To enable or disable layout

$layout->enableLayout();
$layout->disableLayout();

To enable or disable layout using CLI

zf enable layout
zf disable layout
Filed under: PHP,Web,Zend Framework — Tags: , , , , , — GG @ 2:27 pm

Zend Framework – CLI

  • Show info
    zf show < config | manifest | phpinfo | profile | project.info | version >
  • Create project
    zf create project <projectName>
  • Enable layout
    zf enable layout
  • Create dbTable class
    zf create db-table <className> <tableName>
  • Create model
    zf create model <mapperName>
  • Create controller
    zf create controller <controllerName>
  • Create form
    zf create form <formName>
  • Create action
    zf create action <actionName> <controllerName>
  • Create view
    zf create view <controllerName> <viewName>
user@ubuntu:~$ zf ?
Zend Framework Command Line Console Tool v1.11.11
Usage:
    zf [--global-opts] action-name [--action-opts] provider-name [--provider-opts] [provider parameters ...]
    Note: You may use "?" in any place of the above usage string to ask for more specific help information.
    Example: "zf ? version" will list all available actions for the version provider.

Providers and their actions:
 Version
    zf show version mode[=mini] name-included[=1]
    Note: There are specialties, use zf show version.? to get specific help on them.

 Config
    zf create config
    zf show config
    zf enable config
    Note: There are specialties, use zf enable config.? to get specific help on them.
    zf disable config
    Note: There are specialties, use zf disable config.? to get specific help on them.

 Phpinfo
    zf show phpinfo

 Manifest
    zf show manifest

 Profile
    zf show profile

 Project
    zf create project path name-of-profile file-of-profile
    zf show project
    Note: There are specialties, use zf show project.? to get specific help on them.

 Application
    zf change application.class-name-prefix class-name-prefix

 Model
    zf create model name module

 View
    zf create view controller-name action-name-or-simple-name module

 Controller
    zf create controller name index-action-included[=1] module

 Action
    zf create action name controller-name[=Index] view-included[=1] module

 Module
    zf create module name

 Form
    zf enable form module
    zf create form name module

 Layout
    zf enable layout
    zf disable layout

 DbAdapter
    zf configure db-adapter dsn section-name[=production]

 DbTable
    zf create db-table name actual-table-name module force-overwrite
    Note: There are specialties, use zf create db-table.? to get specific help on them.

 ProjectProvider
    zf create project-provider name actions

Related Articles:

Filed under: PHP,Web,Zend Framework — Tags: , , , , , , , , , , — GG @ 2:24 pm

February 3, 2012

Resource matching “view” not found

Issue:

  • [error]
    [client 127.0.0.1] 
    PHP Fatal error:  Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Resource matching "view" not found' in /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php:694
    Stack trace:
    #0 /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php(629): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('view')
    #1 /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php(586): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap('view')
    #2 /home/user/ZendFramework-1.11.11/bin/jquery/application/Bootstrap.php(7): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap('view')
    #3 /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php(669): Bootstrap->_initDoctype()
    #4 /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php(622): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('doctype')
    #5 /home/user/ZendFramework-1.11.11/library/Zend/Appli in /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php on line 694

Reason:

  • Resource matching “view” not found.

Solution:

  • Add the following line to application.ini
    resources.view[] =
Filed under: PHP,Web,Zend Framework — Tags: , , — GG @ 11:02 am

© 2024 GGSHOW | Powered by WordPress