if conditionals Q

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Howell
    New Member
    • Apr 2007
    • 28
    • 3.8.x

    if conditionals Q

    I have custom profile fields to show what type of car a member is driving.

    I have it set up to display in the postbit using..

    Code:
    <if condition="$post['field10']"><div>$vbphrase[drives]: <a href="$post[field11]">$post[field10]</a></div></if>
    Is it possible to have an <if conditional> to make the car appear but not as a link to the thread they have specified?

    For example if they have a car only in the 'Drives' field then it will show as static text.

    But if they have both the 'Drives' and 'Gallery link' filled in then it will show as a link to that thread?


    Last edited by Howell; Sun 20 May '07, 1:07pm.
  • tehQspm
    New Member
    • Mar 2007
    • 10
    • 3.6.x

    #2
    I take it field10 is the Drives field and field11 is the link to the gallery image? If so then:

    Code:
    <if condition="$post['field10']"><div>$vbphrase[drives]: <if condition="$post['field11']"><a href="$post[field11]">$post[field10]</a>
    <else />$post[field10]</div></if></if>
    'should' take care of it.

    From what I understand there are a couple of ways of doing this and the way above may not be the easiest (code-wise).

    Keep in mind the above will not work at all if the Drives field is empty as it is the first conditional check. But that's probably what you're going for?

    Comment

    • Howell
      New Member
      • Apr 2007
      • 28
      • 3.8.x

      #3
      Excellent!

      Thank you that's just what I was looking for.

      Comment

      • Dannyloski
        Member
        • Jun 2006
        • 53

        #4
        OMG! Just what i needed for my Car Forum, lol ... I was doing it in a way that really sucked and wasnt doing what I wanted ... This now solved my problem, if no link, then its static, if its linked then it shows it, muahahah ... yes! lol ... Sorry just happy ...

        EDIT: Now I have a question ... This modification makes it so that if the Linking Profile Field (field13 for me) is blank it makes it Static on the Postbit, which is what I want ... but the way I was doing this before I had it so that it would just show up as "http://" from Registration (didnt know about Conditionals and Stuff back then) ... Now I have some members (over 300) that have "http://" displaying in the Linking Profile Field, since when they registered it was set to that. Is there an option in vB where I can replace all of the users who have "http://" on this profile field and make it blank - or would I have to do it manually to each of those 300+ users? Maybe I can run a query or something to edit it in the Database (but what would it be), please help?

        Would I be able to run a query like this (see below) and would it work? I dont even know if the syntax is rigth, but that's why I'm asking, lol ...

        UPDATE [tableprefix]_userfield IF field13='http://' SET field13='';
        Last edited by Dannyloski; Sun 1 Jul '07, 7:19pm.

        Comment

        • Dannyloski
          Member
          • Jun 2006
          • 53

          #5
          Nevermind, figured it out ... did some digging here is the actual query for futere reference for others ...

          UPDATE tjdm_userfield SET field13 = REPLACE(field13, 'http://', '')

          Comment

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