Hi,
How to trim the word "tags" from URL that is generated through this line of code:
$config['first_url'] = $config['base_url'] . $get_method;
The URL looks like this:
_example.com/tags/tags/?page=2 [This is WRONG. The 2nd "tags" from url is wrong.]
_example.com/tags/?page=2 [This is CORRECT.]
PHP Code:
public function index()
{
$data = array();
$data['url'] = $this->route_links->get('tags_index_page'); // the word for 'tags_index_page' is "tags" and is ok to work the tags page, but the pagination is generated wrong because of this.
$this->load->model(array('wallpaper_model', 'category_model'));
$filter['per_page'] = $config['per_page'] = $this->config->item('items_per_page') * 3;
$page_number = (int)$this->input->get('page');
$filter['offset'] = $data['offset'] = ($page_number ? ($page_number - 1) * $config['per_page'] : 0);
$data['total_count'] = $this->wallpaper_model->get_tags($filter + array('count' => true));
$data['top_count'] = $this->wallpaper_model->get_tags($filter + array('top_count' => true)) * 1.3;
//Initialize Pagination
$config['base_url'] = $data['url'];
$config['total_rows'] = $data['total_count'];
$config['custom_query_string'] = true;
$config['page_query_string'] = true;
$config['query_string_segment'] = 'page';
if (!empty($_GET)) {
$get_method = $this->frontend_helper->get_query_string(array('page'));
$config['prefix'] = ($get_method ? $get_method . '&' : '?') . 'page=';
$config['first_url'] = $config['base_url'] . $get_method; // how to trim the 'tags' word that is generated in links
} else {
$config['prefix'] = '';
}
}
PS: I tried to use RTRIM, but I think I didn't write in the right place and don't work.