|
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 |
Outer_Regions Smarty n00b
Joined: 13 Jul 2003 Posts: 2 Location: Texas, USA
|
Posted: Sun Jul 13, 2003 8:14 pm Post subject: Isnt working for me... |
|
|
I just got smarty and i have started on som e scripts for a new app.
But, when i tried smarty, it didnt seem to like me
I included the files onto the pg, made a new smarty, assigned the data from the database into the template, and it didnt work, i tried several diff. ways....
index.tpl:
Code: |
<html>
<head>
<title> HyperBB </title>
</head>
<body bgcolor="#FFFFFF">
{section name=main loop=$main_forums}
<h3> {$main_forums[main].main_name} </h3>
{/section}
</body>
</html>
|
index.php
Code: |
<?php
require("config.php");
require_once("Smarty.class.php");
/*
make a new class
/*
$PAGE = new Smarty;
$sql = mysql_query("SELECT * FROM hyperbb_main");
WHILE ( $row = mysql_fetch_array($sql)) {
$PAGE->assign('main', $row);
}
$PAGE->display('index.tpl');
?>
|
any help would be nice, ty _________________ PHP intermediate
Smarty Newbie |
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Sun Jul 13, 2003 9:11 pm Post subject: |
|
|
Try
index.tpl: Code: | <html>
<head>
<title>HyberBB</title>
</head>
<body bgcolor="#FFFFFF">
{foreach from=$main item=current}
<h3>{$current.main_name}</h3>
{/foreach} |
index.php[php:1:361f99a983]<?php
require("config.php");
require_once("Smarty.class.php");
$PAGE = new Smarty;
$sql = mysql_query("SELECT * FROM hyperbb_main");
while($row = mysql_fetch_assoc($sql)) {
$main[] = $row;
}
$PAGE->assign('main', $main);
$PAGE->display('index.tpl');
?>[/php:1:361f99a983] _________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
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
|