21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1207 Views |
-
concatenate array

6 March 2009 at 6:21am
Hi!
I have this problem. I print result of my query as cicle. I nedd to concatenate to $doSet array an other array $pag that I need to print only one.
If I insert $pag in my $record array every cicle of function I print $pag value. I want see it only one.function Query()
$doSet = new DataObjectSet();
foreach($rec as $key)
{
$record = array(
'Id' => $key['id'],
'Nome' => $key['mm_tourist_name'],);
$doSet->push(new ArrayData($record));}
return $doSet;<% if Query %>
<ul id="liste">
<% control Query %>
<li>
<div class="..">$Nome</div>
<div class="..">$Id</div>
</li>
$pag
<% end_control %>
</ul>
<% end_if %> -
Re: concatenate array

6 March 2009 at 7:57pm
Hello! I'm not sure if I understood well your problem. You want to print $pag which is a array only once in the template, so why are you placing it inside the control?. Can't you call it out of the control?.
I'm quite new to SS and PHP. But I'll try to help if I can. -
Re: concatenate array

6 March 2009 at 8:36pm
Hi Jardiamj!
I try to put my $pag out of cicle ina this way but I can see $pag value..any idea?<% if Query %>
<ul id="liste">
<% control Query %><li>
<div class="..">$Nome</div>
<div class="..">$Id</div>
</li><% end_control %>
</ul>
$pag
<% end_if %> -
Re: concatenate array

6 March 2009 at 9:06pm
an other solution was this but don't work..
$doSet->push(new ArrayData(array($record, 'pagination' => $pag));
-
Re: concatenate array

7 March 2009 at 6:23am
Hello bebabeba!
Where is you variable $pag? I can't see it in your first post.
is it related with your query results?, I think yes. Because you could create another function to get this data and then call it in your template.
Or as I can see you were trying to push it inside your array. And then you could call it in you template like $Query.pagination or use it inside a control block if it is an array like <% control Query.pagination %> <% end_control %>.If you can send me the whole code I will take a look at it.
Bye.
| 1207 Views | ||
|
Page:
1
|
Go to Top |

