What's the difference between those ones?

38 views
Skip to first unread message

Gosforth

unread,
Mar 20, 2019, 2:52:39 PM3/20/19
to Fat-Free Framework
I see we can render template in one of following ways:

echo \Template::instance()->render('templates/welcome.htm');
echo \View::instance()->render('templates/welcome.htm');

Looks like results are same. What's the difference?

ved

unread,
Mar 20, 2019, 3:14:53 PM3/20/19
to Fat-Free Framework
Hi, that is all pretty decently explained in the docs. Anyway, the differences are:


echo \Template::instance()->render('templates/welcome.htm');

With the Template class you can use the xml based template directives like <check>, <repeat>, etc. Also allows you to use {{ @myvariable }}.
 
echo \View::instance()->render('templates/welcome.htm');

With the View class, your views are basically php files. You can't use F3's templating tags and basically have to place everything inside <?php ?> blocks. Read more here.

Cheers

Gosforth

unread,
Mar 23, 2019, 1:45:57 PM3/23/19
to Fat-Free Framework
Thanks
Reply all
Reply to author
Forward
0 new messages