How to add some html/js code to pages via hooks

From aMember Pro Documentation
Revision as of 06:01, 5 October 2012 by Caesar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Create /amember/application/configs/site.php with this code:

Am_Di::getInstance()->hook->add(Am_Event::AFTER_RENDER, 'addTextAbove');
 
function addTextAbove(Am_Event_AfterRender $event)
{
    if (preg_match('#^/amember/helpdesk/index.*#i', $_SERVER['REQUEST_URI'])) //do it only for specific url
    {
        $event->replace('#(<h1>Tickets.*</h1>)#i', '$1<div>Some content</div>');
    }
}