Jump to content

Smarty array loop problem.


Booher

Recommended Posts

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:

aourtk.jpg

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.