I'd find it very useful to be able to use hook_simpleads_order() to order ads contextually, based on the node ID, and possibly other criteria. I'm willing to write the code for the diff, but first I'd like to know if there is interest in adding this type of a feature to simpleads.
Adding this functionality is as simple as alter the current simpleads_order hook to allow for one more parameter - e.g. the nid. Hooking into the system to access the new parameter would then be a simple call to drupal_ad_js(). For example, to give your custom ordering function access to the nid of the node requesting ads, you might use something like this:
drupal_add_js(array('couponsAndOffers_simpleads_menu' => array('simpleads_custom_crit' => arg(1))), 'setting');}
simpleads.js would detect the simpleads_custom_crit value and include it as the final parameter to the simpleads/load menu item. The simpleads_order (or simpleads_order_custom) hook would then have access to the (e.g.) nid of the page requesting the ads.
A modification of this nature would dramatically increase the power and flexibility of the simpleads ordering API.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | simpleads-custom_ordering_criteria-1929684-1.patch | 5.25 KB | jbulcher |
Comments
Comment #1
jbulcher commentedHere's a pretty straightforward patch, including updates to the API. The patch is working for me.
Comment #2
jbulcher commentedComment #2.0
jbulcher commentedrefine my idea
Comment #3
minnur commented