Search

Hey guys ,

I am trying to create a new env_->parameter from a custom event using:

$this->_env['param']['date-product]  = date('d-m-Y', $nextDate);

However as soon as i go to the next page and try to access the ?debug=params my parameter is not there....

Giving a var dump on my event i can see the data there but seems like Symphony replace everything in the next page.

thoughts, helps?

Regards. Andre.

Hi Andre,

The parameter you create from an Event is only valid for a single page. (on which your event is running). Unless your event runs on every page and stores the above data it will not work.

I would suggest that you use your event to store session data & then use a delegate in your extension to actually display the value across all pages. (if I understood correctly)

Not sure if i did in the correct way however did work fine for my needs.

Please symphony guys, correct me if i was wrong and there is a better way to do it.

Everything that i need is to use a param on my next pages...

Inside my Custom Event i have inserted in the middle of my code inside the _trigger();

$_SESSION['MY_PARAM_NAME'] = (string)$string;

Now, on my load() before the if(isset($_POST['action']['my-action'])) return $this->__trigger();

i have inserted:

    if($_SESSION['MY_PARAM_NAME']) {
       Frontend::instance()->Page()->_param['ErrorMessage'] = $_SESSION['MY_PARAM_NAME'];
    }

That worked :)

Now i have the parameter that i need in the next couple of pages.

Cheers.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details