Need help with some code

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Need help with some code

    I need to show several items on a page, in horizontal rows with 6 or 7 items to
    a row. I have the first row, but I don't know what code I need to change to get
    the next 6 or 7 to show on the next row. Here's the code: THANKS!!


    <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
    <cfparam name="PageNum_Salesmen" default="1">
    <cfquery name="Salesmen" datasource="AIOproducts.mdb">
    SELECT Salesmenprods.Product_Class, Salesmenprods.SKU,
    Salesmenprods.Thumbnails, Salesmenprods.Category, Salesmenprods.Name,
    Salesmenprods.Metatags FROM Salesmenprods ORDER BY Salesmenprods.Name
    </cfquery>
    <cfset MaxRows_Salesmen=6>
    <cfset
    StartRow_Salesmen=Min((PageNum_Salesmen-1)*MaxRows_Salesmen+1,Max(Salesmen.Recor
    dCount,1))>
    <cfset
    EndRow_Salesmen=Min(StartRow_Salesmen+MaxRows_Sale smen-1,Salesmen.RecordCount)>
    <cfset TotalPages_Salesmen=Ceiling(Salesmen.RecordCount/MaxRows_Salesmen)>
    <cfset QueryString_Salesmen=Iif(CGI.QUERY_STRING NEQ
    "",DE("&"&XMLFormat(CGI.QUERY_STRING)),DE("")) >
    <cfset
    tempPos=ListContainsNoCase(QueryString_Salesmen,"P ageNum_Salesmen=","&")>
    <cfif tempPos NEQ 0>
    <cfset QueryString_Salesmen=ListDeleteAt(QueryString_Sale smen,tempPos,"&")>
    </cfif>
    <!--- Include the header --->
    <cfinclude template="/Included_Templates/aioheader.cfm">
    <link href="mainStylesheet.css" rel="stylesheet" type="text/css" />
    <!--
    .style1 {font-size: 10pt; line-height: 12pt; font-weight: bold;
    text-decoration: none; padding-right: 3px; padding-left: 3px; font-family:
    Arial, Helvetica, sans-serif;}
    body {
    background-color: #CECECE;
    }
    -->
    <!--- Your page goes here --->
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_reloadPage(init) { //reloads the window if Nav4 resized
    if (init==true) with (navigator) {if
    ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
    onresize=MM_reloadPage; }}
    else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
    location.reload();
    }
    MM_reloadPage(true);
    //-->
    </script>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
    <cfoutput><div align="center"><p class="redhead">#Salesmen.Category#'s
    Equipment<br />
    <a
    href="#CurrentPage#?PageNum_Salesmen=#Min(Incremen tValue(PageNum_Salesmen),Total
    Pages_Salesmen)##QueryString_Salesmen#" class="copy2">See More Products
    </a><span class="copy2">&gt;&nbsp;&nbsp;&lt;<a
    href="#CurrentPage#?PageNum_Salesmen=#Max(Decremen tValue(PageNum_Salesmen),1)##Q
    ueryString_Salesmen#" class="copy2">Back to last page<br>
    <br>
    </a></span></p>
    </div></cfoutput>
    <table width="25%" border="0" cellpadding="0" cellspacing="0">
    <!--DWLayoutTable-->
    <tr> <cfoutput query="Salesmen" startrow="#StartRow_Salesmen#"
    maxrows="#MaxRows_Salesmen#">
    <td width="100%" height="134" valign="top"><p align="center"><a
    href="#Salesmen.Thumbnails#"><img src="#Salesmen.Thumbnails#" alt="Salesmen's
    racks, bags, cases, and accessories" name="Salesmen" width="117" height="117"
    border="0" class="pixbox" id="Salesmen"/></a><br>
    <span class="productname">#Salesmen.Name#<br>
    #Salesmen.Product_Class#</span><span class="copy2"><br>
    <span class="clickonimage">Click image for details </span>
    </span></p>
    </td>
    </cfoutput></tr>

    <cfoutput query="Salesmen" startRow="#StartRow_Salesmen#"
    maxRows="#MaxRows_Salesmen#"></cfoutput>
    </table>

    Artspan Guest

  2. Similar Questions and Discussions

    1. Why doesn't the Code Completion occur in FlexBuilder IDEwhen source code is in an external file?
      I am seperating my .as from the MXML by using the following in my file.mxml: <mx:Script source="file.as"> When I edit file.as, the code...
    2. How would I include the Open Browser code into this lineof code?
      Hello and thankyou in advance: I have an ASP page linked to my database and I want to apply the Open Browser behaviour to the code. I have tried...
    3. Custom control fires event but ignores some code in the code behind file
      I do not quite understand the question. I will merely point out that most programming problems happen for a reason. Code works the way it is...
    4. Custom tool warning: DiscoCodeGenerator unable to initialize code generator. No code generated.
      I created a brand new WebService (HelloWorld) and when I attempt to add this WebService to a WindowsForm project I get the following error message in...
    5. Security problem with Managed Code calling Unmanaged Code in a Web Page
      Hello, I have a web page which contains an ActiveX control (unmanaged) and a Windows Forms User Control (managed). Both reside on a web page and...
  3. #2

    Default Re: Need help with some code

    This should work its set to repeat on 8 items per row. you can change it
    though.

    <table width="25%" border="0" cellpadding="0" cellspacing="0">
    <!--DWLayoutTable-->
    <tr> <cfoutput query="Salesmen" startrow="#StartRow_Salesmen#"
    maxrows="#MaxRows_Salesmen#">
    <td width="100%" height="134" valign="top"><p align="center"><a
    href="#Salesmen.Thumbnails#"><img src="#Salesmen.Thumbnails#" alt="Salesmen's
    racks, bags, cases, and accessories" name="Salesmen" width="117" height="117"
    border="0" class="pixbox" id="Salesmen"/></a><br>
    <span class="productname">#Salesmen.Name#<br>
    #Salesmen.Product_Class#</span><span class="copy2"><br>
    <span class="clickonimage">Click image for details </span>
    </span></p>
    </td>
    <cfscript>
    if (Salesmen.CurrentRow mod 8 eq 0 AND NOT Salesmen.CurrentRow eq
    Salesmen.RecordCount) {
    writeoutput("</tr><tr>");
    }
    </cfscript>
    </cfoutput>
    </table>

    LuckyNinja Guest

  4. #3

    Default Re: Need help with some code

    Thank you. Unfortunately, this doesn't work. It still comes up as only one row. Any other suggestions?

    Thanks much!
    Artspan Guest

  5. #4

    Default Re: Need help with some code

    Sorry about that didn't really have much time to test it on your code but that
    little cfscript snippet work. That code is from a working site i did a while
    back let me post up the whole page that its from and you can try to manipulate
    it from there.

    <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td class="regText">Check out pictures from past classes,
    graduation parties, flair competitions and much, much more.</td>
    </tr>

    <tr>
    <td height="1">&nbsp;</td>
    </tr>
    <tr>
    <td height="105" valign="top">
    <div id="sideBar">
    <table width="90" border="0" cellspacing="0" cellpadding="0"
    align="center">

    <tr>
    <cfoutput query="qGallery" group="galleryID">
    <td align="center" valign="top">
    <table width="85" border="0" align="left" cellpadding="3"
    cellspacing="0">
    <tr>
    <td align="center" valign="top"><a
    href="detail.cfm?galleryID=#qGallery.galleryID#">< img
    src="/assets/images/gallery/thumbs/#qGallery.fileName#"
    alt="#qGallery.galleryName#" width="75" height="75" border="1"
    align="absmiddle" style="border-color:##003366"><br>
    </a><a href="detail.cfm?galleryID=#qGallery.galleryID#"
    class="regText">#qGallery.galleryName#</a></td>
    </tr>
    </table></td>

    <cfscript>
    if (qGallery.CurrentRow mod 8 eq 0 AND NOT qGallery.CurrentRow eq
    qGallery.RecordCount) {
    writeoutput("</tr><tr>");
    }
    </cfscript>
    </cfoutput>
    </table></div>

    </td>
    </tr>
    </table>

    LuckyNinja Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139