9hg / micolog

Automatically exported from code.google.com/p/micolog
MIT License
0 stars 0 forks source link

怎样才能让首页文章只显示部分内容? #47

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
在WordPress里那个编辑器里有一个按键more,我想问下micolog里怎
么没有这样的功能
呢。试了好久,痛苦中~~~~~~~

Original issue reported on code.google.com by jaysa...@gmail.com on 5 Apr 2010 at 9:32

GoogleCodeExporter commented 8 years ago
在后台编辑器的html模式下有个more按钮,用它就可以了,当然
后台编辑器是默认的情况下

Original comment by yuntaotiancai on 6 Apr 2010 at 1:34

GoogleCodeExporter commented 8 years ago
后台编辑器的html模式??我没有看到啊,我用的是micolog0.7rc1
。
这个是不是要修改什么啊?

Original comment by jaysa...@gmail.com on 7 Apr 2010 at 12:10

Attachments:

GoogleCodeExporter commented 8 years ago
后台编辑器tinymce的html模式下有个more,或直接在源代码模式下�
��入<!--more-->

Original comment by coolch...@gmail.com on 8 Apr 2010 at 12:46

GoogleCodeExporter commented 8 years ago
你点击后台的“插件”,找到xheditor 
plugin,取消激活,就可以勇tinymce编辑器,他有个HTML
模式,点击more按钮就可以了

Original comment by yuntaotiancai on 8 Apr 2010 at 4:20

GoogleCodeExporter commented 8 years ago
Thank you all !!

Original comment by jaysa...@gmail.com on 8 Apr 2010 at 7:23

GoogleCodeExporter commented 8 years ago
神马是后台编辑器。。。。我怎么不晓得。。。

Original comment by hiyzl...@gmail.com on 13 Sep 2010 at 2:50

GoogleCodeExporter commented 8 years ago
如果一篇文章太长,那么在首页就会把一整个页面都拉长了��
�为了不出现这种情况,你可能会在设置中调节文章在首页的�
��示数量,但这并不是根本的解决方法,毕竟如果你这几篇文
章又刚好不长呢?那不是把首页的整个页面缩水了?所以这��
�你会选择发布或编辑文章时,在摘要栏手动添加进文章的摘�
��。但,既然如此,为什么不试试自动生成文章的摘要信息呢
?下文仅针对Micolog 0.7 Release版本,其他版本请作自行参考。

(注意:以下所提到的行数,均为原文件在未修改前的显示��
�数)
进入Micolog的目录,打开"admin.py",在第480行的"entry.excerpt=entry_
excerpt"和第520行的"entry.excerpt=entry_excerpt"上面插入如下代码:
show source
1if (entry_excerpt=='' and len(entry.content)>500):
2    entry_excerpt=entry.content[0:500].strip('\n')

文件两处修改后所显示的内容均为:
show source
1entry.menu_order=menu_order
2if (entry_excerpt=='' and len(entry.content)>500):
3    entry_excerpt=entry.content[0:500].strip('\n')
4entry.excerpt=entry_excerpt

然后再进入"views/admin"目录下,打开"entry.html"文件,修改第312�
��的
"<textarea name="excerpt" style="width:98%"/>{%if 
entry.excerpt%}{{entry.excerpt|escape}}{%endif%}</textarea><br/>"
为下面代码:
"<textarea name="excerpt" style="width:98%"/>{%if not 
entry.excerpt%}{{entry.excerpt|escape}}{%endif%}</textarea><br/>"

好了,大家如果不满意,我也没辙了

Original comment by icyomik on 10 Nov 2010 at 1:29

GoogleCodeExporter commented 8 years ago
膜拜。。。非常感谢~

Original comment by jie41434...@gmail.com on 25 Nov 2010 at 4:50