Hello,
I’ve created a plugin in my modx to get user agent profile.
I want to execute it when user visit all of my webpage.
How to call that plugin? In the document or what?
Thank you.
-
☆ A M B ☆
- 24,524 Posts
A plugin is created in Resources -> Manage Resources, the Plugins tab. After you put your code in the plugin’s code field, go to the System Events tab and check the event you want your code to catch. The OnWebPagePrerender event is triggered just before the page is sent to the server, so that might be a good one for you to use.
This will cause your code to be executed on every page requested.
If you prefer, you can make this a snippet (Resources -> Manage Resources, the Snippets tab). Then put the snippet tags [!snippetName!] in your template.
Thanks. It works.
Can I include a plugin in another plugin?
How to do it?
Quote from: elven_ranger at Jun 09, 2009, 10:12 PM
Thanks. It works.
Can I include a plugin in another plugin?
How to do it?
Plugins are mainly meant to execute in response to particular system events, not to the execution of another plugin. You’d be better off just putting the code you need in the original plugin.
-
☆ A M B ☆
- 24,524 Posts
Plugins are automatically "called" by the parser when it reaches the point in the document generation process where the "event" you select is triggered.
http://sottwell.com/how-plugins-work.html
Or you could just paste the code into the plugin itself. Glad you got it working.