By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,468 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

Setting up a rotating banner - help required

P: 24
Hi
I want to set up a rotating banner. Not sure how to incorporate my rotating banner code into the code below. I want the rotating banner to be the main feature image? This is set up in mediasurface

My code is:

[HTML]<!-- start page container -->
<div id="pageContainer">
<!-- start middle content area -->
<div id="genericMiddle">

<div id="titleContainer">
<h1><%= requestItem.getFullName() %></h1>
</div>
[/HTML]
Expand|Select|Wrap|Line Numbers
  1.     <%
  2.         String sImportantMessage = "";
  3.             try { 
  4.                 sImportantMessage = requestItem.getFieldValue( "sImportantMessage" ); 
  5.  
  6.             } catch ( Exception e ) { }
  7.  
  8.         if ( sImportantMessage == null ) { sImportantMessage = ""; }
  9.  
  10.         if ( ( ! sImportantMessage.equals( "" ) )  )
  11.         {
  12.             out.print("<div id='importantMssgTop'><span class='importantMssgHeader'>" + sImportantMessage + "</span></div>");
  13.         }
  14.  
  15.         String sIntroText = "";
  16.             try { 
  17.                 sIntroText = requestItem.getFieldValue( "sIntroText" ); 
  18.  
  19.             } catch ( Exception e ) { }
  20.  
  21.         if ( sIntroText == null ) { sIntroText = ""; }
  22.  
  23.         if ( ( ! sIntroText.equals( "" ) )  )
  24.         {
  25.             out.print("<div id='introductionText'>" + sIntroText + "</div>");
  26.         }
  27.      %>    
  28.         <!-- start column A-->
  29.         <div id="columnA">
  30.  
  31.     <%
  32.         String sMainFeatureTitle = "";
  33.             try { 
  34.                 sMainFeatureTitle = requestItem.getFieldValue( "sMainFeatureTitle" ); 
  35.  
  36.             } catch ( Exception e ) { }
  37.  
  38.         if ( sMainFeatureTitle == null ) { sMainFeatureTitle = ""; }
  39.  
  40.         if ( ( ! sMainFeatureTitle.equals( "" ) )  )
  41.         {
  42.     %>
  43.             <div id="mainFeatureBox">
  44.                 <div id="mainFeatureText">
  45.                     <a href="<%=requestItem.getFieldValue( "sMainFeatureURL" ) %>">
  46.                         <img src="<%=requestItem.getFieldValue( "sMainFeatureImage" ) %>" alt="<%=requestItem.getFieldValue( "sMainFeatureAlt" ) %>" class="mainFeaturePhoto" align="left" border="0">
  47.                     </a>
  48.                     <div id="featureHeadline">
  49.                           <h2><a href="<%=requestItem.getFieldValue( "sMainFeatureURL" ) %>"><%= sMainFeatureTitle %></a></h2>
  50.                     </div>
  51.                     <%=requestItem.getFieldValue( "sMainFeatureText" ) %>
  52.                 </div>
  53.             </div>
  54.  
  55.     <%    
  56.         }
  57.     %>
  58.  
  59.  
  60.            <div id="Column1">
  61.  
  62. <%
  63.     String sURL = ( "http://" + request.getServerName() + ":" + request.getServerPort() + requestItem.getFieldValue( "sURL" ) ); 
  64. %>    
  65.  
  66.     <ms:getItem id="oCurrentItem" url="<%=sURL%>" />
  67.  
  68. <%
  69.     XXX_ItemOrderList oItemOrderList = new XXX_ItemOrderList( ms, ctx, oCurrentItem.getFieldValue( "orderlist" ) , oCurrentItem );
  70.     IItem[] oChildItem = oItemOrderList.getItemLinks( );
  71.  
  72.     for ( int i = 0; i < oChildItem.length; i++ )
  73.         {
  74.             IItem oBoundItem   = null;
  75.             String sOutput = "";    
  76.             int j = 0;    
  77.  
  78.             IItem oItemChildren = ms.getItem( ctx, oChildItem[i].getUrl() );            
  79.  
  80.                 if (oChildItem[i].getFieldValue("sFlash").equals("N"))
  81.                     {
  82.                     out.print("<div id='secondaryFeatureText'><a href='" + oChildItem[i].getFieldValue("sURL") + "'><img src='" + oChildItem[i].getFieldValue("sImage") + "' alt='" + oChildItem[i].getFieldValue("sAlt") + "' class='featurePhotoSecondary' align='right' border='0' height='60' width='60'></a><h3><a href='"+ oChildItem[i].getFieldValue("sURL") +"'>" + oChildItem[i].getFieldValue("sTitle") + "</a></h3>" + oChildItem[i].getFieldValue("sText") + "</div>");
  83.                     }
  84.                 else
  85.                     {
  86.                     out.print("<div id='secondaryFeatureText'>" + oChildItem[i].getFieldValue("sImage") + "<h3><a href='"+ oChildItem[i].getFieldValue("sURL") +"'>" + oChildItem[i].getFieldValue("sTitle") + "</a></h3>" + oChildItem[i].getFieldValue("sText") + "</div>");
  87.                     }
  88.         }
  89.                 %>
  90.  
  91.  
  92.         </div>
  93.  
  94.  
  95.     <%
  96.         String sNewsArchiveKey = "";
  97.             try { 
  98.                 sNewsArchiveKey  = requestItem.getFieldValue( "sNewsArchiveKey" ); 
  99.  
  100.             } catch ( Exception e ) { }
  101.  
  102.         if ( sNewsArchiveKey == null ) { sNewsArchiveKey = ""; }
  103.  
  104.         if ( ( ! sNewsArchiveKey.equals( "" ) )  )
  105.         {
  106.     %>
Expand|Select|Wrap|Line Numbers
  1.             <div id="Column2">
  2.                 <jsp:include page="/WEB-INF/templates/components/body/Common/News/newsNewGeneric.jsp" flush="true">
  3.                        <jsp:param name="maxResults" value="<%=requestItem.getFieldValue( "sNewsMaxResults" ) %>" /> 
  4.                     <jsp:param name="TitleText" value="News" />
  5.                          <jsp:param name="archiveKey" value="<%=sNewsArchiveKey %>" /> 
  6.                 </jsp:include> 
  7.             </div>
Expand|Select|Wrap|Line Numbers
  1.     <%    
  2.         }
  3.     %>
  4.         </div>
  5.         <!-- end column A  -->
  6.  
  7.         <!-- start column 3-->
  8.         <div id="Column3">
  9.  
  10.  
  11.     <%
  12.         String sQuickLinks = "";
  13.             try { 
  14.                 sQuickLinks = requestItem.getFieldValue( "sQuickLinks" ); 
  15.  
  16.             } catch ( Exception e ) { }
  17.  
  18.         if ( sQuickLinks == null ) { sQuickLinks = ""; }
  19.  
  20.         if ( ( ! sQuickLinks.equals( "" ) )  )
  21.         {
  22.             out.print("<div id='linksRightTitle'><h3>Quick Links</h3></div>" + sQuickLinks);
  23.         }
  24.  
  25.         String sRelatedLinks = "";
  26.             try { 
  27.                 sRelatedLinks = requestItem.getFieldValue( "sRelatedLinks" ); 
  28.  
  29.             } catch ( Exception e ) { }
  30.  
  31.         if ( sRelatedLinks == null ) { sRelatedLinks = ""; }
  32.  
  33.         if ( ( ! sRelatedLinks.equals( "" ) )  )
  34.         {
  35.             out.print("<div id='linksRightSubSection'><h4>Related Intranet Links</h4>" + sRelatedLinks + "</div>");
  36.         }
  37.  
  38.  
  39.     String sInternetLinks = "";
  40.             try { 
  41.                 sInternetLinks = requestItem.getFieldValue( "sInternetLinks" ); 
  42.  
  43.             } catch ( Exception e ) { }
  44.  
  45.         if ( sInternetLinks == null ) { sInternetLinks = ""; }
  46.  
  47.         if ( ( ! sInternetLinks.equals( "" ) )  )
  48.         {
  49.             out.print("<div id='linksRightSubSection'><h4>Related Internet Links</h4>" + sInternetLinks + "</div>");
  50.         }
  51.     %>
Expand|Select|Wrap|Line Numbers
  1.         <div id="linksRightSubSection">
  2.         <h4>Page Tools</h4></div>    
  3.  
  4.         <a href="javascript:window.external.AddFavorite('<%= requestItem.getUrl() %>','<%= requestItem.getFullName() %>');" title="Bookmark This Page">Bookmark this page</a>
  5.         <a href="javascript:XXX_printSubSection( 'mainBody' )" alt="Print" title="Print">Print this page
  6.         </a><p>
  7.  
  8.         <div id="mainBody">
  9.         </div>        
  10.         </div>
  11.         <!-- end column 3-->
  12.  
  13.         <!-- start bottom promotion container -->
  14.         <div id="bottomPromoContainer">
  15.  
Expand|Select|Wrap|Line Numbers
  1.     <%                
  2.         String sBottomPromo1 = "";
  3.             try { 
  4.                 sBottomPromo1 = requestItem.getFieldValue( "sBottomPromo1" ); 
  5.  
  6.             } catch ( Exception e ) { }
  7.  
  8.         if ( sBottomPromo1 == null ) { sBottomPromo1 = ""; }
  9.  
  10.         if ( ( ! sBottomPromo1.equals( "" ) )  )
  11.         {
  12.             out.print("<div id='bottomPromo1'><div id='bottomFeatureText'>" + sBottomPromo1 + "</div></div>");
  13.         }
  14.  
  15.         String sBottomPromo2 = "";
  16.             try { 
  17.                 sBottomPromo2 = requestItem.getFieldValue( "sBottomPromo2" ); 
  18.  
  19.             } catch ( Exception e ) { }
  20.  
  21.         if ( sBottomPromo2 == null ) { sBottomPromo2 = ""; }
  22.  
  23.         if ( ( ! sBottomPromo2.equals( "" ) )  )
  24.         {
  25.             out.print("<div id='bottomPromo2'><div id='bottomFeatureText'>" + sBottomPromo2 + "</div></div>");
  26.         }
  27.  
  28.         String sBottomPromo3 = "";
  29.             try { 
  30.                 sBottomPromo3 = requestItem.getFieldValue( "sBottomPromo3" ); 
  31.  
  32.             } catch ( Exception e ) { }
  33.  
  34.         if ( sBottomPromo3 == null ) { sBottomPromo3 = ""; }
  35.  
  36.         if ( ( ! sBottomPromo3.equals( "" ) )  )
  37.         {
  38.             out.print("<div id='bottomPromo3'><div id='bottomFeatureText'>" + sBottomPromo3 + "</div></div>");
  39.         }
  40.     %>
Expand|Select|Wrap|Line Numbers
  1.         </div>
  2.         <!-- end bottom promotion container -->
  3.  
  4.       </div>
  5.     <!-- End middle content area -->
  6. </div>
  7. <!-- end page container -->
  8.  
************************************************** ***
My rotating banner code is:

Expand|Select|Wrap|Line Numbers
  1. String sBanner ="";
  2.                     String sBannerURL ="";
  3.  
  4.                     try {
  5.                         sBanner = oBoundItem.getFieldValue("sRotatingBanner");
  6.                         sBannerURL = oBoundItem.getPath();
  7.                     } catch( Exception e ) { }
  8.  
  9.                     out.print("<div id='secondaryFeatureText'>"); 
  10.  
  11.             %>
  12.  
Expand|Select|Wrap|Line Numbers
  1.                 <script language="JavaScript">
  2.  
  3.                     var sBanner = "<%=sBanner %>";
  4.                     var sBannerURL = "/ourcompany/1375787/";
  5.                     var maxAdNo = 7
  6.                     var adNo
  7.                     var myAd = new Array()
  8.  
  9.                     myAd[0] = sBanner1 = "<a href='" + sBannerURL  + "'><img border='0' src='" + sBanner + "1.jpg' align='right' class='featurePhotoSecondary' /></a>";
  10.                     myAd[1] = sBanner2 = "<a href='" + sBannerURL  + "'><img border='0' src='" + sBanner + "2.jpg' align='right' class='featurePhotoSecondary' /></a>";
  11.                     myAd[2] = sBanner3 = "<a href='" + sBannerURL  + "'><img border='0' src='" + sBanner + "3.jpg' align='right' class='featurePhotoSecondary' /></a>";
  12.                     myAd[3] = sBanner4 = "<a href='" + sBannerURL  + "'><img border='0' src='" + sBanner + "4.jpg' align='right' class='featurePhotoSecondary' /></a>";
  13.                     myAd[4] = sBanner5 = "<a href='" + sBannerURL  + "'><img border='0' src='" + sBanner + "5.jpg' align='right' class='featurePhotoSecondary' /></a>";
  14.                     myAd[5] = sBanner6 = "<a href='" + sBannerURL  + "'><img border='0' src='" + sBanner + "6.jpg' align='right' class='featurePhotoSecondary' /></a>";
  15.                     myAd[6] = sBanner7 = "<a href='" + sBannerURL  + "'><img border='0' src='" + sBanner + "7.jpg' align='right' class='featurePhotoSecondary' /></a>";
  16.                     myAd[7] = sBanner8 = "<a href='" + sBannerURL  + "'><img border='0' src='" + sBanner + "8.jpg' align='right' class='featurePhotoSecondary' /></a>";
  17.  
  18.                     adNo = Math.round(Math.random() * maxAdNo)
  19.                     document.write(myAd[adNo])
  20.  
  21.                     </script>
Oct 22 '07 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Please use code tags when posting code:
[CODE=javascript]
JavaScript code goes here...
[/code]
Oct 22 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.