2006-12-22

新版bloger模板设置[1]

作者:h_Davy
===========================================
old:
<MainOrArchivePage>
   span.fullpost {display:none;}
</MainOrArchivePage>

<ItemPage>
   span.fullpost {display:inline;}
</ItemPage>
-------------------------------------------
new:

<style type='text/css'>
<b:if cond='data:blog.pageType != "item" '>
  span.hideonmain {display:none;}
<b:else/>
  span.hideonmain {display:inline;}
</b:if>
</style>
usage:
this will show on main
<span class="hideonmain">this will hide on main</span>

===========================================
old:
<MainOrArchivePage><br />
   <a href="<$BlogItemPermalinkURL$>">Read more!</a>
</MainOrArchivePage>
-------------------------------------------
new:
find the "<b:includable id='post' var='post'>" module,in the "<div class='post-body'>...</div>" field:
(follow the "<p><data:post.body/>" will better)
<b:if cond='data:blog.pageType != "item" '>
  <a expr:href='data:post.url'>Read More...</a>
</b:if>

===========================================
很久没上bloger了,今天上去看看发现改版了,出了个"new..."马上申请个试试:D
er...发现模板也用了新的模板技术(Ajex??),我之前对Ajex也没接触过,看Bloger的Help也看不出个头绪来,于是down了个template参考Help才慢慢摸出个头绪来。。。
新版的Template一般的布局、外观设置方便了很多,用Bloger的设置页面就可以了,模板中对应的是<b:skin><![CDATA[ ... ]]></b:skin>那段,所以那段我们暂时不用管。
so我们自己在<head></head>中加入一个<style>块,通过阅读之后的Template代码,发现用<b:if cond='data:blog.pageType != "item" '>(或<b:... == "item" '>)来判断是否(否是)在mainPage,并且可以用if ... else。
至于加入"Read More"就有些麻烦了,首先是位置,然后是变量名。
使用FireFox的FireBug括展或DOM括展可以轻松找到content的位置:
outer-wrapper -> wrap2 -> content-wrapper -> main-wrapper -> main -> Blog1 -> blog-posts -> post uncustomized-post-template -> post-body ...
在<b:includable id='main' 中可以找到'blog-post',如果你读过Bloger的Help,就会知道includable是定义一个模块、include是使用某模块。
下面的<b:include data='post' name='post' />就是我们要找的地方了,so找到'post'模块。。。接下来的一切将无比简单(在这里变量名已经给出了post.url,而post.link应该是浏览器Address里面显示的东西了--当前页面的地址)
而<data:post.body/>就是正文了。


另外:"codes"
div.codes {border: 1px solid rgb(198, 198, 198); margin: 0px; padding: 4px; overflow: auto; width: 500px; height: auto; text-align: left;}

<div class="codes">
codes here...
注意其中的'<'、'>'要换成'&lt;'、'&gt;',还有一些HTML转义符也要用相应的代之(如:'&'用'&amp;')
</div>
其实,bloger有个<blockquote>你只要重载它就可以了:
blockquote {border: 1px solid rgb(198, 198, 198); margin: 0px; padding: 4px; overflow: auto; width: 500px; height: auto; text-align: left;}


//EOF

0 comments: