How does mvc + smarty work in php?

this is the handler for creating the menu

new MenuItem ('Owner', lang ('Owner'), assemble_url ('Owner'), get_image_url ('navigation / Company.gif')), new MenuItem ('Client', lang ('Client'), assemble_url (' Client '), get_image_url (' navigation / people.gif ')),

One class of system module in which I mapped the route

$router->map('Owner', 'Owner','null', array('controller' => 'companies', 'action' => 'index_owner'));
  $router->map('Client', 'Client','null', array('controller' => 'companies', 'action' => 'index_client'));

which calls the controller class in which methods are defined using hte name index_client, index_owner ... both methods have the same code.

function index_client(){
      if(Company::canAdd($this->logged_user)) {
   $this->wireframe->addPageAction(lang('New Company'), assemble_url('people_companies_add_client'));
  } // if 
  if($this->request->isApiCall()) {
    $this->serveData(Companies::findByIds($this->logged_user->visibleCompanyIds()), 'companies');
  } else {
    $page = (integer) $this->request->get('page');
    if($page < 1) {
      $page = 1;
    } // if  

    list($companies, $pagination) = Companies::paginateActive($this->logged_user, $page, 30);

   $this->smarty->assign(array(
     'companies' => $companies,
      'pagination' => $pagination,
    ));
  } // if
} // index   */          

inturn smarty index_owner, index_client. , , "", , "is_owner" , . , , , , , ??????

+3
1

smarty. Smarty:: fetch, , .

URL- URL-. Smarty.

mvc zend framework. .

+1

Source: https://habr.com/ru/post/1771643/


All Articles