Current status of the Ning Platform is always available on the Ning Status Blog.

Forum

Replies

  • NC for Hire

    Hi Andrew , there are two ways of doing this:

    1) Use jQuery .load() to load up the event page and get the total event number out , this approach is simple however it will slow down(a little) your site for loading up another page.

    2) Using a much complicated technique which requires a server to store that information, first we obtain the currently existing event count , then add a function to add event button to increase that count , the count information will be stored in database of a server outside of Ning. Then when user loads the home page , a script will retrieve the count information from the server then display it out on home page textbox. Well I don't recommend this approach as it involves a lot of work but this one does not increase your site loadtime as much as first approach.

    Assume that you want the total events (upcoming+past events) , so we need to get the data from

    http://yournetwork/events/event/listAllTypes

    So here is the FIRST approach code:

    HTML: use this code so that the script can inject the count into the span(of course , put this in your textbox)

    <span id="eventcount"></span>


    You can put content in front of it like :

    Total Events: <span id="eventcount"></span>

    Now the script(put this in custom code):

    <script type="text/javascript">

    //coded by Elson Tan (@elsodev) elsodev.com
     var ecount = '0';
    if(x$('span#eventcount').length){
          
    //event count span exists
    x$('#xn_bar').before('<div id="ecountstore" style="display:none;width:0px;height:0px;"></div>');
    //we load up that page and put the html into an invisible box
    x$('#ecountstore').load('events/event/listAllTypes .xg_span-12 ul', function(){
    x$('#ecountstore ul li a').remove();
      x$('#ecountstore ul li').each(function(){
          var tempstore = x$(this).text();
          //we remove brackets from the each numbers
           var getecount = tempstore.replace(/\((.*?)\)/g, '$1');
         //we add it up to obtain a total
           ecount = parseInt(parseFloat(ecount) + parseFloat(getecount));
      });
    //after each function done , we display out the total
    x$('span#eventcount').html(ecount);
    });
    }
    else{
    }
    </script>

    There are a few things in the script that you may not understand:

    •        var getecount = tempstore.replace(/\((.*?)\)/g, '$1');

    This is to remove the brackgets using regex , you can learn more about it here , its awesome for matching things

    •        ecount = parseInt(parseFloat(ecount) + parseFloat(getecount));

    This is adding up to get the total value , I used parseFloat to turn it into an floating point integer , this might be new to you. What it does is to make your integer able to undergo calculation properly. Normally if you don't use parseFloat , javascript will turn 2+1 into 21 , while using parseFloat 2+1 =3 . You can learn more about it here

    That's it , hope it helps. I havent tested the code , just roughly coded , I hope it works.

  • NC for Hire

    TJ's script only gets the upcoming events count with brackets, not all existing events sum/total.

  • Thats cool...actually, I am only interested in the upcoming events. thanks guys.

This reply was deleted.

Search the Creators Network

Latest Activity

⚡JFarrow⌁ replied to ⚡JFarrow⌁'s discussion TIP: Multilingual QR Codes For Your Ning
"still awesome"
yesterday
Alan Oviatt is now a member of Ning Creators Network
yesterday
Anam replied to Alyce Keegan's discussion Problems reverting to old site theme
"I reported this in detail with screenshots etc for the first time on 21st July. The Ticket says ''w…"
Thursday
Theodocia McLean-ColdCoffeeCafe, Patrick Kiss and Fernando Torres joined Ning Creators Network
Thursday
Kos replied to Shravan Panuganti's discussion Ning 3.0 Migration ?
"They halted migration and stopped building out 3.0 completely a few years ago.  There are tons of d…"
Thursday
Kos replied to Alyce Keegan's discussion Problems reverting to old site theme
"Nothing since the 12th for me.  My status says "waiting".  What a failure."
Thursday
⚡JFarrow⌁ replied to Alyce Keegan's discussion Problems reverting to old site theme
"Has anyone heard anything new about this?  I am having the same problem with 3 networks now!"
Thursday
⚡JFarrow⌁ replied to ⚡JFarrow⌁'s discussion Work Around for Importing Facebook Page RSS Feeds
"anyone else tried this?"
Thursday
francis Pascual replied to Nancy Gruver's discussion Migration from Ning to WordPress
"Thanks Jamie!"
Wednesday
⚡JFarrow⌁ replied to Shravan Panuganti's discussion Ning 3.0 Migration ?
"Ning has all of us in this holding pattern.  Your guess is as good as anyones.  Ning is a mysteriou…"
Wednesday
Jamie Baker replied to Nancy Gruver's discussion Migration from Ning to WordPress
"I've done that with one network, of course you can with text but images etc you cannot as they were…"
Aug 21
Jamie Baker replied to Nancy Gruver's discussion Migration from Ning to WordPress
"Can't help there sorry Kos, personally I bit the bullet and started a fresh with multiple networks.…"
Aug 21
francis Pascual replied to Nancy Gruver's discussion Migration from Ning to WordPress
"Has anyone tried just copying and pasting their content on to a new site. Because even if you are a…"
Aug 21
Josef Essberger replied to The Ning Team's discussion Notice of 2016 Storage Limit and Pricing Plan Changes
"With Garfield Archivist's help, we recently reduced the number of members from approx 140,000 to un…"
Aug 19
Roy Sheridan is now a member of Ning Creators Network
Aug 18
Kos replied to Nancy Gruver's discussion Migration from Ning to WordPress
"Francis blog posts, their comments and Groups were migrated to WP.  The forums, their comments, eve…"
Aug 17
francis Pascual replied to Nancy Gruver's discussion Migration from Ning to WordPress
"Hi Kos are you manually inserting blog post or are you using some other method. We are frustated be…"
Aug 17
Gus, Béla Bodolai, JoAnn Jordan and 2 more joined Ning Creators Network
Aug 17
Kos replied to Crystal's discussion Bugs, Broken Links, and other Glitches on Creators 3.0
"Their response:

I've forwarded this to our engineering team and they are investigating the error.…"
Aug 12
Katy Blagg replied to Crystal's discussion Bugs, Broken Links, and other Glitches on Creators 3.0
"I've been getting the same issues for weeks also. Exaclty as you just said above."
Aug 12
More…