Re: problem with <data:post.snippet/>

Uikithemes Channel <[email protected]>
Newsgroups gmane.comp.web.blogger.api
Message-ID <[email protected]>
Hi, Really when i'm develop blogger template I create some code with 
JavaScript to do that :)
Only place this code before </head> tag :

<script type='text/javascript'>
snippet_count = 200;

//<![CDATA[

function removeHtmlTag(strx,chop){
if(strx.indexOf("<")!=-1)
{
var snippet = strx.split("<");
for(var i=0;i<snippet.length;i++){
if(snippet[i].indexOf(">")!=-1){
snippet[i] = 
snippet[i].substring(snippet[i].indexOf(">")+1,snippet[i].length);
}
}
strx = snippet.join("");
}
chop = (chop < strx.length-1) ? chop : strx.length-2;
while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++;
strx = strx.substring(0,chop-1);
return strx+'...';
}
function createSnippet(pID){
var div = document.getElementById(pID);
var summ = snippet_count;
var summary = '<div class="snippets">' + removeHtmlTag(div.innerHTML,summ) 
+ '</div>';
div.innerHTML = summary;
}

//]]>
</script>

and now replace <data:post.snippet/> with this code :

<div expr:id='&quot;summary&quot; + data:post.id'><data:post.body/></div>
<script 
type='text/javascript'>createSnippet(&quot;summary<data:post.id/>&quot;);</script>

Now you can controle your number if characters by change this number like 
you want :
snippet_count = 200;

And Well Done!!

On Friday, 2 January 2015 01:32:57 UTC, BadAliceHere wrote:
>
> Hi there :) 
>
> My question is... Is there any possibility to change the amount of 
> characters due to post snippets? I'm talking about this thing 
> - <data:post.snippet/>.
>

-- 
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/bloggerdev.
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.