3

this is a handler for building 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 system module class in which i've 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 with hte name index_client,index_owner...both method has 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 */ 

Which inturn calls smarty template named index_owner,index_client. I want that only one template should be called that is "index" because same things are being displayed only one flag in template is checked "is_owner" and according to that display of company is done..please tell me how flow goes like handlers,controller,module,view ??????

2
  • 1
    This is highly dependent on your structure, but probably you'll have on handler (e.g. index.php) processing all requests and calling the appropriate functions on the controller and view - you need to check if it's your router calling the view or the controller. Could you provide more info on your structure? Commented Jan 10, 2011 at 12:11
  • Agreed. A traditional MVC controller (Zend Framework) has all of this behind the scenes functionality built in. In your case, you need to design how $smarty->display("template.tpl"); is going to be called. It is going to completely depend on how you have your runtime environment setup and have nothing to do with the way PHP inherently handles things. Commented Jan 13, 2011 at 19:22

1 Answer 1

1

You must assign the METHOD magic constant to smarty resource. After you do this, customize Smarty::fetch method to catch and renderize if this attribute is seted.

If you has using url rewrite and method name is into url. You can get this through the Smarty.

This feature is native in zend framework mvc implementation. Check this.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.