|
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 |
blub19 Smarty n00b
Joined: 18 Aug 2004 Posts: 2
|
Posted: Wed Aug 18, 2004 10:21 am Post subject: Anfängerfrage... |
|
|
Hi,
seit gestern bastel ich mit Smarty rum und bin nun bei einer standardsituation... ich hab ne header.tpl , left.tpl, center.tpl und ne footer.tpl.
Diese rufe ich bisher alle über die index.php auf (also mit $smarty->display('header.tpl')...) Soweit ist alles klar.
Jetzt merke ich aber, dass meine index.php immer größer und unübersichtlicher wird. Deshalb habe ich mir überlegt, dass ich zur jedem template ne eigene .php schreibe (also z.B. left.php, die dann die php Anweisungen für die left.tpl enthält).
Dies ist soweit eigentlich auch kein Problem. Wenn ich die left.php aufrufe, erscheit auch die Linke Seite meiner Page.
Wenn ich jetzt die index.php aufrufe, erscheit der linke Teil nicht mehr, was ja auch klar ist, weil ja die Anweisungen für den linken Teil in der left.php und nicht mehr in der index.php stehen.
Ich möchte aber, dass mir wieder alle Seitenteile angezeigt werden, wenn ich die index.php aufrufe. wie schaffe ich das? Muss ich doch den ganzen Code in die index.php schreiben??? |
|
Back to top |
|
Benjamin `aphex` Muskalla Smarty Rookie
Joined: 26 Jul 2004 Posts: 5
|
Posted: Wed Aug 18, 2004 10:49 am Post subject: |
|
|
Hi blub !
Ich würde es so machen:
index.php
-> ruft left.php, center.php und footer.php auf
-> diese geben alle benötigten Variablen an Smarty weiter
-> display("index.tpl");
und in die index.tpl tust du die anderen templates via {include file="left.tpl"} einbetten... |
|
Back to top |
|
blub19 Smarty n00b
Joined: 18 Aug 2004 Posts: 2
|
Posted: Wed Aug 18, 2004 10:54 am Post subject: |
|
|
ah, ok. das ist logisch.
alles klar. danke.. funktioniert |
|
Back to top |
|
coach Smarty Regular
Joined: 03 Jun 2004 Posts: 65
|
Posted: Wed Aug 18, 2004 5:24 pm Post subject: |
|
|
Hi, also ich mache das mit den Header, Footern ... immer per Include:
master.tpl:
Code: |
{include file="file:elements/header.tpl"}
<!-- Content //-->
{include file=$content}
{include file="file:elements/footer.tpl"}
|
und von außen übergebe ich in der Variable Content das Content-Template. |
|
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
|