Earlier I post a topic about how to summarize blog post on the main page. This is the extension for the post title summarize blog post on blogspot (I). In this version of post I`m going to post how to summarize post using expand/collapse method.
This are however NOT my creations, instead it`s a creation by a great developer named Ramani from Hackosphere. Visit his site for more hacks and iPhone application created by himself. Don`t have an iPhone ? Get one, it`s cool !
This version of post summarizing called Peekaboo View. One the code was correctly implemented on your template. Your blog post will no longer shows all your written post. Instead it provide link at the bottom of summarize post and will expand/collapse on the same page.
If you prefer the links direct you to the post page, check out my post mentioned earlier. Okay. Let`s get on with the editing.
Peekaboo View (expand/collapse post)
Step 1 - Back up your original template
Step 2 - Start adding the codes<b:if cond='data:blog.pageType != "item"'>
<script type="text/javascript">
var fade = false;
function showFull(id) {
var post = document.getElementById(id);
var spans = post.getElementsByTagName('span');
for (var i = 0; i < spans.length; i++) {
if (spans[i].id == "fullpost") {
if (fade) {
spans[i].style.background = peekaboo_bgcolor;
Effect.Appear(spans[i]);
} else spans[i].style.display = 'inline';
}
if (spans[i].id == "showlink")
spans[i].style.display = 'none';
if (spans[i].id == "hidelink")
spans[i].style.display = 'inline';
}
}
function hideFull(id) {
var post = document.getElementById(id);
var spans = post.getElementsByTagName('span');
for (var i = 0; i < spans.length; i++) {
if (spans[i].id == "fullpost") {
if (fade) {
spans[i].style.background = peekaboo_bgcolor;
Effect.Fade(spans[i]);
} else spans[i].style.display = 'none';
}
if (spans[i].id == "showlink")
spans[i].style.display = 'inline';
if (spans[i].id == "hidelink")
spans[i].style.display = 'none';
}
post.scrollIntoView(true);
}
function checkFull(id) {
var post = document.getElementById(id);
var spans = post.getElementsByTagName('span');
var found = 0;
for (var i = 0; i < spans.length; i++) {
if (spans[i].id == "fullpost") {
spans[i].style.display = 'none';
found = 1;
}
if ((spans[i].id == "showlink") && (found == 0))
spans[i].style.display = 'none';
}
}
</script>
</b:if>
Step 3 - Find this section of code and add following
<b:includable id='post' var='post'>
<div class='post uncustomized-post-template' expr:id=' "post-" + data:post.id'>
<a expr:name='data:post.id'/>
<b:if cond='data:post.title'>
<h3 class='post-title'>
<b:if cond='data:post.url'>
<a expr:href='data:post.url'><data:post.title/></a>
<b:else/>
<data:post.title/>
</b:if>
</h3>
</b:if>
<div class='post-header-line-1'/>
<div class='post-body'>
<b:if cond='data:blog.pageType == "item"'>
<p><data:post.body/></p>
<b:else/>
<style>#fullpost {display:none;}</style>
<p><data:post.body/></p>
<span id='showlink'>
<p><a href='javascript:void(0);' expr:onclick='"javascript:showFull(\"post-" + data:post.id + "\");"'>Read More...</a></p>
</span>
<span id='hidelink' style='display:none'>
<p><a href='javascript:void(0);' expr:onclick='"javascript:hideFull(\"post-" + data:post.id + "\");"'>Summary only...</a></p>
</span>
<script type='text/javascript'>
checkFull("post-" + "<data:post.id/>");
</script>
</b:if>
<div style='clear: both;'/> <!-- clear for photos floats -->
</div>
Step 4 - Format the post template
Type your summary here
<span id="fullpost">
Type rest of the post here
</span>
Kindly leave comment below for any question/difficulty occur.
That`s all. Thank you and happy peeking.
More topics on ikmalTips.
7 comments:
i'm getting this error.
"Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: Element type "div" must be followed by either attribute specifications, ">" or "/>"."
i tried doing this thrice.
Hey there Joe,
sorry for your bad experience.
Since I could not see the codes in action, I think you are having problems on step 3.
Please make sure that your codes are copied until
<div style='clear: both;'/> <!-- clear for photos floats -->
</div>
The code error suggest that your closing tag for the div is missing. The element <div> must end with the </div>. Check your closing element tag.
By <div> it means divide. You can put anything in between but must be closed properly. Tell me how it goes.
I'm glad to assist you ASAP.
I think its the step 2. This is the error
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The content of elements must consist of well-formed character data or markup.
I'm using the Arthemia theme. Here is the link
http://themelib.com/2008/09/arthemia-magazine-blogger-template/
Hey joe. in that case. try using the codes copied directly from this link.
http://rarunach.googlepages.com/hackosphere.js.html
Before this I encounter such problem when try editing the template. Every changes I made will be getting such error every time I marked the Expand Widget Templates box. In this hack you need too.
If you copied you codes perfectly and the problem still persists. Try using Internet Explorer. If its work, then I'm afraid your PC was on virus.
If you able to did it without changing the browser. Please let me know because I might code on my site was have been altered. Posting codes in post will have slight misalignment.
Sorry for your trouble. Hope to hear from you soon. Good luck.
Sorry for taking up your time.
i'm getting this error again.
"Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: Element type "div" must be followed by either attribute specifications, ">" or "/>"."
so i tried putting it part by part and found out that adding this little orange line in step3 causes the problem.
expr:id='"post-" + data:post.id'>
when i take it off there is no error but its still doesnt work. I can see 'Read More..' at the end of the post.
can u check it on template i told you? Arthemia theme for blogger.
i got it done. With help from this:
http://hackosphere.blogspot.com/2006/09/expandable-posts-with-peekaboo-view.html
Thanks for your help
That was quick Joe. Good to hear it.
I notice that codes might have been added by extra " ' " mark, I'm really sorry for this is my mistake and troubled you for past few days. Can be caused by transferring codes to Notepad and paste to post. But I should have double-check.
I'm sorry again. Have fun blogging Joe. will visit you soon.
Thanks alot for noticing me.
Post a Comment
Want to be notify on comment reply? Subscribe to: Post Comments