Welcome Guest, Not a member yet? Register   Sign In
Customize the location of the Page number in Pagination link
#1

[eluser]Jygz V[/eluser]
Hello everybody,

I want the link that was generated by the Pagination class to be like this
Code:
<a href='javascrpt:GoToPage(1);'>1</a>

Is it possible? If yes, how?

Thank you.

Have a nice day!
#2

[eluser]pistolPete[/eluser]
You have to extend the Pagination class. Have a look at the function create_links(), customize it for your needs and put it in a file called MY_Pagination.php
#3

[eluser]xwero[/eluser]
Instead of altering the pagination class you better create an event listener for the pagination links.
Code:
// php
$config['full_tag_open'] = '<p id="pagination">';
// javascript jquery
$(function(){
  $('#pagination a').click(function(){
    var lastSlash = [removed].href.lastIndexOf('/')+1;
    var id = [removed].href.substr(lastSlash);
    // ajax stuff here
  });
});
#4

[eluser]Jygz V[/eluser]
@pistolPete
Thanks, good idea.

@xwero
Thanks, excellent... I like it this way.



Thank you so much both of you.
#5

[eluser]Đaяк Đaηтє[/eluser]
How can I implement this code? I'm using JQuery and I need a custom Link to invoke a Javascript function... but I don't understand the point in your code, xwero, can you explain me how can I implement it?

Thanks...




Theme © iAndrew 2016 - Forum software by © MyBB