Welcome Guest, Not a member yet? Register   Sign In
Déclarer une librairie pagination privée
#1

[eluser]caperquy[/eluser]
Bonjour
je voudrais personnaliser ma pagination en évitant d'avoir à répéter sans cesse dans mon code les instructions telles que $config['first_link'] = ...
Je pourrais mettre cela dans la librairie standard de codeigniter (pagination.php) mais il me semble plus judicieux d'avoir ma propre librairie.
Je n'ai pas trouvé la méthode qui me permettrait de la définir et de l'appeler dans le code.
Quelqu'un pourrait-il m'indiquer comment faire en supposant que cela soit possible.
Merci d'avance
#2

[eluser]Andreas Bergström[/eluser]
Is English really so hard?
#3

[eluser]caperquy[/eluser]
OK I translate
I would like to have my own private pagination library in order to avoid repeating instructions such as $config[‘first_link’] = ... and so on in my code. I could put these definitions in the standard codeigniter library (pagination.php) but it seems to me that it is safer not to pollute it. I have not found the way to define such private library and also how to make reference to it in the code.
I am looking for someone who could tell me how to that.
Thanks in advance
#4

[eluser]erik.brannstrom[/eluser]
If you only wish to store the configuration, this is copied from the user guide:

Quote:If you prefer not to set preferences using the above method, you can instead put them into a config file. Simply create a new file called pagination.php, add the $config array in that file. Then save the file in: config/pagination.php and it will be used automatically. You will NOT need to use the $this->pagination->initialize function if you save your preferences in a config file.

If you need to get down and dirty with the code, create a MY_Pagination class in your application/libraries folder and either override the needed methods or write your own class from scratch.

See http://ellislab.com/codeigniter/user-gui...aries.html for more information on creating your own libraries.
#5

[eluser]caperquy[/eluser]
Many thanks for your solution. It works fine.




Theme © iAndrew 2016 - Forum software by © MyBB