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

Register custom trigger word ?

Development and Programming

evasion's avatar
evasion
58 posts
17 years ago
evasion's avatar evasion

Hello all,

Is it possible to register some custom trigger word ? I want to do something like that :

when accessing to mysite.com/word it automaticly load the ‘word’ module.

Thanks in advance for your help !

       
evasion's avatar
evasion
58 posts
17 years ago
evasion's avatar evasion

Thanks for your reply it worked. Just another question please : is it possible to do something like this :

Assuming page is a template group, and word my custom trigger :

mysite.com/page/ display the “page/index” template (actually normal in EE) mysite.com/page/word run my custom code but do not parse template.

In fact I’m wanting to disable the template parsing in this case. Is it possible ?

Thanks in advance !

       
gridonic's avatar
gridonic
231 posts
17 years ago
gridonic's avatar gridonic

I don’t see why not, in this case you’d be checking against segment_2 in your module hook and not segment_1.

       
evasion's avatar
evasion
58 posts
17 years ago
evasion's avatar evasion

When using sessions_start hook I guess I can’t access the whole $SESS class in my custom hook ? Will it change something if I use sessions_end hook instead ?

       
evasion's avatar
evasion
58 posts
17 years ago
evasion's avatar evasion

You’re right Victor, I can’t access $SESS data. In order to gain speed, I’ve directly modified core.system.php to add this test :

} elseif (in_array($IN->fetch_uri_segment(1), preg_split('/\|/', 'MYTRIGGER'))) {
    require PATH_MOD.'my_module/mod.my_module'.EXT;
    $MY = new My_module();
}

It’s easier, and all the EE class are loaded 😊

Thanks for your support !

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
17 years ago
Leevi Graham's avatar Leevi Graham

You can access the SESS object and modify it using a reference.

<pre><code> /** * Checks the url to see if the last segment matches one of the languages defined in the extension settings. */ function sessions_start(&$obj) { global $IN, $PREFS, $SESS;

    // if this is a page request
    if(REQ == "PAGE")
    {
        // get the subdomain
        $domains = explode(".", $_SERVER['HTTP_HOST']);
        $segs = explode("/", $_SERVER['PHP_SELF']);
    }
}[/code]

That might help?

       
evasion's avatar
evasion
58 posts
17 years ago
evasion's avatar evasion

Thanks Leevi but I’ve found my solution 😊

Regards,

       

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.