Jump to:

1851 Posts in 1606 Topics by 561 members

Blog Module

SilverStripe Forums » Blog Module » BlogHolder_Controller problem

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 358 Views
  • Josua
    Avatar
    Community Member
    86 Posts

    BlogHolder_Controller problem Link to this post

    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.

    358 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.