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?
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_formIf 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?
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?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.