I'm having a problem using a helper in cakephp. Helper has an error loading an element into a plugin.
how to run this function below inside the above array. For in the example I got on the internet is exactly like that and nobody accused any problem.
Can someone help me?
ShortcodeHelper.php
<?php
App::import('Helper', 'Html', 'Router');
class ShortcodeHelper extends AppHelper {
public $shortcodes = array(
'slideshow' => '/(\[slideshow=)(.+?)(\])(.+?)(\[\/slideshow\])/'
);
public $returncodes = array(
'slideshow' => $this->render('/elements/slideshow', array('id'=>'\\2'))
//'slideshow' => '<strong rel="\\2">\\4</strong>'
);
public function render($content, $render=null) {
$shortcodes = $this->shortcodes;
$returncodes = $this->returncodes;
if(isset($render)) {
$temp_shortcodes = array();
$temp_returncodes = array();
foreach ($render as $key => $value) {
$temp_shortcodes[$key] = $shortcodes[$value];
$temp_returncodes[$key] = $returncodes[$value];
}
$returncodes = $temp_returncodes;
$shortcodes = $temp_shortcodes;
}
$return = preg_replace($shortcodes, $returncodes, $content);
return $this->output($return);
}
}
Error
Parse error: syntax error, unexpected '$this' (T_VARIABLE) in /home/testsite/public_html/app/Plugin/Slideshow/View/Helper/ShortcodeHelper.php on line 11
thanks in advance