Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

hudsonalves

Retirar Refresh

Recommended Posts

Estou usando este script para paginação, ele é muito bom, mas estou tendo problema com refresh na página, é possível retirar?

<%
Dim HLoopernews2__numRows
HLoopernews2__numRows = -2
Dim HLoopernews2__index
HLoopernews2__index = 0
rsTypesNews_numRows = rsTypesNews_numRows + HLoopernews2__numRows
%>
<%
Dim MM_paramNameNews 
%>
<%
' *** Move To Record: handle 'index' or 'news' parameter

if (Not MM_paramIsDefined And MM_rsNewsCount <> 0) then

  ' use index parameter if defined, otherwise use news parameter
  MM_param = Request.QueryString("index")
  If (MM_param = "") Then
    MM_param = Request.QueryString("news")
  End If
  If (MM_param <> "") Then
    MM_news = Int(MM_param)
  End If

  ' if we have a record count, check if we are past the end of the recordset
  If (MM_rsNewsCount <> -1) Then
    If (MM_news >= MM_rsNewsCount Or MM_news = -1) Then  ' past end or move last
      If ((MM_rsNewsCount Mod MM_size) > 0) Then         ' last page not a full repeat region
        MM_news = MM_rsNewsCount - (MM_rsNewsCount Mod MM_size)
      Else
        MM_news = MM_rsNewsCount - MM_size
      End If
    End If
  End If

  ' move the cursor to the selected record
  MM_index = 0
  While ((Not MM_rsNews.EOF) And (MM_index < MM_news Or MM_news = -1))
    MM_rsNews.MoveNext
    MM_index = MM_index + 1
  Wend
  If (MM_rsNews.EOF) Then 
    MM_news = MM_index  ' set MM_news to the last possible record
  End If

End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range

If (MM_rsNewsCount = -1) Then

  ' walk to the end of the display range for this page
  MM_index = MM_news
  While (Not MM_rsNews.EOF And (MM_size < 0 Or MM_index < MM_news + MM_size))
    MM_rsNews.MoveNext
    MM_index = MM_index + 1
  Wend

  ' if we walked off the end of the recordset, set MM_rsNewsCount and MM_size
  If (MM_rsNews.EOF) Then
    MM_rsNewsCount = MM_index
    If (MM_size < 0 Or MM_size > MM_rsNewsCount) Then
      MM_size = MM_rsNewsCount
    End If
  End If

  ' if we walked off the end, set the news based on page size
  If (MM_rsNews.EOF And Not MM_paramIsDefined) Then
    If (MM_news > MM_rsNewsCount - MM_size Or MM_news = -1) Then
      If ((MM_rsNewsCount Mod MM_size) > 0) Then
        MM_news = MM_rsNewsCount - (MM_rsNewsCount Mod MM_size)
      Else
        MM_news = MM_rsNewsCount - MM_size
      End If
    End If
  End If

  ' reset the cursor to the beginning
  If (MM_rsNews.CursorType > 0) Then
    MM_rsNews.MoveFirst
  Else
    MM_rsNews.Requery
  End If

  ' move the cursor to the selected record
  MM_index = 0
  While (Not MM_rsNews.EOF And MM_index < MM_news)
    MM_rsNews.MoveNext
    MM_index = MM_index + 1
  Wend
End If
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links

Dim MM_keepMoveNews
Dim MM_moveParamNews
Dim MM_moveFirstNews
Dim MM_moveLastNews
Dim MM_moveNextNews
Dim MM_movePrevNews

Dim MM_urlStrNews
Dim MM_paramListNews
Dim MM_paramIndexNews
Dim MM_nextParamNews

MM_keepMoveNews = MM_keepBoth
MM_moveParamNews = "index"

' if the page has a repeated region, remove 'news' from the maintained parameters
If (MM_size > 1) Then
  MM_moveParamNews = "news"
  If (MM_keepMoveNews <> "") Then
    MM_paramListNews = Split(MM_keepMoveNews, "&")
    MM_keepMoveNews = ""
    For MM_paramIndexNews = 0 To UBound(MM_paramListNews)
      MM_nextParamNews = Left(MM_paramListNews(MM_paramIndexNews), InStr(MM_paramListNews(MM_paramIndexNews),"=") - 1)
      If (StrComp(MM_nextParamNews,MM_moveParamNews,1) <> 0) Then
        MM_keepMoveNews = MM_keepMoveNews & "&" & MM_paramListNews(MM_paramIndexNews)
      End If
    Next
    If (MM_keepMoveNews <> "") Then
      MM_keepMoveNews = Right(MM_keepMoveNews, Len(MM_keepMoveNews) - 1)
    End If
  End If
End If

' set the strings for the move to links
If (MM_keepMoveNews <> "") Then 
  MM_keepMoveNews = MM_keepMoveNews & "&"
End If

MM_urlStrNews = Request.ServerVariables("URL") & "?" & MM_keepMoveNews & MM_moveParamNews & "="

MM_moveFirstNews = MM_urlStrNews & "0"
MM_moveLastNews  = MM_urlStrNews & "-1"
MM_moveNextNews  = MM_urlStrNews & CStr(MM_news + MM_size)
If (MM_news - MM_size < 0) Then
  MM_movePrevNews = MM_urlStrNews & "0"
Else
  MM_movePrevNews = MM_urlStrNews & CStr(MM_news - MM_size)
End If
%>
<%
Dim HLooperNews__numRows
HLooperNews__numRows = 8
Dim HLooperNews__index
HLooperNews__index = 0
rsTypesNews_numRows = rsTypesNews_numRows + HLooperNews__numRows
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

' set the record count
rsTypesNews_total = rsTypesNews.RecordCount

' set the number of rows displayed on this page
If (rsTypesNews_numRows < 0) Then
  rsTypesNews_numRows = rsTypesNews_total
Elseif (rsTypesNews_numRows = 0) Then
  rsTypesNews_numRows = 1
End If

' set the first and last displayed record
rsTypesNews_first = 1
rsTypesNews_last  = rsTypesNews_first + rsTypesNews_numRows - 1

' if we have the correct record count, check the other stats
If (rsTypesNews_total <> -1) Then
  If (rsTypesNews_first > rsTypesNews_total) Then rsTypesNews_first = rsTypesNews_total
  If (rsTypesNews_last > rsTypesNews_total) Then rsTypesNews_last = rsTypesNews_total
  If (rsTypesNews_numRows > rsTypesNews_total) Then rsTypesNews_numRows = rsTypesNews_total
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (rsTypesNews_total = -1) Then

  ' count the total records by iterating through the recordset
  rsTypesNews_total=0
  While (Not rsTypesNews.EOF)
    rsTypesNews_total = rsTypesNews_total + 1
    rsTypesNews.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (rsTypesNews.CursorType > 0) Then
    rsTypesNews.MoveFirst
  Else
    rsTypesNews.Requery
  End If

  ' set the number of rows displayed on this page
  If (rsTypesNews_numRows < 0 Or rsTypesNews_numRows > rsTypesNews_total) Then
    rsTypesNews_numRows = rsTypesNews_total
  End If

  ' set the first and last displayed record
  rsTypesNews_first = 1
  rsTypesNews_last = rsTypesNews_first + rsTypesNews_numRows - 1
  If (rsTypesNews_first > rsTypesNews_total) Then rsTypesNews_first = rsTypesNews_total
  If (rsTypesNews_last > rsTypesNews_total) Then rsTypesNews_last = rsTypesNews_total

End If
%>
<%
' *** Move To Record and Go To Record: declare variables

Set MM_rsNews    = rsTypesNews
MM_rsNewsCount   = rsTypesNews_total
MM_size      = rsTypesNews_numRows
MM_uniqueCol = ""
MM_paramNameNews = ""
MM_news = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramNameNews <> "") Then
  MM_paramIsDefined = (Request.QueryString(MM_paramNameNews) <> "")
End If
%>
<%
' *** Move To Record: handle 'index' or 'news' parameter

if (Not MM_paramIsDefined And MM_rsNewsCount <> 0) then

  ' use index parameter if defined, otherwise use news parameter
  r = Request.QueryString("index")
  If r = "" Then r = Request.QueryString("news")
  If r <> "" Then MM_news = Int(r)

  ' if we have a record count, check if we are past the end of the recordset
  If (MM_rsNewsCount <> -1) Then
    If (MM_news >= MM_rsNewsCount Or MM_news = -1) Then  ' past end or move last
      If ((MM_rsNewsCount Mod MM_size) > 0) Then         ' last page not a full repeat region
        MM_news = MM_rsNewsCount - (MM_rsNewsCount Mod MM_size)
      Else
        MM_news = MM_rsNewsCount - MM_size
      End If
    End If
  End If

  ' move the cursor to the selected record
  i = 0
  While ((Not MM_rsNews.EOF) And (i < MM_news Or MM_news = -1))
    MM_rsNews.MoveNext
    i = i + 1
  Wend
  If (MM_rsNews.EOF) Then MM_news = i  ' set MM_news to the last possible record

End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range

If (MM_rsNewsCount = -1) Then

  ' walk to the end of the display range for this page
  i = MM_news
  While (Not MM_rsNews.EOF And (MM_size < 0 Or i < MM_news + MM_size))
    MM_rsNews.MoveNext
    i = i + 1
  Wend

  ' if we walked off the end of the recordset, set MM_rsNewsCount and MM_size
  If (MM_rsNews.EOF) Then
    MM_rsNewsCount = i
    If (MM_size < 0 Or MM_size > MM_rsNewsCount) Then MM_size = MM_rsNewsCount
  End If

  ' if we walked off the end, set the news based on page size
  If (MM_rsNews.EOF And Not MM_paramIsDefined) Then
    If (MM_news > MM_rsNewsCount - MM_size Or MM_news = -1) Then
      If ((MM_rsNewsCount Mod MM_size) > 0) Then
        MM_news = MM_rsNewsCount - (MM_rsNewsCount Mod MM_size)
      Else
        MM_news = MM_rsNewsCount - MM_size
      End If
    End If
  End If

  ' reset the cursor to the beginning
  If (MM_rsNews.CursorType > 0) Then
    MM_rsNews.MoveFirst
  Else
    MM_rsNews.Requery
  End If

  ' move the cursor to the selected record
  i = 0
  While (Not MM_rsNews.EOF And i < MM_news)
    MM_rsNews.MoveNext
    i = i + 1
  Wend
End If
%>
<%
' *** Move To Record: update recordset stats

' set the first and last displayed record
rsTypesNews_first = MM_news + 1
rsTypesNews_last  = MM_news + MM_size
If (MM_rsNewsCount <> -1) Then
  If (rsTypesNews_first > MM_rsNewsCount) Then rsTypesNews_first = MM_rsNewsCount
  If (rsTypesNews_last > MM_rsNewsCount) Then rsTypesNews_last = MM_rsNewsCount
End If

' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsNewsCount <> -1 And MM_news + MM_size >= MM_rsNewsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramNameNews <> "") Then MM_removeList = MM_removeList & "&" & MM_paramNameNews & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
  NextItem = "&" & Item & "="
  If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
  NextItem = "&" & Item & "="
  If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "")  Then MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links

MM_keepMoveNews = MM_keepBoth
MM_moveParamNews = "index"

' if the page has a repeated region, remove 'news' from the maintained parameters
If (MM_size > 0) Then
  MM_moveParamNews = "news"
  If (MM_keepMoveNews <> "") Then
    params = Split(MM_keepMoveNews, "&")
    MM_keepMoveNews = ""
    For i = 0 To UBound(params)
      nextItem = Left(params(i), InStr(params(i),"=") - 1)
      If (StrComp(nextItem,MM_moveParamNews,1) <> 0) Then
        MM_keepMoveNews = MM_keepMoveNews & "&" & params(i)
      End If
    Next
    If (MM_keepMoveNews <> "") Then
      MM_keepMoveNews = Right(MM_keepMoveNews, Len(MM_keepMoveNews) - 1)
    End If
  End If
End If

' set the strings for the move to links
If (MM_keepMoveNews <> "") Then MM_keepMoveNews = MM_keepMoveNews & "&"
urlStr = Request.ServerVariables("URL") & "?" & MM_keepMoveNews & MM_moveParamNews & "="
MM_moveFirstNews = urlStr & "0"
MM_moveLastNews  = urlStr & "-1"
MM_moveNextNews  = urlStr & Cstr(MM_news + MM_size)
prev = MM_news - MM_size
If (prev < 0) Then prev = 0
MM_movePrevNews  = urlStr & Cstr(prev)
%>
<%
Dim rsTypesNews_TFMcurrentPage
Dim rsTypesNews_TFMtotalPages
If MM_size > 0 Then
rsTypesNews_TFMcurrentPage = Round(rsTypesNews_last/MM_size + .4999)
rsTypesNews_TFMtotalPages = Round(rsTypesNews_total/MM_size + .4999)
End If
%>

Chamo os botões aqui:

<%
		TFM_MiddlePages = 100
		TFM_startLink = MM_news/MM_size - int(TFM_middlePages/2)
		TFM_endLink = MM_news/MM_size + int(TFM_middlePages/2) 
		If TFM_MiddlePages/2 <> int(TFM_MiddlePages/2) Then TFM_endLink = TFM_endLink + 1
		If TFM_startLink < 0 then 
		   TFM_startLink = 0
		   TFM_endLink = TFM_middlePages 
		End If
		TFM_LimitCounter = 0
		For i = 1 to rsTypesNews_total Step MM_size
		TFM_LimitCounter = TFM_LimitCounter + 1
		TFM_LimitPageEndCount = i + MM_size - 1
		if TFM_LimitPageEndCount > rsTypesNews_total Then TFM_LimitPageEndCount = rsTypesNews_total
		If TFM_LimitCounter > TFM_startLink AND TFM_LimitCounter <= TFM_endLink Then
		if i <> MM_news + 1 then
		Response.Write("<button class=btn btn-blue>")
		Response.Write("<a href=""" & Request.ServerVariables("URL") & "?" & MM_keepMoveNews & "news=" & i-1 & """>")
		Response.Write(TFM_LimitCounter & "</a>")
		Response.Write("</button>")
		else
		Response.Write("<button class=btn btn-blue>Página " & TFM_LimitCounter & "</button>")
		End if
		if(TFM_LimitPageEndCount <> rsTypesNews_total AND TFM_endLink <> TFM_LimitCounter) then Response.Write(" - ")
		end if
		next
		%>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Olá Ronaldo,

 

 

Falou apenas a parte da coleta de dados, mas acho que não tem a ver esta parte:

<head>
<% If Not rsTypesNews.EOF Or Not rsTypesNews.BOF Then %>
</head>
<div class="col-md-12 column">
		<%
		TFM_MiddlePages = 100
		TFM_startLink = MM_news/MM_size - int(TFM_middlePages/2)
		TFM_endLink = MM_news/MM_size + int(TFM_middlePages/2) 
		If TFM_MiddlePages/2 <> int(TFM_MiddlePages/2) Then TFM_endLink = TFM_endLink + 1
		If TFM_startLink < 0 then 
		   TFM_startLink = 0
		   TFM_endLink = TFM_middlePages 
		End If
		TFM_LimitCounter = 0
		For i = 1 to rsTypesNews_total Step MM_size
		TFM_LimitCounter = TFM_LimitCounter + 1
		TFM_LimitPageEndCount = i + MM_size - 1
		if TFM_LimitPageEndCount > rsTypesNews_total Then TFM_LimitPageEndCount = rsTypesNews_total
		If TFM_LimitCounter > TFM_startLink AND TFM_LimitCounter <= TFM_endLink Then
		if i <> MM_news + 1 then
		Response.Write("<button class=btn btn-blue>")
		Response.Write("<a href=""" & Request.ServerVariables("URL") & "?" & MM_keepMoveNews & "news=" & i-1 & """>")
		Response.Write(TFM_LimitCounter & "</a>")
		Response.Write("</button>")
		else
		Response.Write("<button class=btn btn-blue>Página " & TFM_LimitCounter & "</button>")
		End if
		if(TFM_LimitPageEndCount <> rsTypesNews_total AND TFM_endLink <> TFM_LimitCounter) then Response.Write(" - ")
		end if
		next
		%>
</div>		
		<br>
		<%
		startrw = 0
		endrw = HLoopernews2__index
		numberColumns = 1
		numrows = 6
		while((numrows <> 0) AND (Not rsTypesNews.EOF))
		startrw = endrw + 1
		endrw = endrw + numberColumns
		%>	
			

			<%
			While ((startrw <= endrw) AND (Not rsTypesNews.EOF))
			%>
			
<div class="col-md-4 column">
	<div class="widget-container widget_avatar boxed">
		<div class="avatar-image">
			<a href="../home/detail.asp?iData=<%=rsTypesNews("DAT_ID")%>&iCat=<%=rsTypesNews("DAT_CATEGORY")%>&iChannel=<%=rsTypesNews("CAT_CHANNEL")%>&nChannel=<%=rsTypesNews("CHA_NAME")%>" onclick="return hs.htmlExpand(this, { objectType: 'iframe' } )"class="highslide">
			<img src="../pictures/<%= Thumbnail("_small",(rsTypesNews.Fields.Item("DAT_PICTURE").Value)) %>" width="100%" height="190" /></a>
		</div>
		<div class="inner clearfix">
			<h5><a href="../home/detail.asp?iData=<%=rsTypesNews("DAT_ID")%>&iCat=<%=rsTypesNews("DAT_CATEGORY")%>&iChannel=<%=rsTypesNews("CAT_CHANNEL")%>&nChannel=<%=rsTypesNews("CHA_NAME")%>" onclick="return hs.htmlExpand(this, { objectType: 'iframe' } )"class="highslide"><% =(DoTrimProperly((rsTypesNews("DAT_NAME").Value), 50, 1, 1, "...")) %></a></h5>
			<a href="../home/detail.asp?iData=<%=rsTypesNews("DAT_ID")%>&iCat=<%=rsTypesNews("DAT_CATEGORY")%>&iChannel=<%=rsTypesNews("CAT_CHANNEL")%>&nChannel=<%=rsTypesNews("CHA_NAME")%>" onclick="return hs.htmlExpand(this, { objectType: 'iframe' } )"class="highslide"><span class="subtitle"><% =(DoTrimProperly((rsTypesNews("DAT_DESCRIPTION").Value), 40, 1, 1, "...")) %></span></a>
		</div>
	</div>
</div>			
			

			<%
			startrw = startrw + 1
			rsTypesNews.MoveNext()
			Wend
			%>

	<%
	numrows=numrows-1
	Wend
	%>

<% End If ' end Not rsTypesNews.EOF Or NOT rsTypesnews2.BOF %>
<%
rsTypesNews.Close()
%>

Toda vez que clico na próxima página ele da um refresh e retorna para o topo da página.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Tem como você ver que link que está sendo gerado nesse "próxima"?

Veja também isso:

Response.Write("<a href=""" & Request.ServerVariables("URL") & "?" & MM_keepMoveNews & "news=" & i-1 & """>")

Essas aspas não estão 'quebrando' o código? tenta trocar por aspas simples, assim:

Response.Write("<a href='" & Request.ServerVariables("URL") & "?" & MM_keepMoveNews & "news=" & i-1 & '">")

Compartilhar este post


Link para o post
Compartilhar em outros sites

Tentei fazer isso, por algum motivo quando retiro as aspas da erro

Erro de compilação do Microsoft VBScript erro '800a0409'

Constante de cadeia não finalizada

/monoclube2/includes/inc_lastnews.asp, linha 487

Response.Write("<a href=""" & Request.ServerVariables("URL") & "?" & MM_keepMoveNews & "news=" & i-1 & "">")
--------------------------------------------------------------------------------------------------

Não, deveria. Vou fazer passo a passo, algo não esta correto.

Compartilhar este post


Link para o post
Compartilhar em outros sites

eu pensei em tirar as Aspas duplas do Href e colocar uma simples para não confundir com as aspas do asp... mas as três funcionam também... chegou à ver que link é gerado? tem ele já está publicado onde de pra dar uma olhada?

Compartilhar este post


Link para o post
Compartilhar em outros sites

verifique as aspas

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.