Attn: Bill Wilkinson

Results 1 to 2 of 2

Thread: Attn: Bill Wilkinson

  1. #1
    Join Date
    Dec 1969

    Default Attn: Bill Wilkinson

    Hi Bill, you assisted me with this awhile back and I&#039;ve manage to get the code working: I&#039;m trying to page a long text file entered into a tex box via "cut and paste" method (back end admin panel). Here&#039;s my code without the pageing code: does it have to do with type of document I&#039;m cutting the article from?<BR><BR>Problem: I get an error:Invalid procedure call or argument: &#039;Mid&#039;<BR>/wedding/articles2.asp, line 67<BR><BR>&#060;% <BR>txt = strText<BR>chopat = InStrRev( txt, vbLF, 1000) &#039; chop at paragraph prior to 10K characters <BR>smallerTxt = Left( txt, chopat ) <BR>restofTxt = Mid(txt, chopat+1 ) <BR>&#039;response.Write(smallerTxt)<BR>%&#062; <BR>&#060;% <BR>&#039;response.Write(CurPage)<BR>startAt = (CurPage-1) * 1000 + 1 <BR>endAt = CurPage * 1000 <BR>If startAt &#060;&#062; 1 Then <BR> startAt = InStrRev( txt, vbLF, startAt ) <BR>End If <BR>endAt = InStrRev( txt, vbLF, endAt ) <BR>showText = Mid( txt, startAt+1, endAt-startAt )&#039;line 67 <BR>response.Write(showText)<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default No no no...

    You only wanted *ONE* of those scripts! The first one was just to demo the principal, and it *always* gets the first page, only.<BR><BR>But there are a few errors in the second one (it was, after all, only supposed to be the *CONCEPT* of how to code this, not a finished product!). Since you didn&#039;t seem to know how to debug it, I did. And fixed it. And here&#039;s a demo:<BR><BR>***************************<BR>&lt;HT ML&#062;&lt;BODY&#062;<BR>&lt;% <BR>CONST PAGESIZE = 100<BR><BR>CurPage = Request("CurPage")<BR>If IsNumeric(CurPage) Then CurPage = CINT(Curpage) Else CurPage=1<BR>If CurPage &lt; 1 Then CurPage = 1<BR>%&#062;<BR>&lt;H2&#062;Showing Page &lt;%=CurPage%&#062;&lt;/H2&#062;<BR><BR>&lt;%<BR>txt = "This is just some dummy text for demonstration purposes." & vbNewLine & _<BR> "Once upon a midnight dreary, " & vbNewLine & _<BR> "While I pondered, weak and weary, " & vbNewLine & _<BR> "O&#039;er many a tome of long forgotten lore," & vbNewLine & _<BR> "Came a knocking, gently rapping," & vbNewLine & _<BR> "At my chamber door." & vbNewLine & _<BR> "T&#039;was brillig and the slithy toves" & vbNewLine & _<BR> "Did gyre and gymbal in the wabe;" & vbNewLine & _<BR> "All mimsy were the borogoves" & vbNewLine & _<BR> "And the mome raths outgrabe." & vbNewLine & _<BR> "Deck us all with Boston Charlie," & vbNewLine & _<BR> "Walla Walla, Wash., and Kalamazoo." & vbNewLine & _<BR> "Nora&#039;s freezin&#039; on the trolley," & vbNewLine & _<BR> "Ashtabula, Pensacoola, hullabaloo." & vbNewLine <BR><BR>startAt = (CurPage-1) * PAGESIZE <BR>endAt = CurPage * PAGESIZE<BR>If endAt &#062; Len(txt) Then endAt = Len(txt)<BR>Response.Write "RAW DEBUG: startAt=" & startAt & ", endAt=" & endAt & ", len=" & (endAt-startAt) & "&lt;P&#062;"<BR>If startAt &#062; Len(txt) Then<BR> Response.Write "Sorry, no more to show."<BR> Response.End<BR>End If<BR>If startAt &lt;&#062; 0 Then <BR> startAt = InStrRev( txt, vbLF, startAt ) <BR>End If <BR>endAt = InStrRev( txt, vbLF, endAt ) <BR>Response.Write "DEBUG: startAt=" & startAt & ", endAt=" & endAt & ", len=" & (endAt-startAt) & "&lt;P&#062;"<BR>showText = Mid( txt, startAt+1, endAt-startAt )<BR>Response.Write "&lt;HR&#062;" & Replace( showText, vbLF, vbLF & "&lt;BR/&#062;" )<BR>%&#062;<BR>&lt;HR&#062;<BR>&lt;FORM&#062;<BR> Show page # &lt;INPUT Type=Submit Name="CurPage" Value="&lt;%=(CurPage+1)%&#062;" &#062;<BR>&lt;/FORM&#062;<BR>&lt;/BODY&#062;&lt;/HTML&#062;<BR>

Posting Permissions

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