Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Anfängerfrage...

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
blub19
Smarty n00b


Joined: 18 Aug 2004
Posts: 2

PostPosted: Wed Aug 18, 2004 10:21 am    Post subject: Anfängerfrage... Reply with quote

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
View user's profile Send private message Visit poster's website
Benjamin `aphex` Muskalla
Smarty Rookie


Joined: 26 Jul 2004
Posts: 5

PostPosted: Wed Aug 18, 2004 10:49 am    Post subject: Reply with quote

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
View user's profile Send private message
blub19
Smarty n00b


Joined: 18 Aug 2004
Posts: 2

PostPosted: Wed Aug 18, 2004 10:54 am    Post subject: Reply with quote

ah, ok. das ist logisch.

alles klar. danke.. funktioniert
Back to top
View user's profile Send private message Visit poster's website
coach
Smarty Regular


Joined: 03 Jun 2004
Posts: 65

PostPosted: Wed Aug 18, 2004 5:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP