Categories > TinyButStrong general >

Variables based on mysql data which change per database entry

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: desbest tynamite
Date: 2007-09-05
Time: 13:46

Variables based on mysql data which change per database entry

$TBS->MergeBlock("dlist",$conn,"SELECT * FROM downloads WHERE clan = '$myid' OR audience = 'public' ORDER BY id DESC LIMIT $offset, $rowsPerPage") ;

Inside the downloads table, there is a field called audience.
Some data entries have "public" in the audience field.
Some data entries have "private" in the audience field.

if ($rowx[audience] == "public")
//help me by stating what $rowx[audience] should be replaced by
{
   $audicon = "<img src='world.png'>";
  }
if ($rowx[audience] == "private") {
   $audicon = "<img src='house.png'>";
}

=========
the tpl file
=========
<table><tr><td> [var.audicon;block=tr]</td></tr></table>
// what should [var.audicon be replaced by? so that each row of the table displays the appropiate icon
By: TomH
Date: 2007-09-05
Time: 18:33

Re: Variables based on mysql data which change per database entry

Maybe you can rename the images so that you can take advantage of MergeBlock and  the tpl file looks like
<table><tr><td> <img src="[dlist.audience;block=tr].png"></td></tr></table>
By: desbest tynamite
Date: 2007-09-06
Time: 23:52

Re: Variables based on mysql data which change per database entry

yeah your idea is good but i would like to see my question answered please.

it would be excellent as a new feature
By: Skrol29
Date: 2007-09-07
Time: 02:15

Re: Variables based on mysql data which change per database entry

Something like sthis should work:

<table><tr><td>
   <img src="[dlist.audience;block=tr;if [val]='public';then 'world.png';else 'house.png']">
</td></tr></table>

Or WYSIWYG:
<table><tr><td>
   [dlist.audience;block=tr;if [val]='public';then '<img src="world.png">';else '<img src="house.png">']
</td></tr></table>

If the algorithm to give the image name is more complicate than that , you can alos use the parameter "ondata".
By: desbest tynamite
Date: 2007-09-08
Time: 02:13

Re: Variables based on mysql data which change per database entry

your post is so helpful, thanks
By: desbest
Date: 2009-06-21
Time: 15:27

Re: Variables based on mysql data which change per database entry

If you're looking for my myspace or music site, go to
http://tynamite.uk.to
http://www.myspace.com/tynamitemusic