Index: core/kernel/nparser/nparser.php =================================================================== --- core/kernel/nparser/nparser.php +++ core/kernel/nparser/nparser.php @@ -1038,15 +1038,17 @@ * skip_prefix_id:[,,] - exclude id-based serial for given prefix(-es) * var:[,,] - include request variable value(-s) * skip_var:[,,] - exclude request variable value(-s) + * param:[,,] - include template parameter value(-s) + * skip_param:[,,] - exclude template parameter value(-s) * (%variable_name) - include request variable value (only value without variable name ifself, like in "var:variable_name") * [%SerialName%] - use to retrieve serial value in free form */ // 3. get variable names, prefixes and prefix ids, that should be skipped - $skip_prefixes = $skip_prefix_ids = $skip_variables = Array (); + $skip_prefixes = $skip_prefix_ids = $skip_variables = $skip_params = Array (); foreach ($keys as $index => $key) { - if (preg_match('/^(skip_var|skip_prefix|skip_prefix_id):(.*?)$/i', $key, $regs)) { + if (preg_match('/^(skip_var|skip_param|skip_prefix|skip_prefix_id):(.*?)$/i', $key, $regs)) { unset($keys[$index]); $tmp_parts = explode(',', $regs[2]); @@ -1055,6 +1057,10 @@ $skip_variables = array_merge($skip_variables, $tmp_parts); break; + case 'skip_param': + $skip_params = array_merge($skip_params, $tmp_parts); + break; + case 'skip_prefix': $skip_prefixes = array_merge($skip_prefixes, $tmp_parts); break; @@ -1068,23 +1074,37 @@ $skip_prefixes = array_unique($skip_prefixes); $skip_variables = array_unique($skip_variables); + $skip_params = array_unique($skip_params); $skip_prefix_ids = array_unique($skip_prefix_ids); // 4. process keys foreach ($keys as $key) { - if (preg_match('/^(var|prefix|prefix_id):(.*?)$/i', $key, $regs)) { + if (preg_match('/^(var|param|prefix|prefix_id):(.*?)$/i', $key, $regs)) { $tmp_parts = explode(',', $regs[2]); switch ($regs[1]) { case 'var': - // format: "var:country_id" will become "country_id=" + // format: "var:country_id" will become "r:country_id=" $tmp_parts = array_diff($tmp_parts, $skip_variables); foreach ($tmp_parts as $variable_name) { $variable_value = $this->Application->GetVar($variable_name); if ($variable_value !== false) { - $parts[] = $variable_name . '=' . $variable_value; + $parts[] = 'r:' . $variable_name . '=' . $variable_value; + } + } + break; + + case 'param': + // format: "param:country_id" will become "p:country_id=" + $tmp_parts = array_diff($tmp_parts, $skip_params); + + foreach ($tmp_parts as $param_name) { + $param_value = $this->GetParam($param_name); + + if ($param_value !== false) { + $parts[] = 'p:' . $param_name . '=' . $param_value; } } break; @@ -1128,11 +1148,11 @@ } elseif ($key == 'currency') { // based on current currency - $parts[] = 'curr_iso=' . $this->Application->RecallVar('curr_iso'); + $parts[] = 's:curr_iso=' . $this->Application->RecallVar('curr_iso'); } elseif ($key == 'groups') { // based on logged-in user groups - $parts[] = 'groups=' . $this->Application->RecallVar('UserGroups'); + $parts[] = 's:groups=' . $this->Application->RecallVar('UserGroups'); } elseif ($key == 'guest_only') { // we know this key, but process it at method beginning