How do I make this work with HTML?

Discussion in 'PHP' started by IanT, Jul 11, 2010.

  1. #1
    I have this:

    (a rotating banner script) and I want to display it on an HTML page. I am aware that you need to change .htaccess but I am unsure of the best way to do so?

    please help!!



    siteintro.php

    <?
    $bannerCounter= 1; 
    /*banner # 1 */ 
    $bannerCode[$bannerCounter] = <a href="http://www.soapmakingforum.com"><img src="http://www.smftutorials.com/images/r-banners/pic1.jpg"><alt="Visit Soap Making Forum"></a>;
    $bannerCounter++;
    
    /*banner # 2 */ 
    $bannerCode[$bannerCounter] = <a href="http://www.smftutorials.com/how-to-make-sand-candles-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic2.jpg"><alt="Learn To Make Sand Candles"></a>;
    $bannerCounter++;
    
    /*banner # 3 */  
    $bannerCode[$bannerCounter] = <a href="http://www.smftutorials.com/how-to-make-soap-scroll-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic3.jpg"><alt="Learn To Make Soap Scrolls"></a>;
    $bannerCounter++;
    
    /*banner # 4 */ 
    $bannerCode[$bannerCounter] = <a href="http://www.smftutorials.com/how-to-make-bath-bombs-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic4.jpg"><alt="Learn To Make Bath Bombs"></a>;
    $bannerCounter++;
    
    /*banner # 5 */ 
    $bannerCode[$bannerCounter] = <a href="http://www.smftutorials.com/how-to-make-melt-and-pour-gemstone-and-rock-soap-tutorial-revisited.html"><img src="http://www.smftutorials.com/images/r-banners/pic5.jpg"><alt="Learn To Make Soap Rocks"></a>;
    $bannerCounter++;
    
    
    /*banner # 6 */ 
    $bannerCode[$bannerCounter] = <a href="http://www.smftutorials.com/6-color-swirl-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic6.jpg"><alt="Learn To Swirl"></a>;
    $bannerCounter++;
    
    /*banner # 7 */ 
    $bannerCode[$bannerCounter] = <a href="http://www.smftutorials.com/how-to-line-a-wooden-soap-mold-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic7.jpg"><alt="Learn To Line a Wooden Soap Mold"></a>;
    $bannerCounter++;
    
    /*banner # 8 */ 
    $bannerCode[$bannerCounter] = <a href="http://www.smftutorials.com/soap-packaging-idea-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic8.jpg"><alt="Elegant Packaging Ideas"></a>;
    $bannerCounter++;
    
    /*banner # 9 */ 
    $bannerCode[$bannerCounter] = <a href="http://www.smftutorials.com/how-to-make-rebatch-soap-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic9.jpg"><alt="Learn To Make Rebatched Soap"></a>;
    $bannerCounter++;
    
    /*banner # 10 */ 
    $bannerCode[$bannerCounter] = <a href="http://www.smftutorials.com/how-to-make-salt-soap.html"><img src="http://www.smftutorials.com/images/r-banners/pic-10.jpg"><alt="Learn To Make Salt Soap"></a>;
    $bannerCounter++;
    
    /*banner # 11 */ 
    $bannerCode[$bannerCounter] = <a href="http://www.smftutorials.com/how-to-make-your-own-silicone-soap-mold-liners-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic-11.jpg"><alt="Learn To Make Silicone Mold Liners"></a>;
    $bannerCounter++;
    
    /*banner # 12 */ 
    $bannerCode[$bannerCounter] = <a href="http://www.smftutorials.com/how-to-make-your-own-custom-soap-stamps-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic-12.jpg"><alt="Learn To Make a Soap Stamp"></a>;
    $bannerCounter++;
    
    /*banner # 13 */ 
    $bannerCode[$bannerCounter] = <a href="http://www.smftutorials.com/soap-wrapping-ideas-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic-13.jpg"><alt="Soap Packaging Ideas"></a>;
    $bannerCounter++;
    
    /*The Function*/
    
    $bannerAdTotals = $bannerCounter - 1;
    if($bannerAdTotals>1)
    {
       mt_srand((double)microtime() * 1234567);
       $bannerPicked = mt_rand(1, $bannerAdTotals);
    }
    else
    {
       $bannerPicked = 1;
    }
    $bannerAd = $bannerCode[$bannerPicked];
    ?> 
    Code (markup):

    index.html:


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html
    	xmlns="http://www.w3.org/1999/xhtml"
    	lang="en"
    	xml:lang="en"
    ><head>
    
    <meta
    	http-equiv="Content-Type"
    	content="text/html; charset=utf-8"
    />
    
    <meta
    	http-equiv="Content-Language"
    	content="English"
    />
    
    <meta
    	name="description"
    	content="Read the best soap making tutorials and learn about soapmaking methods and soap making supplies, candle making tutorials, bath and body tutorials and other fun craft tutorials online."
    />
    
    <meta
    	name="keywords"
    	content="soap, handmade, candles, scented, molds, making, organic, business"
    />
    
    <link
    	rel="shortcut icon"
    	href="http://www.smftutorials.com/favicon.ico"
    />
    
    <link
    	type="text/css"
    	rel="stylesheet"
    	href="screen.css"
    	media="screen,projection,tv"
    />
    
    <!--
    
    	Don't forget to implement these later!
    
    <link
    	type="text/css"
    	rel="stylesheet"
    	href="print.css"
    	media="print"
    />
    
    <link
    	type="text/css"
    	rel="stylesheet"
    	href="handheld.css"
    	media="handheld"
    />
    
    -->
    
    <title>
    	SMF Tutorials - Soap and Candle Making, Bath and Body Tutorials
    </title>
    
    </head><body>
    
    <!--
    	empty tags like SPAN and B below are image sandbags for
    	sliding doors or glider-levin replacement - do not remove!!!
    
    	Horizontal rules should be removed by CSS and are present
    	for CSS off users only.
    -->
    
    <div id="pageWrapper">
    
    	<div class="borderTop"><div></div></div>
    	
    	<div class="borderLeft"><div class="borderRight">
    	
    		<h1>
    			<a href="/">
    				SMF Tutorials
    				<span><span></span></span>
    			</a>
    		</h1><hr />
    	
    		<!-- odd LI spacing below is sneaky white-space removal trick -->
    		<ul id="mainMenu">
    			<li class="first"><a href="/" class="current">Home</a></li
    			><li><a href="/">Soap</a></li
    			><li><a href="/">Candles</a></li
    			><li><a href="/">Bath &amp; Body</a></li
    			><li><a href="/">Forum How-To</a></li
    			><li><a href="/">FAQ</a></li
    			><li><a href="/">Links</a></li
    			><li class="last"><a href="/">SoapMakingForum.com</a></li>
    		</ul><hr />
    	
    		<div id="fauxColumns">
    	
    			<div id="contentWrapper"><div id="content">
    	
    				<!--<h2 class="welcome">Welcome to SMFtutorials.com</h2>-->
    				<img
    					src="images/sr2.jpg"
    					width="400" height="225"
    					alt="Some colorful homemade soaps"
    					class="plate"
    				/>
    				<p>
    					Hello! Welcome to SMFtutorials.com, A sister-site of <a href="http://www.soapmakingforum.com">Soap Making Forum</a>. This Comprehensive 	Soap Making and Craft Tutorial Directory was put together in order for individuals interested in soap making and candle making, and other crafts to have easy access to the best tutorials found on the internet.
    				</p><p>
    					Instead of wasting time scouring the internet searching for these soapmaking and craft tutorials, we have put them all in one place so you can concentrate on learning and practicing the craft of your choice and most importantly, having fun!
    				</p><p>
    					All of the tutorials found on this website have been included with special permission from their respective authors. Please visit their websites and show your support!
    				</p>
    	
    				<div class="imageTriad">
    					<img
    						src="http://www.smftutorials.com/images/line5a.JPG"
    						width="170" height="127"
    						alt="Soap that looks like whipped cream on coffee"
    					/><img
    						src="Http://www.smftutorials.com/images/sand1a.JPG"
    						width="200" height="100"
    						alt="Soap shaped and colored like seashells"
    					/><img
    						src="http://www.smftutorials.com/images/soap_scrollsa.jpg"
    						width="206" height="142"
    						alt="old paper scroll style soaps"
    					/>
    				<!-- .imageTriad --></div><hr />
    	
    				<div class="plateAdvert">
    	
    	<script type="text/javascript"><!--
    		google_ad_client = "pub-5056108458616211";
    		/* horizontal link */
    		google_ad_slot = "1902167907";
    		google_ad_width = 468;
    		google_ad_height = 15;
    	//--></script>
    	<script type="text/javascript"
    		src="http://pagead2.googlesyndication.com/pagead/show_ads.js"
    	></script>
    	
    				<!-- .plateAdvert --></div>
    	
    				<div class="leadingAdvert">
    	
    	<script type="text/javascript"><!--
    		google_ad_client = "pub-5056108458616211";
    		/* small square */
    		google_ad_slot = "6792444341";
    		google_ad_width = 200;
    		google_ad_height = 200;
    	//--></script>
    	<script type="text/javascript"
    		src="http://pagead2.googlesyndication.com/pagead/show_ads.js"
    	></script>
    	
    				<!-- .leadingAdvert --></div>
    	
    				<div class="postLeadingAdvert">
    					<h2>
    						On SMFtutorials.com you can learn:
    					</h2>
    					<ul>
    						<li>The best sources for wholesale bath &amp; body</li>
    						<li>How to choose your ingredients</li>
    						<li>Where to find the best supplies</li>
    						<li>How to make:
    							<ul>
    								<li>Castile bar soap</li>
    								<li>Liquid Castile soap</li>
    								<li>Goat's Milk soap</li>
    								<li>Glycerin soap</li>
    								<li>Bath soap</li>
    								<li>Casting Molds</li>
    								<li>Candles</li>
    								<li>Homemade body butter</li>
    							</ul>
    						</li>
    						<li>... and much, much more!</li>
    					</ul>
    				<!-- .postLeadingAdvert --></div><hr />
    				
    				<div class="visitCommunity">
    	
    					<h2><a href="http://www.soapmakingforum.com">Visit our Community</a></h2>
    					<p>
    						Have any questions about Soap Making or other crafts? Please feel free to visit us at <a href="http://www.soapmakingforum.com"> Soap Making Forum</a>, simply click the link below to be redirected. We are a family community of crafters over 4,000 strong and growing every day; dedicated to learn and teach each other more about the crafts we love!
    					</p>
    					<a href="http://www.soapmakingforum.com">
    						<img
    							src="images/banner.png"
    							alt="Soap Making Message Board Banner"
    							class="plate"
    						/>
    					</a>
    		
    				<!-- .visitCommunity --></div>
    				
    				<ul class="bottomLinks">
    					<li>
    						<a href="mailto:info@smftutorials.com?subject=SMF Tutorials Inquiry">
    							Contact
    						</a>
    					</li><li>
    						<a href="/privacy-policy.html">
    							Privacy Policy
    						</a>
    					</li>
    				</ul>
    					
    	
    			<!-- #content, #contentWrapper --></div><hr /></div>
    	
    			<div id="sideBar">
    	
    				<form action="http://www.google.com/cse" id="cse-search-box">
    					<div>
    						<input type="hidden" name="cx" value="partner-pub-5056108458616211:mz9sz8-ilus" />
    						<input type="hidden" name="ie" value="ISO-8859-1" />
    						<input type="text" name="q" size="15" />
    						<input type="submit" name="sa" value="Search" />
    					</div>
    				</form>
    				<script
    					type="text/javascript"
    					src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en"
    				></script>
    	
    	
    				<h2>Tutorial Categories</h2>
    				<ul>
    					<li><a href="/soap-making-tutorials.html">Soap</a></li>
    					<li><a href="/candle-making-tutorials.html">Candles</a></li>
    					<li><a href="/bath-and-body-tutorials.html">Bath/Body</a></li>
    					<li><a href="/forum-how-to-tutorials.html">Forum How-To</a></li>
    					<li><a href="/faq.html">FAQ</a></li>
    					<li><a href="/links.html">Links</a></li>
    				</ul>
    	
    				<h2>Updates</h2>
    				<ul>
    					<li><a href="february-2010.html">February 2010</a></li>
    				</ul>
    	
    				<div class="skyScraperAdvert">
    	
    	<script type="text/javascript"><!--
    		google_ad_client = "pub-5056108458616211";
    		/* 120x600, smf sky image created 3/16/10 */
    		google_ad_slot = "6778346460";
    		google_ad_width = 120;
    		google_ad_height = 600;
    	//--></script>
    	<script type="text/javascript"
    		src="http://pagead2.googlesyndication.com/pagead/show_ads.js"
    	></script>
    	
    				<!-- .skyScraperAdvert --></div>
    	
    			<!-- #sideBar --></div>
    	
    		<!-- #fauxColumns --><hr /></div>
    		
    	<!-- .borderRight, .borderLeft --></div></div>
    	
    	<div class="borderBottom"><div></div></div>
    
    <!-- #pageWrapper --></div>
    
    <div class="bottomAdvert">
    
    <script type="text/javascript"><!--
    	google_ad_client = "pub-5056108458616211";
    	/* 728x90, SMF sig banner */
    	google_ad_slot = "6447024537";
    	google_ad_width = 728;
    	google_ad_height = 90;
    //--></script>
    <script type="text/javascript"
    	src="http://pagead2.googlesyndication.com/pagead/show_ads.js"
    ></script>
    
    <!-- .bottomAdvert --></div>
    
    <div id="footer">
    	Copyright &copy; 2010 LindleyWood Development, Inc.
    <!-- #footer --></div>
    
    
    </body></html>
    
    Code (markup):



    Thanks for any/all help!
     
    IanT, Jul 11, 2010 IP
  2. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #2
    Your doing it completely wrong. lol Here's a rough one I made for you, save it as banners.php:
    
    <?php
       $banner = array (
                         '<a href="http://www.soapmakingforum.com"><img src="http://www.smftutorials.com/images/r-banners/pic1.jpg"><alt="Visit Soap Making Forum"></a>',
                         '<a href="http://www.smftutorials.com/how-to-make-sand-candles-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic2.jpg"><alt="Learn To Make Sand Candles"></a>',
                         '<a href="http://www.smftutorials.com/how-to-make-soap-scroll-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic3.jpg"><alt="Learn To Make Soap Scrolls"></a>',
                         '<a href="http://www.smftutorials.com/how-to-make-bath-bombs-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic4.jpg"><alt="Learn To Make Bath Bombs"></a>',
                         '<a href="http://www.smftutorials.com/how-to-make-melt-and-pour-gemstone-and-rock-soap-tutorial-revisited.html"><img src="http://www.smftutorials.com/images/r-banners/pic5.jpg"><alt="Learn To Make Soap Rocks"></a>',
                         '<a href="http://www.smftutorials.com/6-color-swirl-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic6.jpg"><alt="Learn To Swirl"></a>',
                         '<a href="http://www.smftutorials.com/how-to-line-a-wooden-soap-mold-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic7.jpg"><alt="Learn To Line a Wooden Soap Mold"></a>',
                         '<a href="http://www.smftutorials.com/soap-packaging-idea-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic8.jpg"><alt="Elegant Packaging Ideas"></a>',
                         '<a href="http://www.smftutorials.com/how-to-make-rebatch-soap-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic9.jpg"><alt="Learn To Make Rebatched Soap"></a>',
                         '<a href="http://www.smftutorials.com/how-to-make-salt-soap.html"><img src="http://www.smftutorials.com/images/r-banners/pic-10.jpg"><alt="Learn To Make Salt Soap"></a>',
                         '<a href="http://www.smftutorials.com/how-to-make-your-own-silicone-soap-mold-liners-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic-11.jpg"><alt="Learn To Make Silicone Mold Liners"></a>',
                         '<a href="http://www.smftutorials.com/how-to-make-your-own-custom-soap-stamps-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic-12.jpg"><alt="Learn To Make a Soap Stamp"></a>',
                         '<a href="http://www.smftutorials.com/soap-wrapping-ideas-tutorial.html"><img src="http://www.smftutorials.com/images/r-banners/pic-13.jpg"><alt="Soap Packaging Ideas"></a>'
                        );
                        
       $numBanner = sizeof($banner);
       $randBanner = rand($numBanner - $numBanner, $numBanner - 1);
       
       echo $banner[$randBanner];
    ?>
    
    PHP:
    And just add the following to your HTML and save it as index.php instead of index.html:
    <?php include 'banners.php'; ?>
    PHP:
    That way, you won't have to edit your .htaccess
     
    Rainulf, Jul 11, 2010 IP
  3. IanT

    IanT Well-Known Member

    Messages:
    503
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    130
    #3
    the thing is I dont want to change the index to .php because of the rankings in google etc.. the site ranks on the first page (though i havent updated it in months)...

    I have looooads of backlinks (4000++) on the index.html (and all the other html pages) and if I change it to index.php all those will be broken... how would I deal with that issue?



    EDIT: just tried that code above and its not showing either (probably because its not recognizing the php...... )


    sigh....
     
    IanT, Jul 11, 2010 IP
  4. IanT

    IanT Well-Known Member

    Messages:
    503
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    130
    #4
    do you think it would be better to use javascript??


    Like:
    <script type="text/javascript">
    var imgs1 = new Array("http://www.smftutorials.com/images/r-banners/pic1.jpg","http://www.smftutorials.com/images/r-banners/pic3.jpg");
    var lnks1 = new Array("http://www.soapmakingforum.com","http://www.smftutorials.com/how-to-make-soap-scroll-tutorial.html");
    var alt1 = new Array("Visit Soap Making Forum","Learn To Make Soap Scrolls");
    var currentAd1 = 0;
    var imgCt1 = 2;
    function cycle1() {
      if (currentAd1 == imgCt1) {
        currentAd1 = 0;
      }
    var banner1 = document.getElementById('adBanner1');
    var link1 = document.getElementById('adLink1');
      banner1.src=imgs1[currentAd1]
      banner1.alt=alt1[currentAd1]
      document.getElementById('adLink1').href=lnks1[currentAd1]
      currentAd1++;
    }
      window.setInterval("cycle1()",10000);
    </script>
    <a href=""http://www.soapmakingforum.com"" id="adLink1" target="_top">
    <img src="http://www.smftutorials.com/images/r-banners/pic1.jpg" id="adBanner1" border="0" width="500" height="250"></a>
    
    Code (markup):
     
    IanT, Jul 11, 2010 IP