Forums / Cotonti / Extensions / show only the first news items with body text

index_news plugin

ez
#1 2009-11-24 23:15
I have a question:

In the news plugin I only want to show the first few x (1,2,3) newest items
with a PAGE_ROW_TEXT, all the other items i want to show without PAGE_ROW_TEXT

So only the newest ites are shown with a body text, the rest only (e.g. titles)


Can it be done without hacking the plugin !

Maybe with XTemplate ??

Please let me know

Added 5 hours 27 minutes later:

I have found a way to do this, BUT i have to modify the news plugin...
It would be a nice additional option.. ;)

In the configuration file:
    Show complete items: 3

If this value is smaller than maxpages then some items will NOT show the PAGE_ROW_TEXT.
I still have to test some more with this (in combination with tpl files)


Basically this will show a number off complete news items, and when they are older, then you show only the date, title, number off comments (just one line)


Maybe this option is something to put in the core ????
==- I say: Keep it EZ -==
This post was edited by ez (2009-11-25 04:42, 14 years ago)
pieter
#2 2009-11-25 05:07
I like the idea
... can we help you ...
ez
#3 2009-11-25 05:29
I have allready made it... :D (works great)

In the news.tpl you can now show content in a minified way (so a one line style news items)
I did it with Xtemplate (i like Xtempl..)
It also shows a number off COMPLETE news items (configurable)

in the news.tpl
    <!-- IF {PHP.newsoutputcomplete} = 1 -->
    <div class="newsBody">{PAGE_ROW_TEXT}</div>
    <div class="newsPosted">{PHP.L.Poster}: {PAGE_ROW_OWNER}</div>
    <div class="newsOther">{PHP.L.Category}: {PAGE_ROW_CATPATH} &nbsp;&nbsp; {PAGE_ROW_COMMENTS}</div>
    <!-- ENDIF -->


@theadmins Cotonti
Should i report this nice option somewhere.. ??
==- I say: Keep it EZ -==
Dayver
#4 2009-11-25 07:29
May be? :
    <!-- IF {PAGE_ROW_NUM} < 3 -->
    <div class="newsBody">{PAGE_ROW_TEXT}</div>
    <div class="newsPosted">{PHP.L.Poster}: {PAGE_ROW_OWNER}</div>
    <div class="newsOther">{PHP.L.Category}: {PAGE_ROW_CATPATH} &nbsp;&nbsp; {PAGE_ROW_COMMENTS}</div>
    <!-- ENDIF -->
Pavlo Tkachenko aka Dayver
ez
#5 2009-11-25 17:33
Hi Dayver,

This also works thnx....

There is one difference if you have got pagination on, on every new page the first 2 will display
the page_row_text...
My setup only show the first 2 newest articles full text...
On every next page it will stay 'minified' (this is different from your setup)

But your option is worth concidering, because my option will need coding in the news plugin..
On the other hand, the coding I did was SO small, that it still could be usefull... to add
to the cotonti system..

If you do not use pagination (Dayver's option is the best way ;))


//===========================================================================
Edit: IDEA.. I have to adjust my thinking, i have got an even better idea thnx too Dayver
//===========================================================================

what if we do this. Only change the PAGE_ROW_NUM output to:
OR make a new TAG called PAGE_ROW_NUMTOTAL that is $d+$jj

And maybe do the extra setup config... (but that is not needed you can
always hardcode the number into the TPL)
For the people who want to use pagination with a configuration, maybe this is your code:


I think it still is a nice (very small) feature to put in the standard Cotonti, but you may decide on that... :)
The idea and code is available, have fun with it..
==- I say: Keep it EZ -==
This post was edited by ez (2009-11-25 19:52, 14 years ago)
Dayver
#6 2009-11-25 23:59
I do not agree with those that would make changes to the plugin. The problem can be solved like this
  <!-- IF {PAGE_ROW_NUM} < 3 AND !{PHP.d} -->
    <div class="newsBody">{PAGE_ROW_TEXT}</div>
    <div class="newsPosted">{PHP.L.Poster}: {PAGE_ROW_OWNER}</div>
    <div class="newsOther">{PHP.L.Category}: {PAGE_ROW_CATPATH} &nbsp;&nbsp; {PAGE_ROW_COMMENTS}</div>
    <!-- ENDIF -->
Probably something like this
Pavlo Tkachenko aka Dayver
ez
#7 2009-11-26 04:34
Thanks, if this works, then it is fine.. ;)

Anyway there is a way, so thats great !
==- I say: Keep it EZ -==