Important alert: (current site time 7/16/2013 6:55:38 AM EDT)
 

VB icon

MuLoT Paging

Email
Submitted on: 4/17/2003 10:45:36 AM
By: Le MuLoT  
Level: Beginner
User Rating: Unrated
Compatibility: Cold Fusion MX
Views: 13110
author picture
(About the author)
 
     With this code, you can make multiple link page to view results from a Search or a Query. Just look like this: |1| |2| |3| |4|
 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
// for :MuLoT Paging
//**************************************
Call the function like this:
#MuLoT_Paging(5, SearchResults.RecordCount, URL.MaxRows, 
	 			URL.StartRow, URL.Search, URL.Collection, 'recherche.cfm', '+')#
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
//**************************************
// Name: MuLoT Paging
// Description:With this code, you can make multiple link page to view results from a Search or a Query. Just look like this: |1| |2| |3| |4|
// By: Le MuLoT
//
//This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=76&lngWId=9//for details.//**************************************

	<cfscript>	/***************************************************************************************\
		*	Auteur:	Frédéric Gauthier-Boutin													*
		*	Date:	15 avril 2003																*
		*	Description:																		*
		*		Fonction générant des sauts de pages (liens hypertexts).						*
		*																						*
 		*		Arguments :																		*
		*			Intervalle	=>	Contient le nombre de pages à afficher avant et après celle	*
		*							en cours de consultation.									*
		*			RecordCount	=>	Contient le nombre de résultats pour la recherche			*
		*			MaxRows		=>	Contient le nombre de résultats par pages					*
		*			StartRow	=>	Contient le numéro de l'enregistrement en cours				*
		*			Search		=>	Contient ce sur quoi on fait la recherche					*
		*			Collection	=>	Indique avec quelle(s) collection(s) nous recherchons		*
		*			GotoURL		=>	Contient l'URL vers lequel les liens des pages pointent		*
		*																						*
		*		Arguments Optionnels :															*	
					Middle		=>
		*	Version: #2.0																		*
		\***************************************************************************************/	
		function MuLoT_Paging(Intervalle, RecordCount, MaxRows, StartRow, Search, Collection, GotoURL) {
			
			//Déclarations divers
			var iCtr = 1;
			var Start = 1;
			var strPages = '';
			
			var Middle = '#chr(35)#iCtr#chr(35)#'; //Correspond à #iCtr#, mais si écrit tel quel, y a traitement tout de suite !!!
			var BeginTag = '<font color="blue" face="Arial, Helvetica, sans-serif" size="3">';
			var EndTag = '</font>';
			
			var CurrentMiddle = Middle;
			var CurrentBeginTag = '<font size="+1" color="blue">';
			var CurrentEndTag = EndTag;
			
			//Calcul des pages
			var CurrentPage = (StartRow + MaxRows - 1) / MaxRows;
			var BeginPage = 1;
			var MaxPage = (recordCount / MaxRows);
			if (RecordCount mod MaxRows NEQ 0) //Page de terminaison
				MaxPage = MaxPage + 1;
			
			//Vérification si nous avons reçu des arguments supplémentaires
			if(ArrayLen(arguments) GTE 8) 
				Middle = "#chr(35)#arguments[8]#chr(35)#";
				
			if(ArrayLen(arguments) GTE 9)
				BeginTag = "#chr(35)#arguments[9]#chr(35)#";
				
			if(ArrayLen(arguments) GTE 10)
				EndTag = "#chr(35)#arguments[10]#chr(35)#";
			if(ArrayLen(arguments) GTE 11)
				CurrentMiddle = "#chr(35)#arguments[11]#chr(35)#";
			
			//Ajustement de l'intervalle
			if (CurrentPage + Intervalle LT MaxPage)
				MaxPage = CurrentPage + Intervalle;
			if (CurrentPage - Intervalle GT BeginPage)
				BeginPage = CurrentPage - Intervalle;
				
			//Boucle parcourant chaque pages
			for(iCtr = BeginPage; iCtr LE MaxPage; iCtr = iCtr + 1){
				
				//Calcul du Début pour chaque pages
				Start = (iCtr * MaxRows) - MaxRows + 1;
					
				//Vérification si page en cours
				if (Start NEQ StartRow)
					strPages = strPages & 'a href="#GotoURL#?
										startrow=#Start#&
										MaxRows=#MaxRows#&
										search=#URLEncodedFormat("#Search#")#&
										collection=#URLEncodedFormat("#Collection#")#&
										Advanced=#URLEncodedFormat("#URL.Advanced#")#">'
											& '#BeginTag#'
											& Evaluate(Middle)
											& '#EndTag#'
											&'/a> ';
				else
					strPages = strPages & CurrentBeginTag & Evaluate(CurrentMiddle) & CurrentEndTag & ' ';
			}
			return strPages;
		}	
</cfscript>


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
4/22/2003 8:52:00 AMTim Garver

Would be cool if i could read French!
(If this comment was disrespectful, please report it.)

 
4/22/2003 9:08:21 AMTHA MuLoT

Do you want an english version ?
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.