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.

How to create a global variable that will auto increment its value

May 09, 2009 9:08pm

Subscribe [3]
  • #1 / May 09, 2009 9:08pm

    D2m.ca

    13 posts

    Hello everyone

    I need to figure out a way to create a global variable that its value will auto increment is the anyone done this before

    that means
    {integer} = 1

    the next when I use this {integer} variable the value would be different than 1

    Thanks..

    Please

  • #2 / May 10, 2009 4:56am

    Ingmar

    29245 posts

    You will need some PHP to do that, using the auto increment operator ++.

  • #3 / May 10, 2009 5:02am

    D2m.ca

    13 posts

    I try to put a for loop inside the global variable and echo
    it out however it didn’t do the job.

  • #4 / May 10, 2009 5:07am

    Ingmar

    29245 posts

    I have no idea what it is you are trying to achieve, can you show us some code? This should work, if done it on numerous occasions.

  • #5 / May 10, 2009 5:28am

    D2m.ca

    13 posts

    the reason I need a global variable that can auto increment is because the following reason

    I’m involve in a project that need to accomplish the following.

    using EE and Solspace’s Video module to create a weblog and for each entries from this weblog would have a list of videos found from youtube, blip.tv using the solspace’s video module.

    each and every entry would have a list of 9 videos wrap around with a div and you click the thumbail of the video Thickbox(alternative of lightbox) would pop up and the video plays inside the thickbox.

    however thickbox requires an id to be the event handler for each of every one of these videos

    that’s why I need a global variable that can auto increment, since Solspace’s video module doesn’t have a video id variable.

    here’s the code

    this div is connected with the code below - because id=“item1”

    
    
    


    This line of code is inside the {exp:video:entries} tag

    inlineId=item1   - item1 should be the same as the id from the div above so that when the user click on the image or link below the div above gets display in a thickbox, and that’s why I need a variable to can auto increment

    <ul class="videoThumbs"><li><a href="#TB_inline?inlineId=item1" class="thickbox">http://a.images.blip.tv/Torent4X90-bleach111691-785-819.jpg</a></li><li class="videoTxtLink"><a href="#TB_inline?inlineId=item1" class="thickbox">Foreign News Video</a></li><li class="videoClient">working blip.tv sample</li></ul>
  • #6 / May 10, 2009 1:11pm

    D2m.ca

    13 posts

    close topic.

    I’ve figure out the solution already thanks Ingmar

  • #7 / Jan 30, 2013 9:26am

    iPixel

    64 posts

    Any chance you can post your solution? I’m trying to create an autoincrement variable as well via EE syntax.

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

ExpressionEngine News!

#eecms, #events, #releases