|
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 |
mix Smarty n00b
Joined: 21 Jun 2004 Posts: 4
|
Posted: Tue Jun 22, 2004 10:37 am Post subject: Fehler beim Includieren... |
|
|
hi leute
em jo ich bin an meinem eigenen cms und das will ich mit der smarty template engine realisieren.
und da hab ich jetzt die navigation erfolgreich gemacht und will nun die navigation in den block der links ist, einbinden. nun geht das aber nicht
und es gibt den fehler aus:
http://mix.mittelerde.ch/beta/left.php wrote: |
Fatal error: Smarty error: [in navigation.mod.php line 27]: syntax error: unrecognized tag: $nav[] = array( 'id' => $row['id'], 'name' => $row['name'], 'url' => $row['url'], 'position' => $row['position'], 'visible' => $row['visible']); (Smarty_Compiler.class.php, line 403) in /home/mix88/mix.mittelerde.ch/htdocs/beta/smarty/Smarty.class.php on line 1102 |
nun... jetzt die codes in dem die fehler sein sollten...
left.php
[php:1:51c3bff6c8]
//.....
$table = $db_praefix."_modules";
// Aus der Tabelle werden die module ausgewählt, welche zu sehen sein sollen und auf der linken seite sein sollen. Weiter wird nach der position geordnet.
$sql = "SELECT * FROM ".$table." WHERE visible=1 AND align=1 ORDER BY position ASC";
$res = mysql_query($sql) or die(mcms_error($table,$db_praefix));
// Selbsterklärend...
while($row = mysql_fetch_array($res))
{
$id = $row["id"];
$name = $row["name"];
$file = $row["file"];
$title = $row["title"];
$visible = $row["visible"];
$align = $row["align"];
$position = $row["position"];
// Falls $file existiert...
if(file_exists($file))
{
// ....soll smarty das file assignen.
$smarty->assign("left_output",$file);
}
else
{
// Andernfalls einen Fehler ausgeben
echo 'Fehler';
}
}
// Das ganze ausparsen in left.tpl
$smarty->display('left.tpl');
?>
[/php:1:51c3bff6c8]
left.tpl
Code: |
{*Smarty*}
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" align="left">
{include file=$left_output}
</table>
</td>
|
navigation.mod.php
[php:1:51c3bff6c8]
//.....
$table = $db_praefix."_navigation";
// Navigation aus Tabelle auslesen
$sql = "SELECT * FROM ".$table." WHERE visible=1 ORDER BY position DESC";
$res = mysql_query($sql) or die(mcms_error($table,$db_praefix));
while($row = mysql_fetch_array($res))
{
$nav[] = array(
'id' => $row['id'],
'name' => $row['name'],
'url' => $row['url'],
'position' => $row['position'],
'visible' => $row['visible']);
}
// Assignen
$smarty->assign("nav",$nav);
$table = $db_praefix."_modules";
// Ueberschrift der Navigation auslesen
$sql = "SELECT * FROM ".$table." WHERE file='navigation_mod.php'";
$res = mysql_query($sql) or die(mcms_error($table,$db_praefix));
while($row = mysql_fetch_array($res))
{
$title = $row["title"];
// Assignen
$smarty->assign("title",$title);
}
$smarty->display("navigation.mod.tpl");
?>
[/php:1:51c3bff6c8]
navigation.mod.tpl
Code: |
{* Smarty *}
<tr>
<td>
<table class="side" border="0" cellpadding="0" cellspacing="0" align="left">
<tr>
<td class="side_title">{$title}</td>
</tr>
<tr>
<td class="side">{foreach from=$nav item=n}{if $n.url == ""}<b>{$n.name}</b>{else}&&<a href="{$n.url}">{$n.name}</a>{/if}<br /> {/foreach}</td>
</tr>
</table>
</td>
</tr>
|
so .. ich hoffe man kommt einigermassen draus was ich machen möchte
thx für die antworten...
gruss
mix |
|
Back to top |
|
mix Smarty n00b
Joined: 21 Jun 2004 Posts: 4
|
Posted: Wed Jun 23, 2004 5:48 pm Post subject: |
|
|
hm..habs selber lösen können :> |
|
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
|