Пример #1
0
def category(category_name):
    _start = 0
    _end = 0
    if request.args.get('_start', '') != '':
        _start = int(request.args.get('_start', ''))
    _end = _start + setting.EACH_PAGE_POST_NUM
    posts = operatorDB.get_post_page_category(
                            category_name)
    return render_template('category.html',
                           cats = operatorDB.get_all_cat_name(),
                           posts = posts,
                           BASE_URL = setting.BASE_URL,
                           category_name = category_name)
Пример #2
0
def _index():
	posts = None
	_newer = False
	_older = False
	_start = 0
	_end = 0
	if request.args.get('_start','')!='' :
		_start = int(request.args.get('_start',''))
	_end = _start+setting.EACH_PAGE_POST_NUM
	if request.args.get('cat','')!='' :
		posts,_newer,_older = operatorDB.get_post_page_category(_start,_end,request.args.get('cat',''))
	elif request.args.get('tags','')!='' :
		posts,_newer,_older = operatorDB.get_post_page_tags(_start,_end,request.args.get('tags',''))
	else :
		posts,_newer,_older = operatorDB.get_post_page(_start,_end)
	return render_template('index.html',c=request.args.get('cat',''),t=request.args.get('tags',''),coms=operatorDB.get_comments_new(),tags = operatorDB.get_all_tag_name(),cats=operatorDB.get_all_cat_name(),links=operatorDB.get_all_links(),_newstart=_start-setting.EACH_PAGE_POST_NUM,_oldstart=_end,_newer=_newer,_older=_older,posts=posts,BASE_URL=setting.BASE_URL)
Пример #3
0
def _index(page = 1):
    posts = None
    if request.args.get('_start','') != '' :
        _start = int(request.args.get('_start', ''))
    if request.args.get('cat','') != '' :
        posts = operatorDB.get_post_page_category(request.args.get('cat',''))
    elif request.args.get('tags','') != '' :
        posts = operatorDB.get_post_page_tags(request.args.get('tags',''))
    else:
        posts = operatorDB.get_post_page(page)
    editor_posts = operatorDB.get_editor_post(0,3)
    return render_template('index.html', c=request.args.get('cat',''),
                           t=request.args.get('tags',''),
                           tags = operatorDB.get_all_tag_name(),
                           cats=operatorDB.get_all_cat_name(),
                           links=operatorDB.get_all_links(),
                           posts=posts,
                           BASE_URL=setting.BASE_URL,
                           editor_posts = editor_posts)