Multiple if commands but only one is needed per forum. How?

Discussion in 'PHP' started by Kurg, Jan 3, 2009.

  1. #1
    To keep this simple here is what I have and what I need.

    I have vbulletin on my site, it has 10 forums showing on the index page. I need to place a different link next to the title of each forum.

    It's easy to do using something like this in forumbit...

    <if condition="$forumid ==1">insert link A</if>
    <if condition="$forumid ==2">insert link B</if>
    <if condition="$forumid ==3">insert link C</if> etc....
    Code (markup):
    BUT with just 10 forums the slowdown is noticeable, not very big... but it's there. So what I'd like to do is combine the 10 seperate "if commands" into one. Each forum only needs one link so running 10 if commands to get it doesn't seem ideal.

    How ?
     
    Kurg, Jan 3, 2009 IP
  2. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #2
    That's not php.
     
    Kaizoku, Jan 3, 2009 IP
  3. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #3
    10 ifs takes a millisecond at most, (normally considerably less.)

    I very much doubt it's noticeable even if you're benchmarking, (and even then, we're talking TINY amounts.)

    Dan
     
    Danltn, Jan 3, 2009 IP
  4. Kurg

    Kurg Member

    Messages:
    260
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    33
    #4
    It's php last I checked Vbulletin code.

    The 10 if commands running at once as described above don't take much computational power, I agree, but as I mentioned I need NOT to run 10 because what each if command does is resource intensive in this case. Each if command contains a javascript file and although 9 of the 10 will always return a negative I have tracking that says the java file is being retrieved 10 times and launched once. The file is executing into god knows where each time it's retrieved even if it doesn't display in a visitors browser every time. It's because of the cache system most likely and it is NOTICEABLY slowing down page load times, again not a lot but it IS noticable.

    I have three options.

    #1 - streamline the method of making those checks.
    #2 - look into improving the caching system.
    #3 - fix whatever is triggering the javascript being executed prior to being sent to the visitors browser.

    Option #3 is a nightmare - vbulletin code is extremely fragmented to begin with. TONS of whitespace is left with each if command and sometimes a file needs another file to pull information from a third file. Forumhome+navbits+level specific navbits for example.

    ANYWAY - anyone care to take a crack at condensing the 10 if commands? Is it possible
     
    Kurg, Jan 5, 2009 IP
  5. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #5
    I see, so it's some kind of kiddie version of php.
     
    Kaizoku, Jan 5, 2009 IP