Hello,
I am trying to create a menu that has school program names with a little parenthesis next to each one showing how many sub-programs are assigned to the main program.
Problem being that I am getting the program name repeated the number of times there are weblog entries for.
I just want to use the “{total_results}” to show the total but no to show any other content. If I use that it shows the total, but also repeats it as I ve said before.
This is my current code:
{exp:channel:entries channel="microsoft" dynamic="off" disable="categories|trackbacks|member_data|pagination"} ({total_results})*</div> {/exp:channel:entries}
Also, I if I use, limit=”1” I do not get the total number of entries, as it assumes its one only…
thanks for your time
Hi,
A few ways of doing this, using your existing code the simplest way would just be to show the total results only on the first result so:
{exp:channel:entries channel=“microsoft” dynamic=“off” disable=“categories|trackbacks|member_data|pagination”}
{if count=="1"}<span>({total_results})<sup>*</sup></span>{/if}
{/exp:channel:entries}
A better way of doing it would be to use the query module replacing channel_id number (e.g. 1 below) with the id number of the ‘microsoft’ channel
{exp:query sql="SELECT Count(exp_channel_titles.channel_id) AS total_results FROM exp_channel_titles WHERE exp_channel_titles.channel_id = '1'"}
<span>({total_results})<sup>*</sup></span>
{/exp:query}
HI,
I tried using total_results and absolute_total_results (http://devot-ee.com/add-ons/absolute-total-results) in the below
{exp:channel:entries channel="gcse" dynamic="off"}
{if member_list == "{segment_2}" }
{if count=="1"}<span>({total_results})<sup>*</sup></span>{/if}
{/if}
{/exp:channel:entries}
but the conditional screws with the result calculation
with the conditional there are 2 results and using (count) proves that as does the output total_results and absolute_total_results returns 19 which is the result without the conditional i.e. there are 19 entries in the channel called
Any ideas why total_results and absolute_total_results ignore the conditional
Any fix? Thanks
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.