Search

Basically what I wanna do is to add sessionmonster key-value pairs to the page parameter pool

I came up with a little extension that would do the job:

    public function getSubscribedDelegates(){
        return array(
                    array(
                        'page' => '/frontend/',
                        'delegate' => 'FrontendParamsResolve',
                        'callback' => 'addSessionValuesToPageParam'
                    ),                      
        );
    }   

    public function addSessionValuesToPageParam($context){

        if(!is_array($_SESSION[__SYM_COOKIE_PREFIX__ . '-sessionmonster']) || empty($_SESSION[__SYM_COOKIE_PREFIX__ . '-sessionmonster'])) return NULL;         

        foreach($_SESSION[__SYM_COOKIE_PREFIX__ . '-sessionmonster'] as $key => $val){
            if(strlen($val) <= 0) continue;     
            $context['params']['session-' . $key] = $val;
        }           
    }

The problem is, that (I assume that this is true) custom events are triggered after the 'FrontendParamsResolve' delegation and so my extension grabs only previous session values.

Is there a way I can get around this?

Kind Regards, Thomas

Sure, use the FrontendParamsPostResolve delegate, which is identical to FrontendParamsResolve except that it is fired after the Events and Datasources have run their course

head -> desk

Thanks a lot. :D

Damn, FrontendParamsPostResolve works fine, but wouldn't allow to filter DS, because (as you mentioned it ) it is fired after DS creation.

Hm...

(anyone interested adding a FrontendParamsPreResolve delegation to the frontpage class ? :D)

Any reason why the custom events don't add params to the pool themselves?

Good Point.

calling Frontend::Page()->_param[$key] = $val; from within the __trigger method is what I was looking for.

Thanks again.

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