|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
HorsepowerSoftware Smarty Rookie
Joined: 22 Dec 2006 Posts: 10
|
Posted: Fri Dec 22, 2006 3:08 am Post subject: {HTML_TABLE} Array Trouble |
|
|
Hello, I have been working with a project here that does require smarty I am trying to make a table that shows the records that are located on a MYSQL Database. What is happening is when I make a table using {html_table} it works to a point. When I run the page the Debug pop up shows the records but displays "Array" instead of the records. Also when I did get it to work on time it just kept going across instead of down and I tried the inner with the same results.
Here is the php code I am working with at this time.
Code: |
<?php
mysql_select_db($database_Secure, $Secure);
$query_Rs_User_Projects = "SELECT * FROM secure_Projects";
$Rs_User_Projects = mysql_query($query_Rs_User_Projects, $Secure) or die(mysql_error());
$row_Rs_User_Projects = mysql_fetch_assoc($Rs_User_Projects);
$totalRows_Rs_User_Projects = mysql_num_rows($Rs_User_Projects);
?>
<?php
require './libs/Smarty.class.php';
$smarty = new Smarty;
$smarty->debugging = true;
do{
$Project_ID[] = $row_Rs_User_Projects['Project_ID'];
$Project_Title[] = $row_Rs_User_Projects['Project_Title'];
}
while ($row_Rs_User_Projects = mysql_fetch_assoc($Rs_User_Projects));
$smarty->assign('User_Projects', array($Project_ID, $Project_Title) );
$smarty->assign( 'tr', array('bgcolor="#eeeeee"','bgcolor="#dddddd"') );
$smarty->display('html.tpl');
?>
<?php
mysql_free_result($Rs_User_Projects);
?>
|
Here is the TPL Code
Code: |
{html_table loop=$User_Projects cols="Project_ID, Project_Title" inner=rows table_attr='border="0"'} |
As far as I see here it should work? I have completed this using {foreach} in a table that I created and got the result I like but I would like to use Smarty to do the table if I can.
I was trying Example #3 out of the Smarty Manual as you see in the assign with the HTML color codes.. I just left it in so I can try other things.
Thanks |
|
Back to top |
|
Pap Smarty Regular
Joined: 21 Jun 2006 Posts: 69 Location: Denver, CO
|
Posted: Fri Dec 22, 2006 5:59 am Post subject: |
|
|
I don't think {html_table} supports multi-dimensional arrays. _________________ Don't be stupid, be a Smarty™.
Come and join the P-H-Party. |
|
Back to top |
|
HorsepowerSoftware Smarty Rookie
Joined: 22 Dec 2006 Posts: 10
|
Posted: Fri Dec 22, 2006 8:04 am Post subject: |
|
|
Hmmm I am beginning to think that also ... but I thought it would not hurt to ask. I did get it to work but I had to build the table and put the arrays in the table via smarty tags and then used {foreach} on every one. SO if not I can always do it that way. Thanks for the reply |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|