We have 3 Ads forms 1-Every Ad can Enable/Disable 2-Every Ad has its priority from 0 to 10 3-Every Ad may be Banners OR Html/Javascript code Need to create PHP code or function to do : 1-If Ad is enabled run it 2-run rotate banners depend on it's priority 3-if Ad type is Banner >> show banner 4-if Ad type is Html/Javascript code >> show Html/Javascript code Thanks
This all sounds like a DB / filesystem rotate-script thingamajingy. You check the DB for enabled ads, then you chek for type and priority, and then you either load the file (banner) from the filesystem (no need to store that in the DB, just store a link to where it's stored) or the code from the DB, and adjust the display based on however you weigh the priority.
We used if header_banner_kind !=1 >> AD is Banner else header_banner_kind ==0 >> AD is Html code and we used this code but Ad that is Banner only shown <?php $r = rand(1, 3); if (!empty(Options('header_banner_' . $r .'')) && (Options('header_banner_kind' . $r .'')!=1)) ?> <a href="<?php echo $Options['header_banner_url_' . $r .'']; ?>"> <img src="<?php echo $Options['header_banner_image_' . $r .'']['url'];?>" alt="<?php bloginfo('name')?>"></a> else echo Options('header_banner_html_' . $r .''); ?> and Main problem we can't stop disabled AD How can do that
The system that I setup where I work adjusts based on how well an ad performs. So if one advert converts better than another, it shows that advert more, if it stops performing it starts showing less. It works on an adjustable rolling system using cron jobs to check the performance every 5 mins. The initially query in MySql pulls in a list of all the available ads and joins to the table showing their performance. It then randomly picks the links giving a much higher weighting to the highest performing adverts. Adverts that don't perform literally get sidelined for a period of time until the number of impressions for the last 48 hours drops below a threshold after which the advert gets a chance to display again. It is amazing how much impact it can have.
Thanks for replies and now We need to write ############################### if (( dig('header_banner_kind_1') == 1) AND ((empty($dig['header_banner_image_1']['url']) OR (empty ($dig['header_banner_url_1']))))) $AD_weight_1 = 0; if (( dig('header_banner_kind_2') == 1) AND ((empty($dig['header_banner_image_2']['url']) OR (empty ($dig['header_banner_url_2']))))) $AD_weight_2 = 0; if (( dig('header_banner_kind_3') == 1) AND ((empty($dig['header_banner_image_3']['url']) OR (empty ($dig['header_banner_url_3']))))) $AD_weight_3 = 0; if (( dig('header_banner_kind_1') == 2) AND ((empty($dig['header_banner_html_1'])))) $AD_weight_1 = 0; if (( dig('header_banner_kind_2') == 2) AND ((empty($dig['header_banner_html_2'])))) $AD_weight_2 = 0; if (( dig('header_banner_kind_3') == 2) AND ((empty($dig['header_banner_html_3'])))) $AD_weight_3 = 0; ############################### how we can do it by loop, array or by function but in little code