summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/Pagination.php28
-rw-r--r--user_guide/changelog.html3
-rw-r--r--user_guide/libraries/pagination.html12
3 files changed, 26 insertions, 17 deletions
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index ccd3e8261..68c35a57e 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -56,6 +56,7 @@ class CI_Pagination {
var $num_tag_close = '';
var $page_query_string = FALSE;
var $query_string_segment = 'per_page';
+ var $anchor_class = '';
/**
* Constructor
@@ -70,6 +71,11 @@ class CI_Pagination {
$this->initialize($params);
}
+ if ($this->anchor_class != '')
+ {
+ $this->anchor_class = 'class="'.$this->anchor_class.'" ';
+ }
+
log_message('debug', "Pagination Class Initialized");
}
@@ -187,25 +193,25 @@ class CI_Pagination {
$output = '';
// Render the "First" link
- if ($this->cur_page > ($this->num_links + 1))
+ if ($this->first_link !== FALSE AND $this->cur_page > ($this->num_links + 1))
{
$first_url = ($this->first_url == '') ? $this->base_url : $this->first_url;
- $output .= $this->first_tag_open.'<a href="'.$first_url.'">'.$this->first_link.'</a>'.$this->first_tag_close;
+ $output .= $this->first_tag_open.'<a '.$this->anchor_class.'href="'.$first_url.'">'.$this->first_link.'</a>'.$this->first_tag_close;
}
// Render the "previous" link
- if ($this->cur_page != 1)
+ if ($this->prev_link !== FALSE AND $this->cur_page != 1)
{
$i = $uri_page_number - $this->per_page;
if ($i == 0 && $this->first_url != '')
{
- $output .= $this->prev_tag_open.'<a href="'.$this->first_url.'">'.$this->prev_link.'</a>'.$this->prev_tag_close;
+ $output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$this->prev_link.'</a>'.$this->prev_tag_close;
}
else
{
$i = ($i == 0) ? '' : $this->prefix.$i.$this->suffix;
- $output .= $this->prev_tag_open.'<a href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close;
+ $output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close;
}
}
@@ -227,29 +233,29 @@ class CI_Pagination {
if ($n == '' && $this->first_url != '')
{
- $output .= $this->num_tag_open.'<a href="'.$this->first_url.'">'.$loop.'</a>'.$this->num_tag_close;
+ $output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$loop.'</a>'.$this->num_tag_close;
}
else
{
$n = ($n == '') ? '' : $this->prefix.$n.$this->suffix;
- $output .= $this->num_tag_open.'<a href="'.$this->base_url.$n.'">'.$loop.'</a>'.$this->num_tag_close;
+ $output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$n.'">'.$loop.'</a>'.$this->num_tag_close;
}
}
}
}
// Render the "next" link
- if ($this->cur_page < $num_pages)
+ if ($this->next_link !== FALSE AND $this->cur_page < $num_pages)
{
- $output .= $this->next_tag_open.'<a href="'.$this->base_url.$this->prefix.($this->cur_page * $this->per_page).$this->suffix.'">'.$this->next_link.'</a>'.$this->next_tag_close;
+ $output .= $this->next_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$this->prefix.($this->cur_page * $this->per_page).$this->suffix.'">'.$this->next_link.'</a>'.$this->next_tag_close;
}
// Render the "Last" link
- if (($this->cur_page + $this->num_links) < $num_pages)
+ if ($this->last_link !== FALSE AND ($this->cur_page + $this->num_links) < $num_pages)
{
$i = (($num_pages * $this->per_page) - $this->per_page);
- $output .= $this->last_tag_open.'<a href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->last_link.'</a>'.$this->last_tag_close;
+ $output .= $this->last_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->last_link.'</a>'.$this->last_tag_close;
}
// Kill double slashes. Note: Sometimes we can end up with a double slash
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 124a1cb9f..4f86c1e94 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -78,7 +78,8 @@ Hg Tag: </p>
</ul>
<li>Libraries
<ul>
- <li>Added <var>$prefix</var>, <var>$suffix</var> and <var>$first_url</var> properties to Pagination library.</li>
+ <li>Added <var>$prefix</var>, <var>$suffix</var> and <var>$first_url</var> properties to <a href="./libraries/pagination.html">Pagination library</a>.</li>
+ <li>Added the ability to suppress first, previous, next and last links by setting their values to FALSE in the <a href="./libraries/pagination.html">Pagination library</a>.</li>
<li>Added <a href="./libraries/security.html">Security library</a>, which now contains the <dfn>xss_clean</dfn> function, <dfn>filename_security</dfn> function and other security related functions.</li>
<li>Added CSRF (Cross-site Reference Forgery) protection to the <a href="./libraries/security.html">Security library</a>.</li>
<li>Added <var>$parse_exec_vars</var> property to Output library.</li>
diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html
index 21c7763f3..33c871078 100644
--- a/user_guide/libraries/pagination.html
+++ b/user_guide/libraries/pagination.html
@@ -139,7 +139,7 @@ something different you can specify it.</p>
<h2>Customizing the First Link</h2>
<h4>$config['first_link'] = 'First';</h4>
-<p>The text you would like shown in the "first" link on the left.</p>
+<p>The text you would like shown in the "first" link on the left. If you do not want this link rendered, you can set its value to FALSE.</p>
<h4>$config['first_tag_open'] = '&lt;div>';</h4>
<p>The opening tag for the "first" link.</p>
@@ -150,7 +150,7 @@ something different you can specify it.</p>
<h2>Customizing the Last Link</h2>
<h4>$config['last_link'] = 'Last';</h4>
-<p>The text you would like shown in the "last" link on the right.</p>
+<p>The text you would like shown in the "last" link on the right. If you do not want this link rendered, you can set its value to FALSE.</p>
<h4>$config['last_tag_open'] = '&lt;div>';</h4>
<p>The opening tag for the "last" link.</p>
@@ -161,7 +161,7 @@ something different you can specify it.</p>
<h2>Customizing the "Next" Link</h2>
<h4>$config['next_link'] = '&amp;gt;';</h4>
-<p>The text you would like shown in the "next" page link.</p>
+<p>The text you would like shown in the "next" page link. If you do not want this link rendered, you can set its value to FALSE.</p>
<h4>$config['next_tag_open'] = '&lt;div>';</h4>
<p>The opening tag for the "next" link.</p>
@@ -172,7 +172,7 @@ something different you can specify it.</p>
<h2>Customizing the "Previous" Link</h2>
<h4>$config['prev_link'] = '&amp;lt;';</h4>
-<p>The text you would like shown in the "previous" page link.</p>
+<p>The text you would like shown in the "previous" page link. If you do not want this link rendered, you can set its value to FALSE.</p>
<h4>$config['prev_tag_open'] = '&lt;div>';</h4>
<p>The opening tag for the "previous" link.</p>
@@ -196,8 +196,10 @@ something different you can specify it.</p>
<h4>$config['num_tag_close'] = '&lt;/div>';</h4>
<p>The closing tag for the "digit" link.</p>
-
+<h2>Adding a class to every anchor</h2>
+
+<p>If you want to add a class attribute to every link rendered by the pagination class, you can set the config "anchor_class" equal to the classname you want.</p>
</div>
<!-- END CONTENT -->