Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Blog Module /

Discuss the Blog Module.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

BlogHolder_Controller problem


Go to End


1069 Views

Avatar
Josua

Community Member, 87 Posts

27 February 2012 at 8:49pm

Edited: 27/02/2012 8:53pm

Hi!

I added a function (FormLang) to the Page_Controller class (mysite/code/Page.php), to call it from the template.

class Page_Controller extends ContentController {
protected function FormLang() {
    // ......
    $send = new FormAction('changelang', 'Select');
    // ......
    return new Form($this, 'FormLang', $fields, $actions, $validator);
  }

  public function changelang($data, $form) {
    // ......
    Director::redirect('/'.$pagelang);
  }
}

In themes/mysite/Layout/Page.ss
.......
$FormLang
.......

This works perfectly on any page of my site, but in the blog page fails:
The action 'FormLang' does not exist in class BlogHolder_Controller

HTML code generated for blog page:
<!DOCTYPE html>

<html lang="en-US">
  <head>
   ........
</head>
<body>
	<div id="BgContainer">
		<div id="Container">

			<div id="Header">
                
<div id="lang" class="clear">
    
<form  id="Form_FormLang" action="/blog/FormLang" method="post" enctype="application/x-www-form-urlencoded">
............
............

What can be done so that the FormLang function is also accessible from blog controller?

Thanks,

Regards,
Jose A.