Dashboard and multiple queries

A place for users and developers of the Xataface to discuss and receive support.

Dashboard and multiple queries

Postby jamesb » Fri Jan 21, 2011 2:58 pm

I'm building a dashboard for my app and want to display several select elements from different tabels.

How can I pass multiple results to one page?

Thanks in advance.
jamesb
 
Posts: 2
Joined: Fri Jan 21, 2011 2:51 pm

Re: Dashboard and multiple queries

Postby shannah » Fri Jan 21, 2011 3:05 pm

The df_display() method takes 2 parameters. The first is an associative array of variables to be sent to the template for use.

e.g.
Code: Select all
$context = array(
    'foo'=> 'The Foo Value',
    'bar' => array('firstname'=>'Steve', 'lastname'=>'Hannah')
);
df_display($context, 'my_template.html');


Then in my template :
Code: Select all
<p>The Foo value is {$foo}.</p>
<p>Hello {$bar.firstname} {$bar.lastname}</p>



This would render like:
Code: Select all
<p>The Foo value is The Foo Value</p>
<p>Hello Steve Hannah</p>



Extrapolating from this, you can see that if you have multiple database results stored in arrays, you could just pass them both to the template context in their own variables.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Dashboard and multiple queries

Postby jamesb » Sat Jan 22, 2011 3:01 pm

Thanks! I knew it must be something simple like that. That is just what I needed. :)

-james
jamesb
 
Posts: 2
Joined: Fri Jan 21, 2011 2:51 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 23 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved