We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Mythological EE Actions Table

Development and Programming

Eric Barnes's avatar
Eric Barnes
487 posts
15 years ago
Eric Barnes's avatar Eric Barnes

I am slowly learning the EE 2.0 module system and something I can not find much information on is the mythological actions table. Neither the module tutorial or documentation really outline much about it or give any good examples of using it.

My take is that it should be used for forms which is what I am after.

So I wanted to ask if anyone can share any more details on using this and maybe some simple example?

       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
15 years ago
Bjørn Børresen's avatar Bjørn Børresen

exp_actions contains rows of class + method combinations, which are called directly in index.php.

Take for instance this row:

action_id | class  | method 
8         | Member | registration_form

If you look at the EE standard registration you’ll most likely find that it is posting do /index.php?ACT=8

This means it is posting to action_id 8, which is referring to class “Member” and method “registration_form” (mod.member.php:registration_form()

Makes sense?

       
Eric Barnes's avatar
Eric Barnes
487 posts
15 years ago
Eric Barnes's avatar Eric Barnes

Yes that makes sense.

What I am after is a method in the mod file that will create the form or form template tags and then handle the post data. So I am thinking something like this:

function test()
{
    $go_to = $this->EE->TMPL->fetch_param('go_to');
    
    $base_url = $this->EE->functions->fetch_site_index(0, 0).QUERY_MARKER.'ACT='.$this->EE->functions->fetch_action_id('Module', 'test');
    
    $this->EE->load->helper(array('form', 'url'));

    $this->EE->load->library('form_validation');
    
    $this->EE->form_validation->set_rules('test', 'lang:my_lang', 'required');
    
    if ($this->EE->form_validation->run() == FALSE)
    {
        // would need to actually create tagdata and options.
        $output = $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $variables); 
        return $output;
    }
    else
    {
        // Update the db and redirect to other theme.
        redirect($go_to);
    }
}

I am getting the logic right?

       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
15 years ago
Bjørn Børresen's avatar Bjørn Børresen

Yepp, you can do it like that, but there is a $this->EE->functions->form_declaration() method you can use also.

Have a look at mod.member_register.php and the registration_form() function.

       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
15 years ago
Bjørn Børresen's avatar Bjørn Børresen

btw I prefer having one method to create the form tag (e.g. {exp:mymodule:create_form}) and then another one that will recieve the form submission (listed in exp_actions).

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.