Avatar of kevp75
kevp75Flag for United States of America

asked on 

Validation Problems

I have a link directory and photo gallery that are giving me problems with xhtml transitional validation problems.

They both are directory structured(categorized), where I have 2 columns of categories.  I use 2 different methods to get it to have 2 columns, and both work to display how I need it too, however neither one validates.

http://www.portalfanatic.com/links/
http://www.portalfanatic.com/gallery/

are the 2 pages.
There are other included files, the functions that do the work.  SelectDB is an array of records where (x,y) x=field#, y=row

/links/ code is:
<!--#include virtual="/includes/header.asp"-->
<h2>Our Link Directory</h2>
      <!--Content Starts Here-->
      <%
      if not adminCheck() then
            x = "lVerified = 1 AND "
      end if
      if pCat = "" OR ISNULL(pCat) OR pCat = "0" then
            pCat = 0
            catSQL="gcID <> 0 AND parentID = 0"
      else
            pCat = pCat
            catSQL="parentID = "&pCat
      end if
      cPerPage = 100000
            pageNum=request.querystring("page")
      if pageNum = "" OR ISNULL(pageNum) then
            pageNum = 1
      else
            pageNum = cint(pageNum)
      end if
      Call SelectDB(inrsConn, "gcID, parentID, gCat", "ModLinksCats", catSQL, "gCat", cPerPage, 1, lCats, strError, isEOF, lngRecordCount1)
      If Not IsArray(lCats) Then
            write("There are no categories yet.")
            write(strError)
      else
      
         Dim intColNo
         Dim strCellContent
         intColNo = 0
         strCellContent = "<img src='/storage/images/comment.gif' alt='Category' /> <a href='?pCat=##PCID##'>##PNAME##</a>"
         Dim strHtml
         For row = 0 To UBound(lCats, 2) - 1
            If intColNo < 2 Then
             intColNo = intColNo + 1
            Else
             strHtml = strHtml & "</tr>"
             intColNo = 1
             strHtml = strHtml & "<tr>"
            End If
         strHtml = strHtml & "<td width='50%' valign='top'><div style='width:75%;'><strong>" & Replace(Replace(strCellContent, "##PCID##", lCats(0,row)), "##PNAME##", lCats(2,row)) & " ("&getCount(inrsConn,"ModLinksLinks"," WHERE lVerified = 1 AND lcID = "&lCats(0,row))&" links)</strong></div>"
        %>
       <!--#include virtual="/links/scats.asp"-->
        <%
            strHtml = strHtml & "</td>"
         Next
         If intColNo < 2 Then
             strHtml = strHtml & "<td>&nbsp;</td></tr>"
         Else
             strHtml = strHtml & "</tr>"
         End If
         Response.Write "<table style='width:100%'>" & strHtml & "</table>"
      end if%>
            <br /><br />
            <%if pCat > 0 then%>
            <table width="100%" border="0" cellspacing="0" cellpadding="2">
            <tr>
                  <td><h2>Links</h2></td>
            </tr>
            <tr>
                  <td style="padding-left:15px;">
                  <table width="100%" border="0" cellspacing="0" cellpadding="1">
                        <tr>
                              <td>&nbsp;</td>
                  <%if pCat = "" OR ISNULL(pCat) OR pCat = "0" then
                        lPerPage = 5
                        lSQL="lVerified = 1 AND topCat = 1"
                  else
                        lPerPage = 25
                        lSQL="lVerified = 1 AND lcID = "&pCat
                  end if
                  Call SelectDB(inrsConn, "linkID, lcID, lName, lDesc, lURL, lPosted, lHits, uID", "ModLinksLinks", lSQL, "lHits DESC, lPosted DESC", lPerPage, pageNum, lLinks, strError, isEOF, lngRecordCount2)
                  pages = RoundUp(lngRecordCount2 / lPerPage)
                        if nxtPage >=  pages then
                              nxtPage = pages
                        else
                              if pages = pageNum then
                                    nxtPage = pageNum
                              else
                                    nxtPage = pageNum + 1
                              end if
                        end if
            if pageNum <= 1 then
                  prevPage = 1
            else
                  prevPage = pageNum - 1
            end if
            write "<td align='right' style='padding-right:25px;'><strong>PAGING:</strong> <a name='First Page' href='default.asp?page=1&amp;pCat="&pCat&"'>&lt;&lt;</a> | <a name='Previous Page' href='/links/?page="&prevPage&"&amp;pCat="&pCat&"'>&lt;</a> | <a name='Next Page' href='/links/?page="&nxtPage&"&amp;pCat="&pCat&"'>></a> | <a name='Last Page' href='/links/?page="&pages&"&amp;pCat="&pCat&"'>>></a></td></tr></table>"
                  If Not IsArray(lLinks) Then
                        write("There are no links in this category yet.")
                  else
                        For lrow = 0 To UBound(lLinks, 2) - 1
                        %>
                        <table width="100%" border="0" cellspacing="0" cellpadding="1">
                              <tr>
                                    <td><h2><a href="/links/lhit.asp?lID=<%=lLinks(0,lrow)%>" target="_blank"><%=lLinks(2,lrow)%></a></h2></td>
                              </tr>
                              <tr>
                                    <td style="padding-left:15px;"><%=lLinks(3,lrow)%>&nbsp;</td>
                              </tr>
                        </table>
                        <%
                        Next
                  End if
%>                  </td>
            </tr>
      </table><%end if%>
      <!--Content Ends Here-->
scats.asp is just a loop through 10 or so records, and displays them under the parent category and is in the same <td></td> as is the parent category.


/gallery/ code is:
      <!--Content Starts Here-->
      <h2>Our Photo Gallery</h2>
      <%
      if pCat = "" OR ISNULL(pCat) OR pCat = "0" then
            pCat = 0
            catSQL="gcID <> 0 AND parentID = 0"
      else
            pCat = pCat
            catSQL="parentID = "&pCat
      end if
      if not userCheck() then
            catSQL = catSQL &" AND gcPriv = 0"
      else
            catSQL = catSQL &" AND gcPriv = 0 OR (gcPriv = 1 AND uID = "&uID&")"
      end if
      cPerPage = 10000
            pageNum=request.querystring("page")
      if pageNum = "" OR ISNULL(pageNum) then
            pageNum = 1
      else
            pageNum = cint(pageNum)
      end if
      
      Call SelectDB(inrsConn, "gcID, parentID, gCat", "ModPicCats", catSQL, "gcPriv DESC, gcOrder, gCat", cPerPage, 1, gCats, strError, isEOF, lngRecordCount1)
      If Not IsArray(gCats) Then
            write("There are no albums yet.")
      else
            %>
            <table width="100%" border="0" cellspacing="0"><tr>
            <%
            recPerRow = 2
            For row = 0 To UBound(gCats, 2) - 1
                If row mod recPerRow = 0 Then
                  Call SelectDB(inrsConn, "gID", "ModPicPics", "gcID = "&gCats(0,row), "", cPerPage, 1, gp, strError, isEOF, lngRecordCountpp)
                        if lngRecordCountpp = "" OR ISNULL(lngRecordCountpp) then
                              pc=0
                        else
                              pc=lngRecordCountpp
                        end if
                    write "<td width='50%' style='padding:5px;' valign='top'><div style='padding:2px;width:75%;'><img src='/storage/images/comment.gif' alt='Category' /> <a href='/gallery/?pCat="&gCats(0,row)&"'><strong>"&gCats(2,row)&"</strong></a> <span class='footer' style='font-weight:bold;'>("&pc&" pics)</span></div>"
                    %>
                    <div style='width:75%;padding-left:15px;'><%response.cookies("k")=gCats(0,row)%><!--#include virtual="/gallery/picsCats.asp"--><%response.cookies("k")=""%></div>
                    <%write "</td>"
                  Else
                  Call SelectDB(inrsConn, "gID", "ModPicPics", "gcID = "&gCats(0,row), "", cPerPage, 1, gp, strError, isEOF, lngRecordCountpl)
                        if lngRecordCountpl = "" OR ISNULL(lngRecordCountpl) then
                              pl=0
                        else
                              pl=lngRecordCountpl
                        end if
                    write "<td width='50%' style='padding:5px;' valign='top'><div style='padding:2px;width:75%;'><img src='/storage/images/comment.gif' alt='Category' /> <a href='/gallery/?pCat="&gCats(0,row)&"'><strong>"&gCats(2,row)&"</strong></a> <span class='footer' style='font-weight:bold;'>("&pl&" pics)</span></div>"
%>
                    <div style='width:75%;padding-left:15px;'><%response.cookies("k")=gCats(0,row)%><!--#include virtual="/gallery/picsCats.asp"--><%response.cookies("k")=""%></div>
                    <%write "</td>"
                  End If
                  If row mod recPerRow = 0 Then
                    write ""
                  Else
                    write "</tr><tr>"
                  End If
            Next
            %>
            </table>
      <%end if%>
      <%if pCat <> 0 then%><br />
      <table width="100%" border="0" cellspacing="0" cellpadding="2">
            <tr>
                  <td><h2>Photos</h2></td>
            </tr>
            <tr>
                  <td style="padding-left:15px;"><!--#include virtual="/gallery/pics.asp"--></td>
            </tr>
      </table>
      <%end if%>
      <!--Content Ends Here-->
pics.asp displays the thumbnails if there are any, picsscats.asp displays the child categories, as listed under the parent category

neither one of these methods validates, and thoughts as to why?
ASP

Avatar of undefined
Last Comment
kevp75
ASKER CERTIFIED SOLUTION
Avatar of peterxlane
peterxlane

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of kevp75
kevp75
Flag of United States of America image

ASKER

adding the opening <tr> before and after For row = 0 To UBound(lCats, 2) - 1 throws everything out of whack, in the sense of display. putting it before, and the site footer is in the same column as the Site Search.  After doesn't give me the 2 columns

i mainly use a stylesheet.  I would rather use tables than divs, as for the most part I am displaying tabular data.  I've noticed that using divs makes the site all inline when using FireFox
Avatar of peterxlane
peterxlane

I didn't have too much time to analyze your code and it is difficult to troubleshoot without having the database, but this was a sample I put together:

<%
Dim myArray(1,1)
myArray(0,0) = "Portal Systems"
myArray(0,1) = "Web Design"

Sub GetArrayValues(whichArray)
      If whichArray = "0" Then
            linkArray = Split("ASP|ASP.Net", "|")
      Else
            linkArray = Split("Design Companies|Hosting Companies", "|")
      End If
      
      For x = 0 To UBound(linkArray)
            Response.Write  linkArray(x) & " " & vbcrlf
      Next
End Sub
%>
 

<table border="1" cellpadding="3" cellspacing="0">
<%
For i = 0 To UBound(myArray, 1)
      Response.Write "      <tr>" & vbcrlf
      Response.Write "            <td width=""50%"" valign=""top""><strong>" & myArray(0,i) & "</strong></div>" & vbcrlf
      Call GetArrayValues(i)
      Response.Write "            </td>" & vbcrlf
      Response.Write "      </tr>" & vbcrlf       
Next
%>      
</table>

This has the added bonus that it does not use string concatenation, so it will definitely load faster. (http://www.adopenstatic.com/experiments/stringconcatenation.asp)



As for the CSS stuff....  I was speaking more about using classes on your different elements, not necessarily converting everything to divs.  For example:

<li style="border-top:1px solid #CCC;"><a href="/">HOME</a></li>

could simply be:

<li class="menuitem"><a href="/">HOME</a></li>

and the border properties could then be controlled from a single external stylesheet.  If you then wanted to change the whole site it would be easy, or you could even store the site colors in a database and create your stylesheet dynamicly.... but this is completely off track

:-)
Avatar of kevp75
kevp75
Flag of United States of America image

ASKER

doh!

putting: strHtml = "<tr>" ',  works
strHtml = "</tr><tr>" was throwing it out of whack.  I had opened a row in an administrative section right above the above code.

to be honest, I didn't/can't post the entire code. The rest of the code is mainly admin stuff.

now..the problem with the gallery is?  well....since the table structure is similar, I can just copy from the links code, change some fields and be golden.

Points to you peterxlane...thank you :) !
Avatar of kevp75
kevp75
Flag of United States of America image

ASKER

a little off the beaten path a bit.....but what use is the  & vbcrlf at the end of the rows.....'view source' friendly?
ASP
ASP

Active Server Pages (ASP) is Microsoft’s first server-side engine for dynamic web pages. ASP’s support of the Component Object Model (COM) enables it to access and use compiled libraries such as DLLs. It has been superseded by ASP.NET, but will be supported by Internet Information Services (IIS) through at least 2022.

82K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo