Forumlar / Cotonti / Support / Show data only if my list contains more than 3 items.

foxhound
#1 2015-04-28 07:38

I am trying to make something show in my list but only if the list contains more than 3 items.
In the past (with Genoa) I used this: 

<!-- IF {LIST_ROW_NUM} == 2 AND {LIST_ROW_COUNT} > 2 -->

But that no longer works.
I have been going through all available tags (using debug) and also scrolled through all available php globals (using php|dump) but I can not think of any way to do it.
Do I need to write a plugin for such a small thing or am I missing something? :)

I hope someone knows a simple way to do this!

<img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
Dayver
#2 2015-04-28 20:49

But that no longer works.

But this tags have in Siena:

{LIST_ROW_NUM} - https://github.com/Cotonti/Cotonti/blob/master/modules/page/inc/page.list.php#L397 Showed how many pages in categories

{LIST_ROW_COUNT} - https://github.com/Cotonti/Cotonti/blob/master/modules/page/inc/page.functions.php#L203 Show count visited page

 

Pavlo Tkachenko aka Dayver
foxhound
#3 2015-04-29 08:15

Yes, both tags are there but they will not let you output data in the list if there are more than 3 items in it.
In Genoa LIST_ROW_COUNT was used to count how many items were in the list but with Sienna that count now shows how many times the page was viewed. Of course that is of no use to me anymore cause I need to know how many items are in the list.

{LIST_ROW_NUM} gives the number of a specific item in the list, but again that does not tell me how many items there are in the currently displayed list.

I want to show a message if the current list viewed has at least 2 and more than 3 items. And no matter what I tried with the available tags that simply is not possible anymore. Or at least I can not figure it out.
 

Maybe this clears up what I want to do?

MY LIST
=====

ITEM 1

ITEM 2

my custom message shows cause there are at least 2 items and more than 3 items in the list

ITEM 3

=====

 

Or:

MY LIST
=====

ITEM 1

ITEM 2

=====

<img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
Kort
#4 2015-04-29 11:18
...
<!-- BEGIN: LIST_ROW -->
  <li>
    <span>{LIST_ROW_SHORTTITLE}</span>
<!-- IF {LIST_ROW_NUM} == 2 -->
this is item No. 2
<!-- ENDIF -->
  </li>
<!-- END: LIST_ROW -->
...

This outputs custom html code for the second item in the list. Checking LIST_ROW_COUNT makes no sense, for it outputs page hitcount

SED.by - создание сайтов, разработка плагинов и тем для Котонти
foxhound
#5 2015-04-29 13:36

I see I was approahing this the whole wrong way (purely cause i kept trying to do it the same way as I used to). Instead of showing something after list_row_num = 2 and before list_row_num = 3 which code I added to the end of the LIST_ROW block I figured I should reverese my approach.
So now I added the code to show my message at the start of the LIST_ROW block and only show it if list_row_num = 3. Since I added it at the beginning of the block it will now show after 2 if there is 3.

I am sure people wont believe me if I say how much time I have waisted thinking about and trying to solve this, only running around in circles. Only now to realise a change of position within the block fixes everything :)
 

<img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />