Get a count of the entries to be displayed before they get sent to the browser
Posted: 01 July 2008 09:02 AM   [ Ignore ]  
Summer Student
Total Posts:  29
Joined  10-10-2007

Good morning all,

I would like to execute some logic based on the number of entries that are returned.  I currently have a page that executes the following code:

<div id="blog">
            <
div id="headerEntries">
                
{exp:weblog:category_heading weblog="{my_weblog}"}
                
<h2 class="headerCategory">
                    
{category_name}
                
</h2>
                
{/exp:weblog:category_heading}
                {exp
:weblog:entries weblog="{my_weblog}"  orderby="date" sort="desc" limit="1"}
                {date_heading}
                
<h3 class="date">
                    
THIS ISSUE:: {entry_date format=' %F %Y '}
                
</h3>
                
{/date_heading}
                 {
/exp:weblog:entries}
            
</div>
            
{exp:weblog:entries weblog="{my_weblog}"  orderby="date" sort="desc" display_by="month"}
            
<h1 class="headerArchive">{title}</h1>
            <
div class="container_archive">
                <
p>
                    <
strong>{article_author}</strong>
                </
p>
                
{summary}
                
<p>
                    - <
a href="http://dev.vpi-is01/dsn/index.php/entries_archive_display/{url_title}" class="linkFull">Read Full Article</a>
                </
p>
            </
div>
            
{/exp:weblog:entries}
        
</div>

What I’d like to do is add code that would change what is displayed based on whether or not there is more than one entry.  Is there a way to do this?

Thanks.

Profile
 
 
Posted: 02 July 2008 03:00 PM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  29
Joined  10-10-2007

I’m sure that out of all of the geniuses on the board, someone could point me in some direction smile

Profile
 
 
Posted: 15 July 2008 11:39 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  50
Joined  07-09-2007

Hey VideoPlus,

Evaluating the EE weblog variable {total_results} with EE syntax {if} statements will give you what you need I think.  Something along the lines of:

{if total_results > 5}
...your code here...
{if:elseif total_results < 5}
...your code here...
{/if}

I hope this is helpful!

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65096 Total Logged-in Users: 55
Total Topics: 82244 Total Anonymous Users: 35
Total Replies: 442011 Total Guests: 288
Total Posts: 524255    
Members ( View Memberlist )