Je veux passer le paramètre avec mon action add.that si le propriétaire dans l'élément de menu est cliqué, alors "is_owner" devrait être réglé par défaut sinon reset..along avec "add" voulez envoyer un paramètre de plus et y accéder dans view.this est Dispatcher demande.php + zend..pass paramètre dans la requête
$ routeur-> carte ('Société', 'Société', tableau ('controller' => 'entreprises', 'action' => 'ajouter'));
$router->map('people', 'people', array('controller' => 'people', 'action' => 'index'));
$router->map('people_archive', 'people/archive', array('controller' => 'people', 'action' => 'archive'));
c'est Ajouter une action en classe contrôleur
function add() {
if($this->request->isApiCall() && !$this->request->isSubmitted()) {
$this->httpError(HTTP_ERR_BAD_REQUEST, null, true, true);
} // if
if(!Company::canAdd($this->logged_user)) {
$this->httpError(HTTP_ERR_FORBIDDEN, null, true, $this->request->isApiCall());
} // if
$company = new Company();
$options = array('office_address', 'office_phone', 'office_fax', 'office_homepage','office_is_owner');
$company_data = $this->request->post('company');
$this->smarty->assign(array(
'company_data' => $company_data,
'active_company' => $company,
));
if ($this->request->isSubmitted()) {
db_begin_work();
$company = new Company();
$company->setAttributes($company_data);
$company->setIsOwner(false);
$save = $company->save();
if($save && !is_error($save)){
foreach($options as $option) {
$value = trim(array_var($company_data, $option));
if($option == 'office_homepage' && $value && strpos($value, '://') === false) {
$value = 'http://' . $value;
} // if
if($value != '') {
CompanyConfigOptions::setValue($option, $value, $company);
} // if
} // foreach
db_commit();
if($this->request->getFormat() == FORMAT_HTML) {
flash_success("Company ':name' has been created", array('name' => $company->getName()));
$this->redirectToUrl($company->getViewUrl());
} else {
$this->serveData($company, 'company');
} // if
} else {
db_rollback();
if($this->request->getFormat() == FORMAT_HTML) {
$this->smarty->assign('errors', $save);
} else {
$this->serveData($save);
} // if
} // if
} // if
} // add
plz plz plz help me
J'ai essayé la façon dont j'ai besoin d'accéder à la valeur dans la classe de contrôleur. Comment dois-je accéder? – Ekta
quelqu'un pls m'aider avec ça ... – Ekta