This really simple script permit to extract the firs 2 paragraph from all pages in a specific section.
It's useful to create summary page or a "really simple blog home page"
Code
Html source code
<div class="blog" block="var result = wiki.getsearch('path:Wiki/*', 20, '-date', 'type:wiki')">
<div foreach="var p in result">
<div class="blogtitle">{{web.link(p.uri, p.title)}}</div>
<div class="bloginfo">Author {{web.link(p.author.uri, p.author.name)}}, edited on {{date.format(p.date,"dd MMMMMMMM yy at hh:mm")}}</div>
<div class="blogarticle" block="var sec = xml.list(wiki.page(p.path),'//p',nil,true)">{{ web.html(sec[0].. sec[1])}} {{web.link(p.uri, "Leggi articolo...")}}</div>
</div>
</div>
I use div tags so I can have more graphic control than table, but you can replace DIV with TABLE,TR and TD and it works the same. I extract only the p tags from internal pages and omit all other tags because I want to keep a simple format layout in the abstract section. H, TABLE, ecc.. create a "layout conflict" if displayed in the summary page and confuse users. If you want to extract more paragraphs just extend the code at web.html(sec[0].. sec[1]...sec[2]..sec[3]), any sec[n] correspond to a P paragraph.
Remember to define your custom css style (blog blogtitle bloginfo blogarticle) in control panel
/* ------ BLOG ---------- */
div.blog {
}
div.blogtitle {
margin-top:10px;
padding-top:10px;
border-top: 1px solid #666666;
font-size:140%;
}
div.bloginfo{
padding-top:5px;
font-size:80%;
}
div.blogarticle {
padding-top:25px;
}

Commenti