mix
hi leute (*vorallem fmj anblick* ;) )
em jo ich bin ja 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:
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
//.....
$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');
?>
left.tpl
{*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
//.....
$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");
?>
navigation.mod.tpl
{* 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
em jo ich bin ja 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:
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
//.....
$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');
?>
left.tpl
{*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
//.....
$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");
?>
navigation.mod.tpl
{* 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