|
发表于 2009-4-27 17:37:46
|
显示全部楼层
本帖最后由 benlan 于 2009-4-27 17:38 编辑
InkType代码实现的很优雅,看起来非常清晰,非常喜欢这个代码
请教一个问题:
主页的显示不是看的很明白
主页的blog类:
class Blog extends Controller {
...
function index() {
// this function is the default blog view - it will show all published blog posts
$uri = $this->uri->uri_to_assoc(3);
if (isset($uri['page']) && (IntVal($uri['page'])>0)) {
$this->page = IntVal($uri['page']);
}
else {
$this->page = 1;
}
$this->data['posts'] = $this->lib_posts->posts();
$this->lib_view->load_view('index', $this->data);
}
...
}
view应该是在 views\templates\default里的index.php
<!--BEGIN CONTENT-->
<div id="primary-content">
<?if ($posts) {?>
<?foreach ($posts as $post) {?>
<h2><?=inktype_post_title($post);?></h2>
<?=inktype_post_content($post);?>
<?=inktype_post_read_more($post);?>
<p><?=inktype_post_meta($post, $this->settings->allow_comments);?></p>
<?}?>
<?} else {?>
<h2>No results found</h2>
<p>There are currently no posts</p>
<?}?>
<p><?=$this->lib_paginate->nav;?></p>
</div>
<!--END CONTENT-->
看这个代码,只是把context显示出来,不知道上面的导航,右边的Search This Site Categories Blogroll Users
这几个项是代码哪里控制显示出来的,
刚学CI,哪个大侠帮忙看下代码 |
|