braclark Posted May 25, 2004 Posted May 25, 2004 I had a problem of using "Commission Juction" banners. I didn't want to have to save each image, and then upload them when they will host the image on a much faster server anyway for free. This will allow tracking of click throughs and remote serving of images. I'm going to use an actual example from my site since the worst thing that happens is that you make me some money. 1. They give you the "cut and paste" html code to put on your website. Put this in the "HTML Text" field. <a href="http://www.qksrv.net/click-1481297-9950729" target="_blank" > <img src="http://www.qksrv.net/image-1481297-9950729" width="468" height="60" alt="" border="0"></a> 2. Take what's in the quotes after the href out of the code and put it in the "Banner URL" field. 3. Save this banner profile. 4. Go to your web site and look at a standard OSC banner and copy the link. Mine looks like: http://www.wittydeals.com/redirect.php?action=banner&goto=2 5. Now, find out what number the banner you just created is by looking at the link for the "EDIT" button for that banner in banner manager. Tho following is "5" http://www.wittydeals.com/oscadmin/banner_manager.php?page=1&bID=5&action=new 6. Create the combined link from step 4 and 5 like the following http://www.wittydeals.com/redirect.php?action=banner&goto=5 7. Place the link from step 6 in between the quotes after the href in the HTML Text area. You should have the following: <a href="http://www.wittydeals.com/redirect.php?action=banner&goto=5" target="_blank" > <img src="http://www.qksrv.net/image-1481297-9950729" width="468" height="60" alt="" border="0"></a> It uses only what's in the "HTML Text" area to write the banner code, but when the redirect code is called, it uses the link that you gave it in the "Banner URL" field. There, it sounds complicated, but it's not really.
braclark Posted May 31, 2004 Author Posted May 31, 2004 I guess maybe I shouldn't have spent so much time explaining this.
Guest Posted May 31, 2004 Posted May 31, 2004 Thanks. This will be really helpful.. i'll try it a bit latter
braclark Posted June 7, 2004 Author Posted June 7, 2004 Ok, after I figured this all out, I looked at the banner code and saw how easy it would be to change it. If you edit /catalog/includes/functions/banner.php and replace function tep_display_banner and function tep_banner_exists with the following code, then if a value exists in the 'banners_url' field, then it creates it's own a href link around whatever is in the 'banners_html_text' field. Other than that, it still works the same. // Display a banner from the specified group or banner id ($identifier) ?function tep_display_banner($action, $identifier) { ? ?if ($action == 'dynamic') { ? ? ?$banners_query = tep_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); ? ? ?$banners = tep_db_fetch_array($banners_query); ? ? ?if ($banners['count'] > 0) { ? ? ? ?$banner = tep_random_select("select banners_id, banners_title, banners_image, banners_html_text, banners_url from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); ? ? ?} else { ? ? ? ?return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</b>'; ? ? ?} ? ?} elseif ($action == 'static') { ? ? ?if (is_array($identifier)) { ? ? ? ?$banner = $identifier; ? ? ?} else { ? ? ? ?$banner_query = tep_db_query("select banners_id, banners_title, banners_image, banners_html_text, banners_url from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . (int)$identifier . "'"); ? ? ? ?if (tep_db_num_rows($banner_query)) { ? ? ? ? ?$banner = tep_db_fetch_array($banner_query); ? ? ? ?} else { ? ? ? ? ?return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</b>'; ? ? ? ?} ? ? ?} ? ?} else { ? ? ?return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</b>'; ? ?} ? ?if (tep_not_null($banner['banners_html_text'])) { ? if (tep_not_null($banner['banners_url'])) { ? ? ? ?$banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . $banner['banners_html_text'] . '</a>'; ? } else { ? ? $banner_string = $banner['banners_html_text']; ? } ? ?} else { ? ? ?$banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>'; ? ?} ? ?tep_update_banner_display_count($banner['banners_id']); ? ?return $banner_string; ?} //// // Check to see if a banner exists ?function tep_banner_exists($action, $identifier) { ? ?if ($action == 'dynamic') { ? ? ?return tep_random_select("select banners_id, banners_title, banners_image, banners_html_text, banners_url from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); ? ?} elseif ($action == 'static') { ? ? ?$banner_query = tep_db_query("select banners_id, banners_title, banners_image, banners_html_text, banners_url from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . (int)$identifier . "'"); ? ? ?return tep_db_fetch_array($banner_query); ? ?} else { ? ? ?return false; ? ?} ?} So, for the original example, you'd put this in the "Banner URL" field: http://www.qksrv.net/click-1481297-9950729 and put this in the "Html Text" field: <img src="http://www.qksrv.net/image-1481297-9950729" width="468" height="60" alt="" border="0">
khaaliq Posted July 21, 2004 Posted July 21, 2004 braclark, I added the code that you suggested but I still get the "some items are unsecure" error. How can I correct this?
braclark Posted July 30, 2004 Author Posted July 30, 2004 Oh. ;) Maybe thats because I don't use a secure server (https). You'll need to host the images off of a secure server to get rid of those messages. If you are using Commission Junction, then just add the extra "s" at the end of http in the link to the images and everything should be just dandy. :D
sneako Posted April 14, 2006 Posted April 14, 2006 To the PHP coders, is there a way to make it so "If entered a secure site, do NOT show the CJ banner"? I get the broken security lock in teh lower right because of the SmartZone banner, this allows many different banners updated via cj.com. I emailed CJ and they said there is no way to make it encrypted, so I just need to remove it on the secure pages. Anyone know how?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.