[TYPO3-ttnews] A news counter in LIST view ?

Gregory Loichot gloichot at cross-systems.ch
Mon May 25 13:56:46 CEST 2009


Hello,

Thank you, but in fact it is not what I want to do. In my HTML code, 
there won't be a list of *all* news because there is a limit in the sql 
query (no more than 5). So, JS cannot "know" how many news there are.

I have to do this in PHP code. In tt_news, there is a hook 
(processSelectConfHook) to construct your own sql query, but after that 
you can only act on *each* query result, so you cannot know how many 
news there are (or I don't know how :)).

Any idea ?


Prakash a écrit :
> 
>> 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