[Original] advertisement call class, supporting flash call

Source: Internet
Author: User
Tags php source code

Introduction: This is the [original] advertisement calling class. It provides a detailed page for flash calling. It introduces PHP, related knowledge, skills, experience, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 343823 'rolling = 'no'>

The call method is as follows: The debugstr function is similar to an echo function.

 
Debugstr ('$ AdV-> getcontentbyid ($ id); $ ID is the advertisement number. Only one request is called and the returned content is the string'); echo adv: getcontentbyid (35 ); debugstr ('$ AdV-> getcontentbyidjs ($ id); $ ID is the advertisement number, only one is called, and the returned content is the JS string'); echo adv: getcontentbyidjs (35 ); debugstr ('$ AdV-> getcontentbyorder ($ id); $ ID is the advertisement number. Only one reverse ID is called and the returned content is a string'); echo adv :: getcontentbyorder (4); debugstr ('$ AdV-> getcontentbyorderjs ($ id); $ ID is the advertisement number. Only one reverse ID is called and the returned content is a JS string '); echo adv: getcontentbyorderjs (4); echo '<HR> ';

Class:

<? PHP/*** Description: it refers to advertising to facilitate the call of AD lists and content. * Required: Database Class * supported: only supports PhP5, single-piece mode ** @ author zerolone * @ version 2011-1-6 11:32:06 * Call Method * adv: getcontentbyid ($ id ); $ ID is the ad number, only one is called, and the returned content is the string * adv: getcontentbyidjs ($ id); $ ID is the ad number, only one is called, the returned content is the JS string * adv: getcontentbyorder ($ order); $ order is the corresponding one. Only one ID is called in reverse order, and the returned content is the string * adv: getcontentbyorderjs ($ order ); $ order corresponds to the order where only one ID is called in reverse order. The returned content is a JS string */class adv {static $ id = 0; // No. Static $ order = 0; // sequential static $ JS = 0; // whether to use JS, 0 is not used/*** according to ID, return the ad content, call only one ** @ Param ID $ id **/public static function getcontentbyid ($ id) {self ::$ id = $ ID; return self: getcontent ();} /*** return the ad content JS Based on the ID. Only one ** @ Param number $ id **/public static function getcontentbyidjs ($ id) {self :: $ id = $ ID; self: $ JS = 1; return self: getcontent ();}/*** according to order, the advertisement content is returned, call only one ** @ Param number $ order **/public static function getcontentbyorder ($ order) {self ::$ order = $ order; return self: getcontent ();} /*** return the ad content JS according to order and only call one ** @ Param number $ order **/public static function getcontentbyorderjs ($ order) {self :: $ order = $ order; self: $ JS = 1; return self: getcontent ();}/*** generates an advertisement content, only one ** @ return ad content */private function getcontent () {$ returncontent = ''; // -------------------- 0-------1--------2--------3 $ sqlstr = 'select' PIC ', 'width ', 'height', 'url' from '. table_adv; If (SELF: $ id) {$ sqlstr. = 'where' id' = '. SELF: $ ID;} else {$ sqlstr. = 'where'order' = '. SELF: $ order; $ sqlstr. = 'order by 'id' DESC ';} $ sqlstr. = 'limit 1'; $ mydatabase = Database: Get (); $ mydatabase-> sqlstr = $ sqlstr; if ($ mydatabase-> query ()) {$ db_record = $ mydatabase-> resultarr [0]; $ filename = $ db_record [0]; $ width = $ db_record [1]; $ Height = $ db_record [2]; $ url = $ db_record [3];} // judgment type $ filename_ext = strtoupper (pathinfo ($ filename, pathinfo_extension); If ($ filename_ext = 'swf ') {// flash advertisement $ returncontent = '<Table width = "'. $ width. '"border =" 0 "cellspacing =" 0 "cellpadding =" 0 ">'; $ returncontent. = '<tr>'; $ returncontent. = '<TD Height = "'. $ height. '">'; $ returncontent. = '<Table width = "100%" border = "0" cellpadding = "0" cellspacing = "0">'; $ returncontent. = '<tr>'; $ returncontent. = '<TD>'; $ returncontent. = '<Div style = "position: absolute; width: 0px; Height: 0px; Z-index: 1">'; $ returncontent. = '<Div style = "position: absolute; left: 0px; top: 0px; width :'. $ width. 'px; Height :'. $ height. 'px; Z-index: 2; filter: alpha (opacity = 0) "> '; $ returncontent. = '<Table width = "100%" Height = "100%" border = "0" cellspacing = "0" cellpadding = "0">'; $ returncontent. = '<tr>'; $ returncontent. = '<TD style = "cursor: Hand" onclick = Window. open ("'. $ URL. '") ;></TD>'; $ returncontent. = '</tr>'; $ returncontent. = '</table>'; $ returncontent. = '</div>'; $ returncontent. = '</div>'; $ returncontent. = '<object classid = "CLSID: D27CDB6E-AE6D-11cf-96B8-444553540000" codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab
# Version = 7,0, 19,0 "width = "'. $ width. '"Height = "'. $ height. '">'; $ returncontent. = '<Param name = "movie" value = "'. $ filename. '">'; $ returncontent. = '<Param name = "quality" value = "high">'; $ returncontent. = '<Param name = "wmode" value = "Transparent">'; $ returncontent. = '<embed src = "'. $ filename. '"Quality =" high "wmode =" Transparent "pluginspage =" http://www.macromedia.com/go/getflashplayer
"Type =" application/X-Shockwave-flash "width = "'. $ width. '"Height = "'. $ height. '"> </embed> </Object>'; $ returncontent. = '</TD>'; $ returncontent. = '</tr>'; $ returncontent. = '</table>'; $ returncontent. = '</TD>'; $ returncontent. = '</tr>'; $ returncontent. = '</table>';} else {// image advertisement $ returncontent = '<a target = "_ blank" href = "'. $ URL. '"> </a> ';} // If the js method is called if (SELF: $ JS) {$ returncontent = 'document. write ("'. addslashes ($ returncontent ). '");';} // reset the default value. Here, the single-piece mode self: $ id = 0; self: $ order = 0; self :: $ JS = 0; return $ returncontent ;}}?>

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/343823.html pageno: 5.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.