| By: szaki.5 Date: 2009-06-09 Time: 12:42 | Problem "IF THEN ELSE" with BLOCKHi, 
I need a little support, Why not working this code?
 
----- Html ----
 | <tr style="width:200px;background:#999999;color:#fff;"> <td style="padding-left:5px;height:40px">[news.getId;block=tr;htmlconv=no]</td>
 <td style="padding-left:5px;">[news.getTitle;htmlconv=no]</td>
 <td style="padding-left:5px;">[news.getCreateDate;htmlconv=no]</td>
 <td style="padding-left:5px;"><a href="?page=newnews&id=[news.getid]"><img src="images/icons/application_edit.png" /></a>
 [news.getApproved;IF[news.getApproved]=1 ;THEN '<a href="?page=newslist&id=[news.getId;noerr]&status=1"><img src="images/icons/accept.png" /></a>';ELSE '<a href="?page=newslist&id=[news.getId;noerr]&status=0"><img src="images/icons/cancel.png" /></a>']</td>
 <td> </td>
 </tr>
 
 | 
--- PHP ----
 | global $news; $criteria= new Criteria;
 $criteria->addDescendingOrderByColumn(NewsPeer::CREATEDATE);
 
 $news=NewsPeer::doSelect($criteria);
 
 $l = $this ;//new clsTinyButStrong ;
 $l->LoadTemplate('templates/newslist.tpl') ;
 $l->MergeBlock('news',$news) ;
 $l->Show();
 
 
 | 
Andras | 
	
      | By: Skrol29 Date: 2009-06-09 Time: 13:55 | Re: Problem "IF THEN ELSE" with BLOCKHello, 
TBS parameters are case sensitive. It should be "if", "then" and "else". 
And there must be a space after the parameter's name.
 
By the way, embedded TBS fields are working but it is slower. 
A nice alternative for your conditional link could be: | <a href="?page=newslist&id=[news.getId;noerr]&status=[news.getApproved;if [val]=1;then 1;else 0]"> <img src="images/icons/[news.getApproved;if [val]=1;then 'accept';else 'cancel'].png" />
 </a>
 
 | 
 | 
	
      | By: szaki.5 Date: 2009-06-09 Time: 14:09 | Re: Problem "IF THEN ELSE" with BLOCKThanks, 
I tried use your solution but that was not working.
 
---Template code---
 | <a href="?page=newslist&id=[news.getId;noerr]&status=[news.getApproved;if [news.getApproved]=1;then 1;else 0]"> <img src="images/icons/[news.getApproved;if [news.getApproved]=1;then 'accept';else 'cancel'].png" />
 </a>
 
 | 
--- HTML result ----
 | <a href="?page=newslist&id=22&status=[news.getApproved;if 1=1;then 1;else 0]"> <img src="images/icons/[news.getApproved;if 1=1;then 'accept';else 'cancel'].png" />
 </a>
 
 | 
Any idea? 
Andras | 
	
      | By: szaki.5 Date: 2009-06-09 Time: 14:25 | Re: Problem "IF THEN ELSE" with BLOCKIt's working.
 Sorry this is my mistake.
 
 Many thanks
 Andras
 | 
	
    
	
    
      |  | 
		  Posting in progress.Please wait...
 |