Search

I want to use in my event one parameter from parameter pool, which generated by URL-parameter of the page. How I can access it in my event?

Try dumping out the environment array:

var_dump($this->_env);die;

This should contain the URL parameter values.

(Annoyingly there is no formal accessor for this, it's undocumented.)

Cool, thanks!

$this->_env isn't totally undocumented ;)

Frontend::instance()->Page()->_param also works too

New issue. How to access parameters from datasource (ds-xxxx)? It's no in $this -> _env array.

Is it in the $param_pool that's passed to the grab function in a data source? Events run before data sources, so you can only get data source output parameters in other data sources.

Hm, I'm confused. I trying to change "publish article" event. In my form I have only "title" and "body" field. But in my section I also have "category" field, which will pass id of article's category. I want to get id of category, using some url parameter, which contains handle of category. As you say, I can't use datasources. I see no way to do this. How to get id of category from url in my event?

I don't fully understand your problem, Flex but here's my attempt to help:

Indeed, you cannot get the ID of your category if the ID is not passed through the URL anywhere. Your best best would be to post the ID of the category as a hidden input value to your "Publish article" event.

Yes, it's not bad way. But I don't like hidden fileds in this case. Because, ID of category can be changed on the page through some tool like Firebug. So, I prefer to pass name of category through the URL and in my event I get ID of category from database by category handle. What you think? Is this good solution?

You can use $this->_env. The Datasource class also has that variable.

array(2) {
    ["env"]=>
        array(1) {
            ["pool"]=>
            array(1) {
                ["ds-member-content"]=>
                array(1) {
                    [0]=> string(2) "72"
                }
            }
        }
    ["param"]=>
        array(23) {

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