By: testebr
Date: 2006-04-26
Time: 07:29
|
issue using MergeBlock
hi gringos,
my codes are in portuguese, but the idea is universal. See my problem:
template page 1
<script>total_de_noticias = [bloco1.#];</script><table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border: 1px solid #e0e0e0; border-bottom: 0px;">
<tr>
<td>
<table cellspacing="2" cellpadding="2" border="0" style="margin: 15px;">
<tr>
<td><img src="imagens/folha.gif" alt="" width="14" height="16" border="0"></td>
<td><span id="total_news" style="font-weight: bold;">[bloco1.#;]</span> Notícias no sistema</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#E0E0E0" class="sortable" id="t1" style="border-collapse: collapse; border: 1px solid #e0e0e0;">
<tr>
<td width="41" align="center" valign="middle" class="sort">ID</td>
<td width="290" align="center" class="sort">Título</td>
<td width="120" align="center" class="sort">Autor</td>
<td width="140" align="center" nowrap class="sort">Data do Envio</td>
<td width="78" align="center" class="sort">Acessos</td>
<td width="78" align="center" class="sort">Ação</td>
</tr>
<tr id="tr_[bloco1.id]">
<td align="center">[bloco1.id;htmlconv=no;block=tr]</td>
<td><a href="noticias/[bloco1.permalink;htmlconv=no]" target="_blank">[bloco1.titulo;htmlconv=no]</a></td>
<td align="center"><a href="usuarios/[bloco1.username;htmlconv=no]" target="_blank">[bloco1.username;htmlconv=no]</a></td>
<td align="center">[bloco1.data;htmlconv=no]</td>
<td align="center">[bloco1.acessos;htmlconv=no]</td>
<td align="center"><a href="javascript: ajax('editar_noticia&id=[bloco1.id;]');" title="Editar Notícia - ID [bloco1.id;]"><img src="imagens/editar.png" alt="Editar Notícia - ID [bloco1.id;]" width="16" height="16" border="0"></a> <a href="javascript:void(0)" title="Apagar Notícia - ID [bloco1.id;]" onclick="if(confirm('Deseja realmente enviar a notícia [bloco1.id;] para a lixeira?')){ajax('apagar_noticia&id=[bloco1.id;]');} return false;"><img src="imagens/apagar.png" alt="Apagar Notícia - ID [bloco1.id;]" width="16" height="16" border="0"></a> <input type="checkbox" value="" onclick="pinta('2')"></td>
</tr>
<tr bgcolor="#eeeeee" id="tr_[bloco1.id]">
<td align="center">[bloco1.id;htmlconv=no;block=tr]</td>
<td><a href="noticias/[bloco1.permalink;htmlconv=no]" target="_blank">[bloco1.titulo;htmlconv=no]</a></td>
<td align="center"><a href="usuarios/[bloco1.username;htmlconv=no]">[bloco1.username;htmlconv=no]</a></td>
<td align="center">[bloco1.data;htmlconv=no]</td>
<td align="center">[bloco1.acessos;htmlconv=no]</td>
<td align="center"><a href="javascript: ajax('editar_noticia&id=[bloco1.id;]');" title="Editar Notícia - ID [bloco1.id;]"><img src="imagens/editar.png" alt="Editar Notícia - ID [bloco1.id;]" width="16" height="16" border="0"></a> <a href="javascript:void(0)" title="Apagar Notícia - ID [bloco1.id;]" onclick="if(confirm('Deseja realmente enviar a notícia [bloco1.id;] para a lixeira?')){ajax('apagar_noticia&id=[bloco1.id;]');} return false;"><img src="imagens/apagar.png" alt="Apagar Notícia - ID [bloco1.id;]" width="16" height="16" border="0"></a> <input type="checkbox" value="" onclick="pinta('2')"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border: 1px solid #e0e0e0; border-bottom: 0px;" id="nenhuma_noticia">
<tr>
<td align="center">
<table cellspacing="2" cellpadding="2" border="0" style="margin: 10px;">
<tr>
<td>Um frase doida aqui</td>
</tr>
</table>
</td>
</tr>
</table>
[bloco1;block=begin;nodata]
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border: 1px solid #e0e0e0; border-bottom: 0px;">
<tr>
<td align="center">
<table cellspacing="2" cellpadding="2" border="0" style="margin: 10px;">
<tr>
<td align="center">Nenhuma Notícia no Sistema.<br><br>O que acha de postar uma bem legal?</td>
</tr>
</table>
</td>
</tr>
</table>[bloco1;block=end]
|
This template have wrong code (yeah, I know.. I'm here to find help for find correct use)
My php page:
$TBS = new clsTinyButStrong; // carregando a class de template
$TBS->LoadTemplate('templates/zegames/admin/ajax_gerenciar_noticias.php');
if (is_null($noticias_listar->buceta)) $noticias_listar->buceta = array();
$TBS->MergeBlock('bloco1','array',$noticias_listar->buceta);
$TBS->Show();
|
In this php page, the var $noticias_listar->buceta is a array.
The question area, what is wrong in my template page?
This page result in my browser like this:
If $noticias_listar->buceta is really null, the result are:
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border: 1px solid #e0e0e0; border-bottom: 0px;">
<tr>
<td align="center">
<table cellspacing="2" cellpadding="2" border="0" style="margin: 10px;">
<tr>
<td align="center">Nenhuma Notícia no Sistema.<br><br>O que acha de postar uma bem legal?</td>
</tr>
</table>
</td>
</tr>
</table>
|
This table is from the template file insite the 'tags': [bloco1;block=begin;nodata] [bloco1;block=end]
Now, if $noticias_listar->buceta the result will be anything like this:
<script>total_de_noticias = 1;</script><table width="100%[ERROR]" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border: 1px solid #e0e0e0; border-bottom: 0px;">
<tr>
<td>
<table cellspacing="2" cellpadding="2" border="0" style="margin: 15px;">
<tr>
<td><img src="imagens/folha.gif" alt="" width="14" height="16" border="0"></td>
<td><span id="total_news" style="font-weight: bold;">1</span> Notícias no sistema</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%[ERROR]" border="1" cellspacing="0" cellpadding="0" bordercolor="#E0E0E0" class="sortable" id="t1" style="border-collapse: collapse; border: 1px solid #e0e0e0;">
<tr>
<td width="41" align="center" valign="middle" class="sort">ID</td>
<td width="290" align="center" class="sort">Título</td>
<td width="120" align="center" class="sort">Autor</td>
<td width="140" align="center" nowrap class="sort">Data do Envio</td>
<td width="78" align="center" class="sort">Acessos</td>
<td width="78" align="center" class="sort">Ação</td>
</tr>
<tr id="tr_1">
<td align="center">1</td>
<td><a href="noticias/teste-666" target="_blank">teste 666</a></td>
<td align="center"><a href="usuarios/zegames" target="_blank">zegames</a></td>
<td align="center">19 de Janeiro de 2038 às 03:14</td>
<td align="center">14</td>
<td align="center"><a href="javascript: ajax('editar_noticia&id=1');" title="Editar Notícia - ID 1"><img src="imagens/editar.png" alt="Editar Notícia - ID 1" width="16" height="16" border="0"></a> <a href="javascript:void(0)" title="Apagar Notícia - ID 1" onclick="if(confirm('Deseja realmente enviar a notícia 1 para a lixeira?')){ajax('apagar_noticia&id=1');} return false;"><img src="imagens/apagar.png" alt="Apagar Notícia - ID 1" width="16" height="16" border="0"></a> <input type="checkbox" value="" onclick="pinta(\'2\')"></td>
</tr>
|
Note that template stop and dont show all code that I want, in other words, all above: [bloco1;block=begin;nodata]
Thanks advanced, sorry my poor english and this very noob question.
|
By: Sheepy
Date: 2006-04-26
Time: 07:40
|
Re: issue using MergeBlock
Hmm. Can you try to describe what's wrong, when it's wrong (e.g. no data, one item, many item), and provides sample input array (that comes out wrong)?
|
By: testebr
Date: 2006-04-26
Time: 13:36
|
Re: issue using MergeBlock
Sorry, it's hard for me explain the problem. Lets go...
If $noticias_listar->buceta is really null, the result are:
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border: 1px solid #e0e0e0; border-bottom: 0px;">
<tr>
<td align="center">
<table cellspacing="2" cellpadding="2" border="0" style="margin: 10px;">
<tr>
<td align="center">Nenhuma Notícia no Sistema.<br><br>O que acha de postar uma bem legal?</td>
</tr>
</table>
</td>
</tr>
</table>
|
YEs!! This is want I need and are correct for me. Repair the template file in my first post please and this result.
Now, if $noticias_listar->buceta NOT is null the result will be anything like this:
<script>total_de_noticias = 1;</script><table width="100%[ERROR]" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border: 1px solid #e0e0e0; border-bottom: 0px;">
<tr>
<td>
<table cellspacing="2" cellpadding="2" border="0" style="margin: 15px;">
<tr>
<td><img src="imagens/folha.gif" alt="" width="14" height="16" border="0"></td>
<td><span id="total_news" style="font-weight: bold;">1</span> Notícias no sistema</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%[ERROR]" border="1" cellspacing="0" cellpadding="0" bordercolor="#E0E0E0" class="sortable" id="t1" style="border-collapse: collapse; border: 1px solid #e0e0e0;">
<tr>
<td width="41" align="center" valign="middle" class="sort">ID</td>
<td width="290" align="center" class="sort">Título</td>
<td width="120" align="center" class="sort">Autor</td>
<td width="140" align="center" nowrap class="sort">Data do Envio</td>
<td width="78" align="center" class="sort">Acessos</td>
<td width="78" align="center" class="sort">Ação</td>
</tr>
<tr id="tr_1">
<td align="center">1</td>
<td><a href="noticias/teste-666" target="_blank">teste 666</a></td>
<td align="center"><a href="usuarios/zegames" target="_blank">zegames</a></td>
<td align="center">19 de Janeiro de 2038 às 03:14</td>
<td align="center">14</td>
<td align="center"><a href="javascript: ajax('editar_noticia&id=1');" title="Editar Notícia - ID 1"><img src="imagens/editar.png" alt="Editar Notícia - ID 1" width="16" height="16" border="0"></a> <a href="javascript:void(0)" title="Apagar Notícia - ID 1" onclick="if(confirm('Deseja realmente enviar a notícia 1 para a lixeira?')){ajax('apagar_noticia&id=1');} return false;"><img src="imagens/apagar.png" alt="Apagar Notícia - ID 1" width="16" height="16" border="0"></a> <input type="checkbox" value="" onclick="pinta(\'2\')"></td>
</tr>
|
You repair my themplate file and this result? The code stop in </tr> and don show fully like I want..
Well, I want that result are all code above the [bloco1;block=begin;nodata]
Imaginary template file:
----------------------
if array is populate:
{
. show all here
.
.
.
.
.
}
----------------------
if array is NULL:
[bloco1;block=begin;nodata]
{
. show all here
.
.
.
.
.
}
[bloco1;block=end]
----------------------
You understand me my problem and what result here?
|
By: Skrol29
Date: 2006-04-26
Time: 14:58
|
Re: issue using MergeBlock
Hello testebr,
I can see something wrong in your template. You have to keep in mind that all sections of a block should be sequential. All that is beetween sections of a bock is deleted by TBS when the block is merged. This can be surprising but there is other logical way to proceed.
Thus, when you have something like:
<table id="table1">
<tr> ... [bloco1;block=tr;...] ... </tr>
<tr> ... [bloco1;block=tr;...] ... </tr>
</table>
bla bla bla
<table id="table2">
<tr> ... [bloco1;block=table;nodata;...] ... </tr>
</table>
|
Then the part
will never be displayed because it is placed beetween section's bounds of block "bloco1".
You should better code:
<table id="table1">
<tr> ... [bloco1;block=tr;...] ... </tr>
<tr> ... [bloco1;block=tr;...] ... </tr>
<tr> ... [bloco1;block=tr;nodata;...] ... </tr>
</table>
|
|
By: testebr
Date: 2006-04-26
Time: 15:38
|
Re: issue using MergeBlock
ok.. I change my php code :(
if( is_null($noticias_listar->buceta) )
{
SHOW ONE TEMPLATE
}
else
{
SHOW OTHER TEMPLATE
}
|
Work, fine... but, my question is live yet.
|
By: testebr
Date: 2006-04-26
Time: 20:15
|
Re: issue using MergeBlock
hmm I need always place a id for the table?
|
By: Skrol29
Date: 2006-04-26
Time: 20:54
|
Re: issue using MergeBlock
> hmm I need always place a id for the table?
Not at all, that was only to distinguish them in my example.
|
By: testebr
Date: 2006-04-27
Time: 21:43
|
Re: issue using MergeBlock
your example:
<table id="table1">
<tr> ... [bloco1;block=tr;...] ... </tr>
<tr> ... [bloco1;block=tr;...] ... </tr>
<tr> ... [bloco1;block=tr;nodata;...] ... </tr>
</table>
|
Will show the same table if no date, but only the last TR line?
|
|
Posting in progress.
Please wait...
|