hi guys,
How can I place a plugin in a particular page or snippet, my plugin is a OnWebPagePrerender
I am using modx revolution
thanks,
At the top of the plugin:
$id = 12; // ID of the page you want the plugin to run on
if ((int) $modx->resource->get('id') !== (int) 12) {
return '';
}
-
☆ A M B ☆
- 24,524 Posts
In any case you would have to make a comparison of some kind, then run the plugin only if the comparison returns true. Exactly what that comparison would be depends on what you want to do.
As Susan says, it's difficult to advise you without knowing what your plugin does and why it does it.
hi bob and susan thanks for your replies,
ok, my plugin log every search results in a text file then i will use it to a report to know the most search products,
I prefer not to use extras.
thanks again!
It might be easier to modify the snippet that processes the search form to record the data for you, unless you only want to record people who click on the a link in the search results, in which case you'd want the plugin to execute on the product pages that those links take them to.
In the second case, you might use a TV on those pages. The plugin can check the TV and just return without doing anything if it's not set to some value (usually a Yes/No TV which will be set to 1 or 0).
-
☆ A M B ☆
- 24,524 Posts
In the case of recording clicks to follow search results, you could use the 'REFERER' $_SERVER value to determine whether or not to log the click. If it comes from your 'search-results' page, then log it.
Or, you could even use AJAX to send information on the link being clicked to be logged. You wouldn't need a plugin at all in that case, just have the javascript on your 'search-results' page and a snippet on a resource to receive and process the AJAX request.