3 1 banner invocation


phpAdsNew Documentation   phpAdsNew  Home      3.1Banner invocation  phpAdsNew gives you four options to include a banner on your site: local mode, remote invocation, remote invocation for iframes and remote invocation with JavaScript. It is recommended to use the first method where possible. It is also possible to use a combination of all types of remote invocation.     3.1.1Local Mode  This is the traditional style of a including a banner within a PHP-powered website. On every page you want to have a banner, you have to include phpadsnew.inc.php. This file is in your phpAdsNew installation-directory. Banners are displayed using the view() function. This function has the following syntax:int view (mixed what [, int clientID [, string target           [, string source[, bool withText = 0[, array context]]]]); The view() function does not work well in template-based websites (for example phplib or fasttemplate), because the view() function prints the banner directly to the screen. The banner would appear before the rest of the page is printed. In order to make phpAdsNew work in template based websites there is a function that returns both the html code ($array["html"]) and the banner id ($array["bannerID"]) in an array. The function does not print anything to the screen.array view_raw (mixed what [, int clientID [, string target                 [, string source[, bool withText = 0[, array context]]]]); An example:<?   require("/usr/local/etc/phpAds/phpadsnew.inc.php"); ?> <html>  <head>     <title>phpAdsNew demo</title>   </head>   <body>     <?       view("468x60");     ?>   </body> </html>       3.1.2Remote Invocation  It is also possible to use phpAdsNew on sites that lack PHP-support. Random or predefined banners can be shown using a standard <img>-construct. Just like in Local Mode, you can use the "what" argument to select the banner.<a href="adclick.php"><img src="adview.php"></a> To use multiple banners on a single page, select a unique name for each banner and assign it to the "n" argument for both "adclick.php" and "adview.php". This way phpAdsNew can keep track of which AdView belongs with which AdClick. You can configure adview.php with the following parameters: what, clientID and source.Remote Invocation does have some limitation, for example: cookies must be enabled and HTML banners won't work at all. It is recommended to use Remote Invocation as a fallback instead of the main method of displaying banners.Some examples:<a href="adclick.php?n=ban1"><img src="adview.php?what=468x60&n=ban1"></a>   Show a randomly selected banner of the size 468x60. <a href="adclick.php?n=top"><img src="adview.php?what=main&n=top"></a>   Show a randomly selected banner from the "main" group with the name "top". <a href="adclick.php?n=left"><img src="adview.php?what=468x60&n=left"></a>   Show a randomly selected banner of the size 468x60 with the name "left".       3.1.3Remote Invocation for iframes  It is also possible to use phpAdsNew in combination with iframes. An iframe is an independent html file inside your main page. There is a big advantage in using Remote Invocation for iframes, because the banner is resides in an independent html file your main page will keep loading and the layout will not wait for the banner even when the banner is not completely finished loading.<iframe src='adframe.php?what=468x60' framespacing='0' frameborder='no'></iframe>The following parameters can be used in combination with Remote Invocation for iframes: what, clientID, target, source, withText and refresh.      3.1.4Remote Invocation with JavaScript  This technique allows you to use HTML banners remotely. Just like in Local Mode, you can use the "what" argument to select the banner. All you need to do is insert this code:<script language="JavaScript" src="adjs.php"></script>You should also add parameters to adjs.php. The following parameters are compatible with Remote Invocation with JavaScript: what, clientID, target, source and withText.<script language="JavaScript" src="adjs.php?what=main&target=_blank"></script>   This would show a banner from the main group and, when clicked,   a new window would be opened.       3.1.5Combining the different types of Remote Invocation  The preferred type of Remote Invocation is the iframes variant. However iframes aren't supported on all browsers, so it may be needed to use a combination of different types of Remote invocation.<iframe src='adframe.php?what=468x60' framespacing='0' frameborder='no'><script language='JavaScript" src="adjs.php?what=468x60'></script><noscript><a href='adclick.php'><img src='adview.php?what=468x60'></a></noscript></iframe>The example above will try to use iframes when possible, but if the browser doesn't support iframes it will try to use remote invocation with JavaScript If the browser doesn't support JavaScript or JavaScript is turned off, the browser will use normal remote invocation. If you decide to use such a construction please note you need to specify the parameters for each type of invocation (adframe.php, adjs.php and adview.php).      

Wyszukiwarka