• Need a bit of help...

    From Fireball@VERT/FBEX to All on Saturday, December 12, 2015 17:59:27
    I've been trying for hours now and can't figure out the problem with this.

    I want rounded corners on my group listings, so I did some digging around and found some stuff that I thought would work. The table was easy and the 2 top cells were easy, but the bottom 2 cells aren't so easy. I know what has to happen; find the last element in the array and add the new sub class to it.

    Everything I've tried either adds the rounded corners to all of the array elements or none of them. Here's what I've got in my msgs/groups.inc...

    <td class=@@JS:if(msg_area.grp_list[msg_area.grp_list.length-1]){'"grouplist2 bottomLeftRadius"'}else{'"grouplist2"'}@@><a class="grouplist2" href="subs.ssjs?
    msg_grp=^^groups:name^^">%%groups:description%%</a></td>
    <td class=@@JS:if(msg_area.grp_list[msg_area.grp_list.length-1]){'"grouplist2 right bottomRightRadius"'}else{'"grouplist2 right"'}@@>@@JS:msg_area.grp_list[RepeatObj.index].sub_list.length@@</td>

    I've tried variations on RepeatObj, but I can't seem to find how this thing is indexed. Any help would be great!

    -=Fireball=-

    ---
    þ Synchronet þ Fireball Express!!! BBS - http://fireballex.com telnet://fireballex.com
  • From echicken@VERT/ECBBS to Fireball on Saturday, December 12, 2015 22:13:29
    Re: Need a bit of help...
    By: Fireball to All on Sat Dec 12 2015 17:59:27

    I've tried variations on RepeatObj, but I can't seem to find how this thing is indexed. Any help would be great!

    The RepeatObj variable is explained at the top of web/lib/template.ssjs. I don't think that this will entirely solve your problem, but you'll want to start by wrapping your code in a <<REPEAT groups>> ... <<END REPEAT groups>> block.

    However at a glance I'm not sure what the purpose of this is:

    if(msg_area.grp_list[msg_area.grp_list.length - 1]) { ... }

    It looks like you're testing for the existence of something that is almost guaranteed to exist unless msg_area.grp_list.length is zero. You'll probably want to do something like:

    if(RepeatObj.index === msg_area.grp_list.length - 1) { ... }

    Which will tell you if you're at the last entry in the list.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Fireball@VERT/FBEX to echicken on Sunday, December 13, 2015 09:38:14
    Re: Need a bit of help...
    By: Fireball to All on Sat Dec 12 2015 17:59:27

    I've tried variations on RepeatObj, but I can't seem to find how this thing is indexed. Any help would be great!

    The RepeatObj variable is explained at the top of web/lib/template.ssjs. I don't think that this will entirely solve your problem, but you'll want to start by wrapping your code in a <<REPEAT groups>> ... <<END REPEAT groups>> block.

    However at a glance I'm not sure what the purpose of this is:

    if(msg_area.grp_list[msg_area.grp_list.length - 1]) { ... }

    It looks like you're testing for the existence of something that is almost guaranteed to exist unless msg_area.grp_list.length is zero. You'll probably want to do something like:

    if(RepeatObj.index === msg_area.grp_list.length - 1) { ... }

    Which will tell you if you're at the last entry in the list.


    Thanks echicken! It worked! I knew I had to make a comparison, I just wasn't sure
    what to compare. I had all kinds of crazy stuff going on after I sent out the email. I learned something today. :D Thanks again!

    Regards,
    -=Fireball=-

    ---
    þ Synchronet þ Fireball Express!!! BBS - http://fireballex.com telnet://fireballex.com