Hello all,
I am building a module, which will perform split_testing. I have successfully made the admin part of the module. I have the code required for split_testing but here comes the confusing part. as hook_form is used for building a form. hook_submit is used for the submit function. hook_menu is for presenting a menu on the admin part. I have some php code, which will be executed on the front page, or any page, on which the user wants to test the split_test. I have no idea where to place this code, so that the user can select on which page will this code be executed. I have two problems here
1) I have some piece of php code which needs to be executed only on pages that the user selects. where would i place this code in my module
2) There is some piece of code which needs to be executed on every page. where would i place this code in my module
If any one can help, then i will really appreciate.
Thanks
Comments
What is split_testing, ie
What is split_testing, ie what are you testing?
I need to execute some php code on a page
split test is testing the conversion rate of a page, like how many sales or visitors is it going to attract. However, that is irrelevant here. What i need to know here is what function/place does drupal provide in a module, where i can place my code so that it can be executed on a specific page. I also have some code which should be executed on every page. Kindly help me in this regard
Thanks
> I also have some code which
> I also have some code which should be executed on every page.
http://api.drupal.org/api/function/hook_init
> What i need to know here is what function/place does drupal provide in a module, where i can place my code so that it can be executed on a specific page.
You can use hook_init or http://api.drupal.org/api/function/hook_nodeapi/6 and put in simple PHP logic to determine what page is being requested.