By: Ignacio
Date: 2005-05-06
Time: 17:40
|
Sub Blocks, notification when no data
Hi!
i want know how i do a sub block when if no data else notify ("no data")
Bye!
|
By: Skrol29
Date: 2005-05-06
Time: 18:16
|
Re: Sub Blocks, notification when no data
Hi Ignacio,
You can use 'nodata' sections for sub-blocks. They work the same way as for normal blocks. A 'nodata' section is displayed only if the sub-block has no data. If there is no data for the total of all sub-blocks, it is different.
Example of 'nodata' for sub-blocks:
<table>
<tr><td>
Town: [subblock.town;block=tr;p1=[mainbloc.id]]
</td></tr>
<tr><td>
No town for ID=[mainbloc.id]
[subblock.town;block=tr;nodata]
</td></tr>
</table>
|
|
By: Ignacio
Date: 2005-05-06
Time: 18:58
|
Re: Sub Blocks, notification when no data
yes i do that... but... don't work, look:
<input type="checkbox" value="[eq.id;block=tr]" name="id_equipamiento[]" id="id_equipamiento">
[eq.equipamiento]
<select name="id_equipamiento_op" id="id_equipamiento_op">
<option value="[eqop.id;block=option;p1=[eq.id]]">[eqop.opcion]</option>[eqop;block=begin;nodata][onshow;magnet=select][eqop;block=end]</select>
|
error no data: TinyButStrong Error (MergeBlock [eqop]): MySql error message when opening the query: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '%p1%' at line 1
|
By: Skrol29
Date: 2005-05-06
Time: 23:12
|
Re: Sub Blocks, notification when no data
hi Ignacio,
Your template looks ok for me.
I've tested it with a local MySQL data base and it worked as expected.
Here are the Php code I used:
$TBS->MergeBlock('eq',$con_id,'SELECT * FROM t_equipamiento ORDER BY id');
$TBS->MergeBlock('eqop',$con_id,'SELECT * FROM t_equipamiento_op WHERE parent=%p1% ORDER BY id');
|
I think your problem comes probably from the Php side. Did you merged the main block before sub-blocks? It should be done in this order.
Or maybe your problem is on the SQL statement.
Check also that you don't have other 'eqop' blocks in the templates.
I think about that because the error message you have suggests that TBS is not in sub-block mode for your query.
|
By: Ignacio
Date: 2005-05-07
Time: 19:47
|
Re: Sub Blocks, notification when no data
i use:
$tbs->MergeBlock('eq',$mmmd->_mySqlLink,'SELECT '.$tabla12.'.equipamiento,'.$tabla12.'.id FROM '.$tabla12.','.$us_tabla8.' WHERE '.$us_tabla8.'.id_equipamiento = '.$tabla12.'.id AND '.$us_tabla8.'.id_cliente = '.$id_cliente.'');
$tbs->MergeBlock('eqop',$mmmd->_mySqlLink,'SELECT '.$tabla13.'.opcion,'.$tabla13.'.id FROM '.$tabla13.' WHERE '.$tabla13.'.id_equipamientos=%p1%');
|
|
By: Skrol29
Date: 2005-05-07
Time: 21:27
|
Re: Sub Blocks, notification when no data
Mmhhhh...
Your Php seems ok too.
Maybe your template has an extra block definition for 'eqop' placed before the others and which has no parameter 'p1'. This can make the error message your have. Can you send your full template to me by email?
Just a comment which has nothing to do with you problem:
You dont' need to prefix the name of your fields by the name of the table in the SQL statement. You need to prefix fields only when they can be ambigious. For example when two tables are joinned in the same query and some fields of those two tables have common names.
|
By: Skrol29
Date: 2005-05-07
Time: 21:28
|
Re: Sub Blocks, notification when no data
By the way, what is you TBS version?
|
By: Ignacio
Date: 2005-05-07
Time: 21:29
|
Re: Sub Blocks, notification when no data
/*
********************************************************
TinyButStrong - Template Engine for Pro and Beginners
------------------------
Version : 2.01 for PHP >= 4.0.6
Date : 2005-01-03
Web site : www.tinybutstrong.com
Author : skrol29@freesurf.fr
********************************************************
This library is free software.
You can redistribute and modify it even for commercial usage,
but you must accept and respect the LPGL License (v2.1 or later).
*/
|
|
|
Posting in progress.
Please wait...
|