Home

OFF-SOFT.net

OFF-SOFT.net

This site is support & information site of WEB,and Software. This site might help you that create software or Web Site…perhaps?[:]

The template to customize the page navigation

Published on| May 12th, 2009 | No Comment.
Joomla! I would like to customize the page navigation in the template.
Joomla! So, if there are multiple pages of information and a list will appear the following PEJINABI.

≪First Previous 1 2 3 4 Last Next≫


This, the customized navigation SHIMAIMASHOU to feel my face.
This section describes how. Little, php knowledge is required.

Create a pagination.php
First, the template you are using now
/templates/%templatedirectory%/html/pagination.php
Make sure there is.

If you do not, Joomla! Standard templates are included in the "ja_purity", please copy.

/templates/ja_purity/html/pagination.php
, Using /templates/%templatedirectory%/html/. Copy.

Is written in this function, the following are four large.

  • pagination_list_footer
    - Sets the PEJINABI footer.
  • pagination_list_render
    - Set the order of PEJINABI.
  • pagination_item_active
    - Active PEJINABI (now hide the page) to create the output image of the page output.
  • pagination_item_inactive
    - Inactive PEJINABI (current page you are viewing) to create the output image of the page output.

※ PEJINABI view of the conduct in fact, a function of the bottom three. (pagination_list_footer will not use. )

Each role is as follows.



So, first, two simple function (pagination_item_active, pagination_item_inactive) I'll explain.


The following is the actual "ja_purity/html/pagination.php" source code.
1
2
3
4
5
6
7
8
9
10
// *	 $item->base	: integer	Offset is the number of pages (for example, in ascending page 2 (10 items / page) and the second 20 or will be)
// *	 $item->link	: string	Address of the page number links
// *	 $item->text	: string	Corresponds to the page number
function pagination_item_active(&$item) {
	return "<li>&nbsp;<strong><a href=\"".$item->link."\" title=\"".$item->text."\">".$item->text."</a></strong>&nbsp;</li>";
}
// *	pagination_item_active に同じ
function pagination_item_inactive(&$item) {
	return "<li>&nbsp;<span>".$item->text."</span>&nbsp;</li>";
}

And a brief description,
pagination_item_active,
Paste a link to the page number and HTML output.

pagination_item_inactive,
The only number we printed the HTML page.

And showed that the number of buttons, if you want to use the symbolic representation, you should change the output of the above information.

Next, pagination_list_render.
This function is to decide the order, you can set the string.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//  *	 $list[all]					Information for the entire list
//  *		 [data]		: string	Data List
//  *		 [active]	: boolean	Active / Inactive Flag
//  *	 $list[start]				First List
//  *		 [data]		: string	The first data of the list
//  *		 [active]	: boolean	Active / Inactive Flag
//  *	 $list[previous]			Previous List
//  *		 [data]		: string	Data to the list
//  *		 [active]	: boolean	Active / Inactive Flag
//  *	 $list[next]				Next List
//  *		 [data]		: string	Data to the following list
//  *		 [active]	: boolean	Active / Inactive Flag
//  *	 $list[end]					Bottom of the list
//  *		 [data]		: string	Bottom of the list data
//  *		 [active]	: boolean	Active / Inactive Flag
//  *	 $list[pages]						Each page lists
//  *		 [{PAGE}][data]		: string	Data of each page list
//  *		 [{PAGE}][active]	: boolean	Active / Inactive Flag
function pagination_list_render($list)
{
	// Initialize variables
	$lang =& JFactory::getLanguage();
	$html = "<ul class=\"pagination\">";
	$html .= '<li>&laquo;</li>';
	// Reverse output rendering for right-to-left display
	if($lang->isRTL())
	{
		$html .= $list['start']['data'];
		$html .= $list['previous']['data'];
 
		$list['pages'] = array_reverse( $list['pages'] );
 
		foreach( $list['pages'] as $page ) {
			if($page['data']['active']) {
				//  $html .= '<strong>';
			}
 
			$html .= $page['data'];
 
			if($page['data']['active']) {
				// $html .= '</strong>';
			}
		}
 
		$html .= $list['next']['data'];
		$html .= $list['end']['data'];
		// $html .= '&#171;';
	}
	else
	{
		$html .= $list['start']['data'];
		$html .= $list['previous']['data'];
 
		foreach( $list['pages'] as $page )
		{
			if($page['data']['active']) {
				// $html .= '<strong>';
			}
 
			$html .= $page['data'];
 
			if($page['data']['active']) {
				//  $html .= '</strong>';
			}
		}
 
		$html .= $list['next']['data'];
		$html .= $list['end']['data'];
		// $html .= '&#171;';
 
	}
	$html .= '<li>&raquo;</li>';
	$html .= "</ul>";
	return $html;
}

And a brief description,
Before the first (page): <br> and last in the order of output. However, the (page) and switch to switch the language or area in the ascending or descending order only.

Or use the intuitive navigation to images, symbols or TSUKAっby adding here, can be changed to suit taste.

For example, line 28
1
$html .= $list['start']['data']; 
A
1
$html .= '★'.$list['start']['data']; 
By changing to, "★ First" will be displayed.

Page Navi made a mistake or you will be able to change it as you think if it is thought that it is a poor usability.

Comments

Leave a Reply







  • はてなブックマークへ追加する
  • Facebookでシェアする
  • twitter でつぶやく
  • Google Plusでシェアする
  • Pocketでシェアする
ページトップへ