Location: PHPKode > scripts > Ad Rotator class > ad-rotator-class/doc.html
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 11">
<meta name=Originator content="Microsoft Word 11">
<link rel=File-List href="doc_files/filelist.xml">
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Author>Vedanta Barooah</o:Author>
  <o:Template>Normal</o:Template>
  <o:LastAuthor>Vedanta Barooah</o:LastAuthor>
  <o:Revision>7</o:Revision>
  <o:TotalTime>26</o:TotalTime>
  <o:Created>2004-11-24T12:52:00Z</o:Created>
  <o:LastSaved>2004-11-24T13:18:00Z</o:LastSaved>
  <o:Pages>1</o:Pages>
  <o:Words>153</o:Words>
  <o:Characters>878</o:Characters>
  <o:Lines>7</o:Lines>
  <o:Paragraphs>2</o:Paragraphs>
  <o:CharactersWithSpaces>1029</o:CharactersWithSpaces>
  <o:Version>11.5606</o:Version>
 </o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:PunctuationKerning/>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
   <w:DontGrowAutofit/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
 </w:LatentStyles>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;
	mso-font-charset:2;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:0 268435456 0 0 -2147483648 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
span.SpellE
	{mso-style-name:"";
	mso-spl-e:yes;}
span.GramE
	{mso-style-name:"";
	mso-gram-e:yes;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:1339387314;
	mso-list-type:hybrid;
	mso-list-template-ids:1271826510 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
	{mso-level-tab-stop:.25in;
	mso-level-number-position:left;
	margin-left:.25in;
	text-indent:-.25in;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin:0in;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";
	mso-ansi-language:#0400;
	mso-fareast-language:#0400;
	mso-bidi-language:#0400;}
</style>
<![endif]-->
</head>

<body lang=EN-US style='tab-interval:.5in'>

<div class=Section1>

<p class=MsoNormal><b style='mso-bidi-font-weight:normal'><u>Using the <span
class=SpellE>AdRotator</span> Class<o:p></o:p></u></b></p>

<p class=MsoNormal><span class=GramE><i style='mso-bidi-font-style:normal'>vedanta</i></span><i
style='mso-bidi-font-style:normal'> dot <span class=SpellE>barooah</span> at <span
class=SpellE>gmail</span> dot com<o:p></o:p></i></p>

<p class=MsoNormal><b style='mso-bidi-font-weight:normal'><u><o:p><span
 style='text-decoration:none'>&nbsp;</span></o:p></u></b></p>

<p class=MsoNormal>Consider the following code:</p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style='font-size:9.0pt;font-family:"Courier New"'>&lt;?<span
class=SpellE>php</span><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style='font-size:9.0pt;font-family:"Courier New"'>//
include the main class file<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style='font-size:9.0pt;font-family:"Courier New"'>include(&quot;<span
class=SpellE>adrotator.class.php</span>&quot;);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>4.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style='font-size:9.0pt;font-family:"Courier New"'>//
make a image pool as an array<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>5.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style='font-size:9.0pt;font-family:"Courier New"'>$<span
class=SpellE>image_array</span>=array(&quot;one.gif&quot;,&quot;two.gif&quot;,&quot;three.gif&quot;,&quot;four.gif&quot;,&quot;five.gif&quot;,&quot;six.gif&quot;,&quot;seven.gif&quot;);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>6.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style='font-size:9.0pt;font-family:"Courier New"'>//
instance of the class<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>7.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style='font-size:9.0pt;font-family:"Courier New"'>$o
= new <span class=SpellE>AdRotator</span>($<span class=SpellE>image_array</span>);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>8.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style='font-size:9.0pt;font-family:"Courier New"'>//
set the number of images to be shown<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>9.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style='font-size:9.0pt;font-family:"Courier New"'>$o-&gt;rotate(5);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>10.<span style='font:7.0pt "Times New Roman"'>&nbsp; </span></span></span><![endif]><span
style='font-size:9.0pt;font-family:"Courier New"'>// get the images in an array<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>11.<span style='font:7.0pt "Times New Roman"'>&nbsp; </span></span></span><![endif]><span
style='font-size:9.0pt;font-family:"Courier New"'>$<span class=SpellE>img</span>=$o-&gt;<span
class=SpellE>getImages</span>();<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>12.<span style='font:7.0pt "Times New Roman"'>&nbsp; </span></span></span><![endif]><span
style='font-size:9.0pt;font-family:"Courier New"'>// display the images<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>13.<span style='font:7.0pt "Times New Roman"'>&nbsp; </span></span></span><![endif]><span
style='font-size:9.0pt;font-family:"Courier New"'>for($<span class=SpellE>i</span>=0;$i&lt;count($<span
class=SpellE>img</span>);$<span class=SpellE>i</span>++){<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>14.<span style='font:7.0pt "Times New Roman"'>&nbsp; </span></span></span><![endif]><span
style='font-size:9.0pt;font-family:"Courier New"'>?&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>15.<span style='font:7.0pt "Times New Roman"'>&nbsp; </span></span></span><![endif]><span
style='font-size:9.0pt;font-family:"Courier New"'>&lt;<span class=SpellE>img</span>
<span class=SpellE>src</span>=&quot;./images/&lt;?=$<span class=SpellE>img</span>[$<span
class=SpellE>i</span>]?&gt;&quot; style=&quot;<span class=SpellE>border:thin</span>
solid #<span class=SpellE>ffffff</span> &quot;&gt;&lt;<span class=SpellE>br</span>&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>16.<span style='font:7.0pt "Times New Roman"'>&nbsp; </span></span></span><![endif]><span
style='font-size:9.0pt;font-family:"Courier New"'>&lt;?<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>17.<span style='font:7.0pt "Times New Roman"'>&nbsp; </span></span></span><![endif]><span
style='font-size:9.0pt;font-family:"Courier New"'>}<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1;
tab-stops:list .25in'><![if !supportLists]><span style='font-size:9.0pt;
font-family:"Courier New";mso-fareast-font-family:"Courier New"'><span
style='mso-list:Ignore'>18.<span style='font:7.0pt "Times New Roman"'>&nbsp; </span></span></span><![endif]><span
style='font-size:9.0pt;font-family:"Courier New"'>?&gt;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal>Line 2: Includes the main class file</p>

<p class=MsoNormal>Line 5: Define an array that contains all the image (ads)
name </p>

<p class=MsoNormal>Line 7: The constructor of the class takes this image array
as argument</p>

<p class=MsoNormal>Line 9: Sets the number of images that are to be displayed
in the page</p>

<p class=MsoNormal>Line 11: Returns an array of the randomized images</p>

<p class=MsoNormal>Line 15: Once you have the images, display them (There are
other ways to do the image display, the above is just one method)</p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><b style='mso-bidi-font-weight:normal'>ENJOY! <o:p></o:p></b></p>

<p class=MsoNormal><b style='mso-bidi-font-weight:normal'><o:p>&nbsp;</o:p></b></p>

<p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span
style='font-family:Wingdings;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman";mso-char-type:symbol;mso-symbol-font-family:
Wingdings'><span style='mso-char-type:symbol;mso-symbol-font-family:Wingdings'>J</span></span><o:p></o:p></b></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

</div>

</body>

</html>
Return current item: Ad Rotator class