Hi
I have a problem trying to do this :
Replace the value of a variable called $contentdisplay based on the value of a variable called $contenttype and this should be triggered by a link in the template.
So I tried to do it this way.
I created several tabs in cms admin using this to define the :
static $db = array(
'ActifsProduct' => 'HTMLText',
'TextProduct' => 'HTMLText',
'GestesProduct' => 'HTMLText',
'SecretProduct' => 'HTMLText',
'ImageName' => 'Text',
);
public function getCMSFields()
{
$f = parent::getCMSFields();
$f->addFieldToTab('Root.Content.ActifsProduct', new HtmlEditorField('ActifsProduct'));
$f->addFieldToTab('Root.Content.TextProduct', new HtmlEditorField('TextProduct'));
$f->addFieldToTab('Root.Content.GestesProduct', new HtmlEditorField('GestesProduct'));
$f->addFieldToTab('Root.Content.SecretProduct', new HtmlEditorField('SecretProduct'));
$f->addFieldToTab('Root.Content.Main', new TextField('ImageName'), 'Content');
return $f;
}
}
Then in my controler I did this
class ProductPage_Controller extends Page_Controller
{
public SwitchContent(){
if ($contenttype == 'content01')
{$contentdisplay = $this ->TextProduct};
elseif ($contenttype == 'content02')
{ $contentdisplay = $this ->GestesProduct};
elseif ($contenttype == 'content03')
{ $contentdisplay = $this ->SecretProduct};
else {$contentdisplay = $this ->ImageName};
return $contentdisplay
}
}
finally in my template I got this
<% control SwitchContent %>
<div id="NavDescriptif">
<li><a href="$Link?$contenttype='content01' " class="$LinkingMode">content01</a></li>
<li><a href="$Link?$contenttype='content02' " class="$LinkingMode">content02</a></li>
<li><a href="$Link?$contenttype='content03 " class="$LinkingMode">content01</a></li>
$contentdisplay
<% end_control %>
[c/ode]
I really need a hand on this because my project is stuck...
I get a syntax error on the php code part
Thanks a lot for your help