Conditional question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pank
    Senior Member
    • Mar 2001
    • 466

    Conditional question

    When 1.0 came out I found an easy way to add a Blog button to the header template using:
    Code:
    <if condition="$loadblogtemplate">
    When 1.0.1 came out it seemed to break that conditional. I found a new way to call that using:
    Code:
    <if defined="$VBBLOG_CACHED_TEMPLATES">
    I just discovered an error with that conditional... It shows up even if a user does not have the blog installed. Also it still shows up if you turn your Blog off.

    I dug a bit deeper and tried this (See code below). It seems to work well. The button will show if the Blog is enabled and it won't show if the Blog is turned off. Even better it won't show on a board without a Blog installed.

    My question: Is this the best way to do this? It seems to work really well but before I update my skins I'd like to know if anybody has a better way or if this is the best route to take.
    Code:
    <if condition="$vbulletin->products['vbblog']">
    I also did already try all the staff suggestions here.

    Thanks.
    Bob- (pank)
    pankpages.com / http://twitter.com/_pank
  • Floris
    Senior Member
    • Dec 2001
    • 37767

    #2
    Perhaps check if the option for one of the vb blog options is empty or not? if empty .. perhaps it's not installed?

    <if condition="!empty($vbulletin->options['vbblog_trackback'])">The value is not empty, so it's set to yes or no, we can assume vbblog is installed?</if>

    Comment

    • pank
      Senior Member
      • Mar 2001
      • 466

      #3
      Thanks Floris

      I just tried your code and it seems to work perfectly as well:
      Code:
      <if condition="!empty($vbulletin->options['vbblog_trackback'])">
      The Blog button shows up in the header template when active, disappears when the Blog in deactivated, and does not show up on a forum with no Blog installed.

      Now my question...
      Is that a better conditional to use than the one I used?
      Basically which one is a safer route to take for future Blog updates?

      Code:
      <if condition="!empty($vbulletin->options['vbblog_trackback'])">
      or...

      Code:
      <if condition="$vbulletin->products['vbblog']">
      Or, does it really make a difference?

      Thanks again for the tip!
      Bob- (pank)
      pankpages.com / http://twitter.com/_pank

      Comment

      • Freddie Bingham
        Former vBulletin Developer
        • May 2000
        • 14057
        • 1.1.x

        #4
        $vbulletin->products['vbblog'] should do fine.

        Comment

        • pank
          Senior Member
          • Mar 2001
          • 466

          #5
          Originally posted by Freddie Bingham
          $vbulletin->products['vbblog'] should do fine.
          Works perfect in all situations!
          Thank you Freddie and thank you to Floris
          Bob- (pank)
          pankpages.com / http://twitter.com/_pank

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...