Pages

Showing posts with label view. Show all posts
Showing posts with label view. Show all posts

Sunday, August 24, 2014

Zend-Using ZendX library in Zend

Recently I had to use Jquery UI components in one of my applications.I used ZendX Library to counter the same and I worked upon the same as the same as follows

 In bootstrap.php

       protected function _initJquery() {  
     $view = Zend_Layout::startMvc()->getView();  
     $view->addHelperPath("ZendX/JQuery/View/Helper",  
                 "ZendX_JQuery_View_Helper"  
                );  
     Zend_Controller_Action_HelperBroker::addHelper(  
               new ZendX_JQuery_Controller_Action_Helper_AutoComplete()  
                );  
     $view->jQuery()  
        ->enable()  
        ->setVersion('1.11.0')  
        ->setUiVersion('1.10.4')  
        ->addStylesheet('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-lightness/jquery-ui.css')  
        ->uiEnable();  
   }  

In View

 <?php  
 $this->jQuery()->addJavascriptFile($this->baseUrl().'/assets/js/validation/jquery.validate.min.js');  
 $this->headScript()->prependFile($this->baseUrl().'/assets/js/validation/myvalidation.js');  
 ?>  

Layout

 <?php   
 echo $this->jQuery();  
 echo $this->jQuery()->uiEnable();  
 echo $this->headScript();  
 echo $this->headLink();  
 echo $this->headTitle('My Website');  
 ?>  

Sunday, May 12, 2013

Zend-Adding/Appending an element in a control in block

$form->submit->setDecorators(

 array(
             'ViewHelper',
              array(
                   array('data'=>'Html Tag' ),
                   array('placement'=>Zend_Form_Decorator_Abstract::PREPEND),
                    'tag'=>'span',
                    'class'=>'wp_submit'
                      ),
               array(
                    array(array('data'=>'Html Tag')),
                    array('tag'=>'span','class'=>'newspan')
                      )
        )

)

Monday, May 6, 2013

Social Engine 4-Fetching and displaying a menu from backend

1. Create a menu from admin backend by going to Layout->Menu Editor from menu

2. Now go to database and in table "engine4_core_menus" find the entry for your menu and give the same name under "name" field(if already not there)

3. Now in controller to assign the menu to a view variable use

 $this->view->navigation=Engine_Api::_()->getApi('menus','core')->getNavigation('credit_main');  

where 'credit_main' is the 'name' of your menu from table "engine4_core_menus"

To render menu in view use


 echo $this->navigation()->menu()->setContainer($this->navigation)->render();  



Friday, May 3, 2013

Social Engine 4-Get User Info

$user_id=Engine_Api::()_->user()->getviewer()->getIdentity();

$user_info=Engine_Api::_()->user()->getUser($user_id);

Then you get an array $user_info

Now to get let us suppose email of user we use

$user_info['email'];

print_r($user_info) to get data array and check other key's

The other keys are


  1. user_id
  2. email
  3. username
  4. displayname
  5. photo_id
  6. status
  7. status_date
  8. password
  9. salt
  10. locale
  11. language
  12. timezone
  13. search
  14. show_profileviews
  15. level_id
  16. invites_used
  17. extra_invites
  18. enabled
  19. verified
  20. approved
  21. creation_date
  22. creation_ip
  23. modified_date
  24. lastlogin_date
  25. lastlogin_ip
  26. update_date
  27. member_count
  28. view_count