[TYPO3-ttnews] A news counter in LIST view ?
Prakash
spabhat at chandanweb.com
Mon May 25 13:22:22 CEST 2009
> But in fact my problem is : who to get a counter ? :)
I believe you wanted to say how to get a counter.
If you can manage to have the output like this in tt_news then you can
use Prototype/jQery or any other popular JavaScript framework.
Most JavaScript frameworks have functions/method to get the count of
specified classes.
<div class="news-list-container">
<div class="news-list-item"> ...NEWS...
</div>
<div class="news-list-item"> ...NEWS...
</div>
<div class="news-list-item"> ...NEWS...
</div>
<div id="newslist-count"></div>
</div>
Is this case it could be something like using prototype:
document.observe("dom:loaded",function(){ if( $('newslist-count') ){
$('newslist-count').innerHTML = $$('div.news-list-item').length;} });
or Bind a function with your logic:
function myFunction(){
$('newslist-count').innerHTML = $$('div.news-list-item').length;
/*
your logic
*/
}
document.observe("dom:loaded",function(){ if( $('newslist-count') ){
myFunction();} });
--
*Regards,
Prakash A Bhat*
Skype/Yahoo/GTalk/MSN: spabhat
Ph: +91 80 420 33 515
Mobile: +91 94481 40430
www.chandanweb.com <http://www.chandanweb.com>
Chandan Web Solutions <http://www.chandanweb.com>
<http://www.chandanweb.com>
More information about the TYPO3-project-tt-news
mailing list