• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compilation of problems and solutions that I've encountered that might help others

#1
[eluser]rei[/eluser]
Hi, I just want to share this for the sake of others that might encounter the problems I've encountered in using CodeIgniter Framework:

Scenario:
Pagination is working fine when using offset number 3 but not working when using offset number 4,5 and so on...

Solution:
Just add $config['uri_segment'] = 4; /* uri segment number that you want to use */ before initializing.

Example:
Code:
$this->load->library('pagination');

$config['base_url'] = 'http://localhost/pagination/index.php/home/page/reineskye/';  $config['total_rows'] = $this->db->get('pagination')->num_rows();
$config['per_page'] = 2;
$config['num_links'] = 3;
$config['uri_segment'] = 4;  // just add this line and change the number to suit your needs

$this->pagination->initialize($config);

This are the list of config variables that you can override:
Code:
var $base_url = ''; // The page we are linking to
var $prefix = ''; // A custom prefix added to the path.
var $suffix = ''; // A custom suffix added to the path.
var $total_rows =  0; // Total number of items (database results)
var $per_page  = 10; // Max number of items you want shown per page
var $num_links  =  2; // Number of "digit" links to show before/after the currently viewed page
var $cur_page  =  0; // The current page being viewed
var $use_page_numbers = FALSE; // Use page number for segment instead of offset
var $first_link = '‹ First';
var $next_link = '>';
var $prev_link = '<';
var $last_link = 'Last ›';
var $uri_segment = 3;
var $full_tag_open = '';
var $full_tag_close = '';
var $first_tag_open = '';
var $first_tag_close = ' ';
var $last_tag_open = ' ';
var $last_tag_close = '';
var $first_url = ''; // Alternative URL for the First Page.
var $cur_tag_open = '&nbsp;<strong>'; var $cur_tag_close  = '</strong>'; var $next_tag_open = '&nbsp;';
var $next_tag_close = '&nbsp;';
var $prev_tag_open = '&nbsp;';
var $prev_tag_close = '';
var $num_tag_open = '&nbsp;';
var $num_tag_close = '';
var $page_query_string = FALSE;
var $query_string_segment = 'per_page';
var $display_pages  = TRUE;
var $anchor_class  = '';
You can override them by $config['name of the variable you want to override'] = your custom value;

I think you could also override defaults in other libraries. Just open the source code of the library and you will see the variables that you can override when initializing.

-----------------------------------------------------------------------------------------------------

Scenario:
Ion Auth Library dont work well when using HMVC Modular Extensions

Solution:
http://ellislab.com/forums/viewthread/145263/P1140

look for post # 1145 by EC

-------------------------------------------------------------------------------------------------------

Scenario:
Session data being lost after redirecting to other pages

Solution:
download a native php session library for CI.
https://github.com/staskus/codeigniter-2...ve-session

Just paste in inside application/libraries and your session problem will gone Smile

#2
[eluser]PhilTem[/eluser]
Thanks for your collection of problems. But could you please wrap your code between [ code ] and [ /code ] tags? (without the spaces)

#3
[eluser]rei[/eluser]
Sure Wink I already updated it now. Thanks Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.