Hi folks,
please help.
My php script combine different fetch records and I use the jQuery pagination as the kind of menu. (jPagine from http://www.phpixel.fr/jpagine/
I need change page numbers to words. I know the total number of pages.
I tried use array in javascript but without success ...

Many thanks Petr

javascript on php page

<script type="text/javascript">
	nb : 1, // Nombre d'élément par page
	defaut : 1, // Page active par défaut
	zebra : false // Effet zebra (true / false)


function jPagine(param){
		// variables
		var page_defaut = param.defaut;
		var pagination = '<a href="javascript:" rel="1">1</a>';
		var nb_par_page = param.nb;
		var nb_total = $('#jPagine .jPagine-element').size();
		var nb_pages = Math.ceil(nb_total/nb_par_page);
		var page = 1; // section
		var j = 0; // compteur d'élément
		// on boucle les elements a paginer
		$('#jPagine .jPagine-element').each(function(i){
			// si j = nombre d'éléments par section c'est une nouvelle section
			if(j == nb_par_page){
				// on incrémente la section
				// on initialise le compteur d'élements
				j = 0;
				// on ajoute un lien vers la section
				pagination = pagination.concat('<a href="javascript:" rel="'+page+'">'+page+'</a>');
			// on associe l'élément a sa section
			// effet zebra
			if(param.zebra == true && j/2 == Math.round(j/2)){
		// initialisation
		$('#jPagine .jPagine-page-'+page_defaut).show();
		$('#jPagine #jPagine-pagination').append(pagination);
		$('#jPagine #jPagine-pagination a').each(function(i){
			if(i+1 == page_defaut){
		// changement de section
		$("#jPagine #jPagine-pagination a").click(function(){
			var page_cible = $(this).attr('rel');
			$('#jPagine .jPagine-element').hide();
			$('#jPagine .jPagine-page-'+page_cible).show();
			$("#jPagine #jPagine-pagination a").removeClass('actif');

Looks like it requires a change in the plugin. On line 20 the variable page (a number) is used. You could change this to something like wordedNumber(page) where worderNumber would be a function to change the page number into it's matching word (http://javascript.about.com/library/bltoword.htm).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.