Booher Posted April 17, 2010 Share Posted April 17, 2010 It is looping the rows correctly, but not adding the variables.:S admin/plugins.php: <?php define("requireLogin",1); define("requireAdmin",1); require("../global.php"); switch($_GET['act']){ default: $core->template->display("header.tpl"); $query = array( "SELECT" => "*", "FROM" => "plugins", ); $result = $core->db->query_build($query) or error(__FILE__, __LINE__); $plugins = array(); while($p=$core->db->fetch_assoc($result)){ $plugins[] = $p; } $core->template->assign("plugins",$plugins); $core->template->display("adminplugin_home.tpl"); $core->template->display("footer.tpl"); break; } ?> styles/default/templates/adminplugin_home.tpl <table width="90%" border="1" align="center"> <tr> <th width="50%">Plugin Name</th> <th>Actions</th> </tr> <tr> <td colspan="100%">Installed plugins</td> </tr> {foreach from=$plugins item=plugin} <tr> <td valign="top"> {$plugin->title}<br/> <b>Made By:</b>{$plugin->author}<hr/> {$plugin->description} </td> <td valign="top"> <a href="{$URL}admin/plugins.php?act=uninstall&id={$plugin->id}">Uninstall</a> </td> </tr> {/foreach} </table> print_r on $plugins returns: Array ( [0] => Array ( [id] => test [title] => Test [version] => 1.0.0 [description] => Test Plugin [author] => booher [uninstall] => [uninstall_note] => [disabled] => 0 ) ) Here is the output: Link to comment https://forums.phpfreaks.com/topic/198880-smarty-array-loop-problem/ Share on other sites More sharing options...
TeddyKiller Posted April 18, 2010 Share Posted April 18, 2010 I dont recommend displaying big images on a thread. It just messes up. I don't know whats wrong or anything.. but was only just telling you What's tidier, is easier for people to read. Keep that in mind Link to comment https://forums.phpfreaks.com/topic/198880-smarty-array-loop-problem/#findComment-1043982 Share on other sites More sharing options...
dotMoe Posted April 19, 2010 Share Posted April 19, 2010 Hey, Your issue is simple: Instead of $plugin->author. its $plugin.author $pluging.description in the tpl file. Link to comment https://forums.phpfreaks.com/topic/198880-smarty-array-loop-problem/#findComment-1044438 Share on other sites More sharing options...
Booher Posted April 19, 2010 Author Share Posted April 19, 2010 omg. thank you soo much. i coulda swore you was suppost to use -> :S lol. Link to comment https://forums.phpfreaks.com/topic/198880-smarty-array-loop-problem/#findComment-1044771 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.