Categories > TinyButStrong general >

How do I let a conditional block <div>, still have its content displayed, if its corresponding mysql...

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: desbest
Date: 2010-09-06
Time: 06:26

How do I let a conditional block <div>, still have its content displayed, if its corresponding mysql database record merge block does not exist?

How do I let a conditional block <div>, still have its content displayed, if its corresponding mysql database record merge block does not exist?

For example, here is the conditional div.
<div class="playerback">
[getmyvote;block=div;p1=[rangen.id]]
Hello, I am content being displayed.
</div>

$TBS->MergeBlock("getmyvote",$conn,"SELECT * FROM votes WHERE songid='%p1%' && userid='$logged[id]'  ") ;

Here's the thing, if the database record merge block does not have a database record, if ic cannot pull one because it doesn't exist, the content inside the div (playerback class), it does not display.
Is there a way this omission of content inside the div can be avoided? I tried to use the noerr parameter added onto the template tag, but it didn't work.
Can there be a way to stop this content omission, like be a parameter for it?
By: Skrol29
Date: 2010-09-06
Time: 11:53

Re: How do I let a conditional block <div>, still have its content displayed, if its corresponding mysql database record merge block does not exist?

Hi,

If the "getmyvote" block can have several records (as the purpose let me guess it has), then you can use a "nodata" section for the subblock.
<div class="playerback">
  [getmyvote;block=div;p1=[rangen.id]]
  Hello, I am content being displayed.
</div>
<div class="playerback">
  [getmyvote;block=div;nodata]
  Sorry, no vote for this song.
</div>
By: desbest
Date: 2010-09-06
Time: 21:34

Re: How do I let a conditional block <div>, still have its content displayed, if its corresponding mysql database record merge block does not exist?

Thanks alot, it works. You were good enough to know that it was a democratic music promotion and discovery website so :)