Calling controller method that generate the form_builder in template.

edited January 2013 in Modules
Good evening,
I have a question about calling the controller method that return a form_builder html to my "_layout/footer.php" please.

I would like to ask for your opinion about the best way to implement this.
I like the post checking method that come with fuel and this form will be use in another template as well.

Thank you.

Comments

  • edited 10:52AM
    You could possibly add a hidden field to the form that contains the value of the current page (current_url()) which tells where the form can redirect back to upon success or error. Error messages would need to be put in to a flash message.
  • edited 10:52AM
    If I would like to call a method from one of the controller and use this in the _variables/global.php like,

    $CI =& get_instance(); /* Email Form */ $CI->load->controller('send_email'); $vars['email_form'] = $CI->send_email->generate_email_form();

    Then I can use this email_form variables in my templete?

    When I try this code, it gave me an error said call to undefined method.

    What would you suggest me to be able to pass the method from my controller into the _variables?

    Thank you.
  • edited 10:52AM
    You can't load controllers like that. You need to set send_email as a library and load it as a library instead:
    $CI =& get_instance(); /* Email Form */ $CI->load->library('send_email'); $vars['email_form'] = $CI->send_email->generate_email_form();
Sign In or Register to comment.