• Register
    • Help

    striker  0 Items
    Currently Supporting
    • Home
    • News
    • Forum
      • Try XenForo Demo
      • New Posts
      • FAQ
      • Calendar
      • Community
        • Groups
        • Albums
        • Member List
      • Forum Actions
        • Mark Forums Read
      • Quick Links
        • Today's Posts
        • Who's Online
      • Sponsor
        • Sponsor a Feature
        • List of Donors
    • Wiki
    • Support
    • What's New?
    • Buy Now
    • Manual
    • 
    • Forum
    • VaultWiki Discussion
    • General Discussion
    • Switch case

    1. Welcome to VaultWiki.org, home of the wiki add-on for vBulletin and XenForo!

      VaultWiki allows your existing forum users to collaborate on creating and managing a site's content pages. VaultWiki is a fully-featured and fully-supported wiki solution for vBulletin and XenForo.

      The VaultWiki Team encourages you to join our community of forum administrators and check out VaultWiki for yourself.

    Results 1 to 3 of 3

    Thread: Switch case

    • Thread Tools
      • Show Printable Version
    1. October 3, 2021 #1
      Luc
      • View Profile
      • View Forum Posts
      • View Blog Entries
      • View Articles
      Luc is offline
      Junior Member
      Join Date
      October 3, 2021
      Posts
      7
      Rep Power
      0

      Switch case

      Hi,

      I'm trying to make a template with a conditional argument (if-else if- else)

      I see that the switch function might do it but I can't find a way to make it work (or if it exists).

      I found a template that could work: https://www.vaultwiki.org/pages/Temp...mplate:testext

      Then, I tried to mimic the template so it's something like this

      Code:
      [if={{{Tagname}}}==Mod]1[TABLE]|- | style="width: 150px; background-color:#6799C1; color:#FFFFFF; text-align: center" | Moderator [/TABLE]
      [else /][if={{{Tagname}}}==Wiki]2[TABLE]|- | style="width: 150px; background-color:#038303; color:#FFFFFF; text-align: center" | Wiki Team [/TABLE]
      [else /]3Test
      [/if][/if]
      What I get is 1, 2 or 3Test

      I do not see the tables. My conditions are working since I see 1 and 2 when I call the template. Is there a better way or a way to make the table appear when I enter the condition?
      Reply With Quote Reply With Quote

    2. October 3, 2021 #2
      pegasus
      • View Profile
      • View Forum Posts
      • View Blog Entries
      • Visit Homepage
      • View Articles
      pegasus is offline
      VaultWiki Team
      Join Date
      March 28, 2004
      Location
      New York, NY
      Posts
      2,959
      Blog Entries
      18
      Rep Power
      688
      Those TABLEs are VaultWiki format (but are missing line breaks, which I believe are needed).

      However, if you are using vBulletin 4.1.4 or later or XenForo 2 or later, and if you installed VaultWiki after your forum was already that version, then your forum's TABLE is a different format (the one bundled with your forum). If you want to use VaultWiki's TABLE BB-Code, you will have to find it in your AdminCP's Custom BB-Code list, as it may have a different name (which you may want to change), and it may not be enabled by default.

      From what I read about the proposal, a switch function does not exist. It was determined that it doesn't actually make the code any easier to read later.
      - lead developer for VaultWiki
      Reply With Quote Reply With Quote

    3. October 4, 2021 #3
      Luc
      • View Profile
      • View Forum Posts
      • View Blog Entries
      • View Articles
      Luc is offline
      Junior Member
      Join Date
      October 3, 2021
      Posts
      7
      Rep Power
      0
      Right, with a little play, I was able to make it work

      Code:
      [if={{{Tagname}}}==Mod]
      [TABLE]
      |-
      | style="width: 150px; background-color:#6799C1; color:#FFFFFF; text-align: center" | Moderator
      [/TABLE]
      [else /][if={{{Tagname}}}==Wiki]
      [TABLE]
      |-
      | style="width: 150px; background-color:#038303; color:#FFFFFF; text-align: center" | Wiki Team
      [/TABLE]
      [else /]Unknown Tag
      [/if][/if]
      Reply With Quote Reply With Quote

    Similar Threads

    1. Use lower-case urls for articles
      By Sebi in forum VaultWiki Questions
      Replies: 3
      Last Post: March 17, 2010, 12:12 PM

    Tags for this Thread

    template

    View Tag Cloud

    Bookmarks

    Bookmarks
    • Submit to Digg Digg
    • Submit to del.icio.us del.icio.us
    • Submit to StumbleUpon StumbleUpon
    • Submit to Google Google

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •  
    • BB code is On
    • Smilies are On
    • [IMG] code is Off
    • [VIDEO] code is
    • HTML code is Off

    Forum Rules

    • Contact Us
    • License Agreement
    • Privacy
    • Terms
    • Top
    All times are GMT -4. The time now is 1:46 PM.
    This site uses cookies to help personalize content, to tailor your experience, and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Learn more… Accept Remind me later
  • striker
    Powered by vBulletin® Version 4.2.5 Beta 2
    Copyright © 2025 vBulletin Solutions Inc. All rights reserved.
    Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
    Copyright © 2008 - 2024 VaultWiki Team, Cracked Egg Studios, LLC.