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

How to create single main template?

 
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 -> General
View previous topic :: View next topic  
Author Message
danny36
Smarty Rookie


Joined: 14 Jul 2004
Posts: 27
Location: Italy - Arezzo (Tuscany)

PostPosted: Thu Jun 01, 2017 7:36 am    Post subject: How to create single main template? Reply with quote

Hello to all,

I would like to a achieve to have one single template with this:

<html>
<head></head>
<body>
{load content here}
</body>
</html>

when I click on a link to another php file I want to load the resulting generated template inside a tag {load content here} of the main template.

It's possible to do this?

thank you.
Back to top
View user's profile Send private message Visit poster's website
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu Jun 01, 2017 11:27 am    Post subject: Reply with quote

http://www.smarty.net/docs/en/language.function.extends.tpl
Back to top
View user's profile Send private message
danny36
Smarty Rookie


Joined: 14 Jul 2004
Posts: 27
Location: Italy - Arezzo (Tuscany)

PostPosted: Thu Jun 01, 2017 12:29 pm    Post subject: Reply with quote

ok thank you but how to?

I have:

[list=]page1.php + page1.tpl
page2.php + page2.tpl
page3.php + page3.tpl[/list]

and in index.php I have:

$smarty->assign("content", $page);

How can assign the result of page1.php in a $page??
Back to top
View user's profile Send private message Visit poster's website
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu Jun 01, 2017 1:21 pm    Post subject: Reply with quote

Ok, I understand what you are asking.
I suggest you start reading Smarty documentation from the beginning and try all the provided examples yourself.
What you want is the very basic functionality of Smarty (or any other templating engine), explained in the very first few paragraphs of its documentation.
Back to top
View user's profile Send private message
danny36
Smarty Rookie


Joined: 14 Jul 2004
Posts: 27
Location: Italy - Arezzo (Tuscany)

PostPosted: Tue Jun 13, 2017 7:56 am    Post subject: Reply with quote

I'm sorry but i can't find any specific example in the documentation of smarty.
Back to top
View user's profile Send private message Visit poster's website
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Jun 13, 2017 1:26 pm    Post subject: Reply with quote

The entire documentation is an example of what you're asking for.
I fail to see how you could not find it.
Back to top
View user's profile Send private message
danny36
Smarty Rookie


Joined: 14 Jul 2004
Posts: 27
Location: Italy - Arezzo (Tuscany)

PostPosted: Tue Jun 13, 2017 2:11 pm    Post subject: Reply with quote

If I ask for help maybe I'm not reach the solution.

Somebody else can help me?
Back to top
View user's profile Send private message Visit poster's website
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Jun 13, 2017 5:57 pm    Post subject: Reply with quote

Read http://www.smarty.net/docs/en/what.is.smarty.tpl
Then http://www.smarty.net/docs/en/installing.smarty.basic.tpl
Then the rest of the documentation.
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 -> General 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