我已经阅读了有关Stackoverflow的所有问题,并且没有看到问题的确切答案.我目前正在使用codeigniter分页库来使用限制和偏移量生成我的分页链接:
$config['base_url'] = base_url() . 'explore/featured/index/';
$config['total_rows'] = $this->Projects_model->get_featured_count();//Count featured projects
$config['per_page'] = 12;
$config['uri_segment'] = 4;
$config['display_pages'] = FALSE;
$config['next_link'] = 'Older →';
$config['prev_link'] = '← Newer';
$this->pagination->initialize($config);
$limit = $config['per_page'];
$offset = $this->uri->segment(4);
$data['pagination'] = $this->pagination->create_links();
$data['projects'] = $this->Projects_model->get_featured($limit, $offset); //get featured projects from database
Run Code Online (Sandbox Code Playgroud)
上面的代码限制了我的查询的输出值,并使用了我的第4个URI段中包含的偏移量.
如何将以下代码更改为页码??? 似乎是不可能的,因为我将不再能够在我的网址中使用偏移量.
我有一个变量$counter,返回以下整数:
4
Run Code Online (Sandbox Code Playgroud)
我想使用数字格式或类似格式使我的整数以这种格式显示:
000,000,004
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
在codeigniter的我的views文件夹中,我希望为每个类别都有一个子目录.
并且每个都包含不同的视图.
如何将控制器指向这些目录中的视图以及如何为/目录子目录创建默认路由?
我在文本帮助器中使用codeigniter word_limiter()函数。
$string = "Here is a nice text string consisting of eleven words.";
$string = word_limiter($string, 4);
// Returns: Here is a nice…
Run Code Online (Sandbox Code Playgroud)
以上功能将输出限制为四个字。如何将限制后的单词也存储在变量中以供使用???