|
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 |
Schebi Smarty Rookie
Joined: 14 Feb 2005 Posts: 5 Location: Berlin
|
Posted: Wed Feb 16, 2005 7:18 pm Post subject: Ich bin verzweiffel ! |
|
|
Ich habe mich für Smarty entschieden um alles einfacher zu haben ! Und nun macht er leider nichts das was ich will ! Die ganzen Forumeinträge die ich gewälzt habe, haben mir auch nicht geholfen ! Also dann hoffe ich auf eure Hilfe !
Also so ist der Aufbau der Seite (Dateistruktur)
template\
footer.tpl
header.tpl
index.tpl
menu.tpl
templates\news
index.tpl
news.tpl
templates\forum
index.tpl
forum.tpl
...
index.php
news.php
...
index.php sieht so aus :
Code: | <?php
global $inhalt;
global $erg;
global $datei;
require './libs/Smarty.class.php';
include 'dbconnect.php';
if ($inhalt == "")
{
$inhalt = "news";
}
$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->caching = false;
$smarty->debugging = false;
$smarty->assign('inhalt', $inhalt);
if(file_exists($inhalt.'.php'))
{
$datei = $inhalt.'.php';
include $datei;
}
$smarty->assign('Newserg', $erg);
$smarty->template_dir = './templates/';
$smarty->compile_dir = './templates_c/';
$smarty->left_delimiter = '<!--{';
$smarty->right_delimiter = '}-->';
$smarty->display('index.tpl');
?> |
index.tpl dazu :
Code: |
{config_load file=test.conf section="setup"}
{include file="header.tpl" title=Schebeko.de}
{include file="$inhalt/index.tpl"}
{include file="footer.tpl"}
|
index.tpl im News Verzeichnis
Code: |
<div height='100%'>
<div class='inhalt' style='position:relative; left:0%, width: 80%; float: left;'>
{include file='./news/news.tpl'}
</div>
<div class='inhalt' style=" position:relative; left:38%; width:20%; top: 10px;">
<script language="Javascript" src="http://www.wetter.com/v2/woys2/woys2.js.php?29397,35aca905b0470369997b5f9907a866f2"></script>
</div>
<div class='inhalt' style="position:relative; left:38%; width:20%; top: 10px;">
<table border="0" cellpadding="0" cellspacing="0" width="138">
<tr>
<td>
.....
|
news.php dazu :
Code: |
<?php
$query = "SELECT * FROM news WHERE aktiv = 1 ORDER BY ID DESC ";
$erg = mysql_query($query, $dbh);
?>
|
das entsprechende Templateunterverzeichnis mit eingebunden ! hier jetzt eben NEWS\index.tpl !
Das funktioniert jetzt super !
Das Problem ist das ich in diesem Template, dann nochmal ein Template einbinden will, welches das Anzeigen der News übernimmt !
Es kommt aber immer nur der Aufruf selbst ! Also in Browser steht dann :
{include file='./news/news.tpl'}
woran liegt das ? Bei Fragen einfach posten !
Thx für eure Tips ! _________________ ______________________________________________________________
Schebi
______________________________________________________________
. : |' Kill all Spamers '| : . |
|
Back to top |
|
tleilax Smarty Rookie
Joined: 13 Feb 2005 Posts: 13 Location: Oldenburg, Germany
|
Posted: Thu Feb 17, 2005 7:52 am Post subject: |
|
|
Moinsen,
ich vermute, das liegt daran, dass Du die Delimiter umgestellt hast. Code: | $smarty->left_delimiter = '<!--{';
$smarty->right_delimiter = '}-->'; | Demzufolge müsstest Du auch folgendes schreiben: Code: | <!--{include file='./news/news.tpl'}--> |
_________________ .best wishes
:.tlx |
|
Back to top |
|
Schebi Smarty Rookie
Joined: 14 Feb 2005 Posts: 5 Location: Berlin
|
Posted: Thu Feb 17, 2005 4:21 pm Post subject: *GRINS* |
|
|
Holla !
THX a lot ! It Works und ich habe 10 Stunden gesucht ! GRRR
Naja das mit den Delimitern habe ich gemacht damit ich in der index.tpl von den News ein JavaScript einbinden kann das gab sonst Probleme !
Vielleicht ist das ja auch anders möglich und ich weis das nur nicht !
Eventuell hast du dazu ja auch ein Hinweis oder eine bessere Lösung als die Delimiter zu wechseln !
Thx a Lot und
MfG Schebi _________________ ______________________________________________________________
Schebi
______________________________________________________________
. : |' Kill all Spamers '| : . |
|
Back to top |
|
tleilax Smarty Rookie
Joined: 13 Feb 2005 Posts: 13 Location: Oldenburg, Germany
|
Posted: Thu Feb 17, 2005 5:00 pm Post subject: |
|
|
Guck Dir mal {literal} an... _________________ .best wishes
:.tlx |
|
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
|