ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Showing total entry count

August 10, 2011 12:42pm

Subscribe [3]
  • #1 / Aug 10, 2011 12:42pm

    *Mark*

    60 posts

    Hello

    Firstly big thanks to Leslie for giving me a free copy of EE to run http://antispec.com/.

    I’ve two questions if I may.

    Each face in support of the AntiSpec campaign is a separate EE entry. On the homepage I would like to show the total amount of faces in support as a whole number.  So something like:

    “Currently 923 designers support the AntiSpec campaign!”

    I see I can use

    {total_results}

    but that means I have to have all entries showing for it to calculate that number.  Is there a way to grab this number and use anywhere?

    My second question.  I only launched last Thursday and I already have over 900 faces/entries.  Having 900+ faces on the homepage gives the campaign its impact. I think 900+ is pushing the amount of server calls though.  Ideally I’d like to have the faces loaded in stages. Maybe in blocks of 300.  Perhaps the user clicks to load more onto the same page.

    Has anyone achieved something of that nature before with EE?

    Many thanks for reading 😊

    Best Mark

  • #2 / Aug 10, 2011 12:50pm

    Dave @ Exp:resso

    465 posts

    Well if you’re not deleting any entries you could always just get the entry id of the latest entry 😊

    Whats the antispec campaign if you dont mind me asking?

    Sounds like you should use ajax to get an infinite scroll effect like facebook - we used it on our portfolio (crescendo.net.nz/portfolio) Happy to help with this if you want, but its 4am right now!

  • #3 / Aug 10, 2011 5:32pm

    *Mark*

    60 posts

    Hey Dave.

    I’m not deleting any entries 😊  How would I grab and output the last entry ID please?

    Whats the antispec campaign if you dont mind me asking?

    Working on spec is when a single designer or agency design for free in the hope of winning a project a la a 99designs.com.

    Sounds like you should use ajax to get an infinite scroll effect like facebook - we used it on our portfolio (crescendo.net.nz/portfolio) Happy to help with this if you want, but its 4am right now!

    Yes that’s exactly what I’m after!  I’d love that ajax code if you don’t mind 😊

    Thanks for responding.

  • #4 / Aug 10, 2011 6:37pm

    Marcus Neto

    1005 posts

    Mark,

    Unfortunately that is a limitation of that particular tag. What you could do is use some SQL magic to get to the same result

    {exp:query sql="SELECT COUNT(*) AS total_designers
    FROM exp_channel_data"
    WHERE channel_id = [id of channel the form dumps into]
    }
    Currently {total_designers} designers support the AntiSpec campaign!{/exp:query}

    We don’t normally support this kind of thing but I think this will work for you. I’m moving this thread to Community Help for you to continue to get some help form folks and will stay subscribed as well.

  • #5 / Aug 10, 2011 11:23pm

    Dave @ Exp:resso

    465 posts

    Yep Marcus’s query is the best way to go here

    Ok so for the ajax, you can get started with this forum thread - http://ellislab.com/forums/viewthread/163036/ - and then feel free to have a look at the source on our portfolio page. Basically you need to modify the js file to match the limit param you set in your channel entries tag. Otherwise you just set it up with normal pagination, and then initialise it with:

    [removed][removed] 
            [removed] 
                $(document).ready(function() {
                    $('#portfolioitems').infinitescroll({ navSelector  : ".pagination", nextSelector : "a.nextpage",itemSelector : ".portfolioitem" });
                });
            [removed]

    Note you need to add an div with an ID around your block of results, and a class on each individual result (#portfolioitems and .portfolioitem above). Also you need to put your pagination with an element (.pagination above) and your next page link with a specific class (a.nextpage above).

    Let me know how you get on. Thinking about making a module to take care of this in future

  • #6 / Aug 11, 2011 3:33am

    Dave @ Exp:resso

    465 posts

    By the way I fully support antispec, finally managed to load it & find what it was about (loading incredibly slowly for me).

    Have actually used 99designs recently, simply as a brainstorming tool because a client wanted to get a lot of ideas quickly, they’re charging 30% in fees now, its a joke. We got about 200 responses, 99% of them completely hopeless. Most looked like they had just downloaded an illegal copy of photoshop and were having their first play with it, others just looked like clipart or stock icons. I doubt any of them (or their clients) remotely understand the complexities of a good logo. I guess a few hundred is a lot of money for some people, considering most of the designers on there are from 3rd world countries, or teenagers wanting some pocket money.

  • #7 / Aug 11, 2011 3:50pm

    *Mark*

    60 posts

    @Marcus that worked a treat thank you very much 😊

    @Dave Many thanks for your help so far 😊  I’ve think I’ve followed everything but it’s not working.

    [removed][removed]
    [removed] 
                $(document).ready(function() {
                    $('#avatars').infinitescroll({ navSelector  : ".pagination", nextSelector : "a.nextpage",itemSelector : ".avatar" });
                });
    [removed]
    <div id="avatars">
            
                {exp:channel:entries channel="faces" dynamic="on" orderby="entry_id" sort="asc" limit="200" paginate="bottom" status="open"}
            
            <div class="avatar"><a href="http://{face_url}"><a href="{upload_face:thumb_url}bldGwzAQEboWVfbIuhTRnY9StmKgapvstypography_img_src_end width=38_         ">{upload_face:thumb_url}bldGwzAQEboWVfbIuhTRnY9StmKgapvstypography_img_src_end width=38_         </a></a></div>
    
            {paginate}
            <div class="pagination"> 
                <span></span> 
                    <a href="http://{site_url}main/test2/P200class=nextpage">Next Page</a> 
            </div> 
            {/paginate}
            {/exp:channel:entries}
            
            </div><!--end avatars-->

    I think the above is all correct so that must mean the infinatescroll script isn’t right.

    http://inspr.in/9Cql

    I’ve checked your version Dave and replaced ‘6’ with ‘200’ where I found a handful of 6’s.

    The page I’m working on is here http://antispec.com/main/test2/

    Don’t know what else to try :|

    Many thanks,
    Mark

  • #8 / Aug 11, 2011 9:01pm

    Dave @ Exp:resso

    465 posts

    Firstly try loading jquery before the scroll script, the scrpt itself isnt even being loaded it looks like, since i can still see your pagination.

    You’ve missed two more ‘200’s in the determinepath function

    The pagintationtotal span should have a title of the number of pages (i think its {total_pages} or something similar in EE)

    Hope this helps!

  • #9 / Aug 12, 2011 9:37pm

    Mark Bowen

    12637 posts

    Sorry to butt in on the post like this but just wondering if you could not perhaps use the Statistics Module Tag to get what you want perhaps?

    http://ellislab.com/expressionengine/user-guide/modules/statistics/index.html#var_total_entries

    {exp:stats channel="your_channel_name_here"}
    
    Currently {total_entries} designer{if total_entries != "1"}s{/if} support{if total_entries == "1"}s{/if} the AntiSpec campaign!
    
    {/exp:stats}

    Best wishes,

    Mark

  • #10 / Aug 16, 2011 6:55am

    *Mark*

    60 posts

    Apologise to you both for late response. Crazy here.  Just quick reply to say I will look into this when I have some down time.

    Many thanks 😊

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases