So I have tried to get the action ID two ways:
$ACT_ID = $this->EE->functions->fetch_action_id("classname", "function");
$ACT_ID = $FNS->fetch_action_id("classname", "function");
but, it still gives me this as the output:
{AID:classname:function}
and it doesn't parse it when its output into the view. Is there something else I need to do?
For EE2, there are 2 ways of getting an ACT ID, depending on where you're going to use it.
If you're using it in the font-end / templates, use $this->EE->functions->fetch_action_id('class', 'method');
, which will return {AID:class:method}
in the template, which the template parser in turn will replace with the actual ACT ID. This is done for performance reasons; only 1 query for all ACT IDs is needed. If no valid ACT ID is found, the AID string will remain as is in the template.
If you're using it in the back-end / Control Panel, use $this->EE->cp->fetch_action_id('class', 'method');
, which returns the actual ACT ID. The $this->EE->cp
object is only available in the Control Panel (for example, the mcp.your_module.php
file). If no valid ACT ID is found, it will return FALSE
.