Solved

How to parse smarty template to the variable?

Posted on 2011-02-22
5
215 Views
Last Modified: 2013-11-30
$template = new Smarty();
$template->assign(array(
...
));

$var =

How to put parsed template into $var?
0
Comment
Question by:kolczyk
  • 2
5 Comments
 
LVL 17

Expert Comment

by:Dushan911
Comment Utility
http://www.smarty.net/docs/en/api.create.template.tpl
http://www.smarty.net/docs/en/template.resources.tpl
http://www.smarty.net/docs/en/advanced.features.template.inheritance.tpl
http://www.smarty.net/docs/en/variable.template.dir.tpl
http://www.smarty.net/docs/en/api.get.template.vars.tpl
<?php
include('Smarty.class.php');
$smarty = new Smarty;

// create template object with its private variable scope
$tpl = $smarty->createTemplate('index.tpl');

// assign variable to template scope
$tpl->assign('foo','bar');

// display the template
$tpl->display();
?>

Open in new window

0
 

Author Comment

by:kolczyk
Comment Utility
Thank you Dushan911 but i don't want to render (display) template.

Question is: how to insert parsed template to $var, do something with this variable and then display it (echo $var).
0
 
LVL 17

Accepted Solution

by:
Dushan911 earned 50 total points
Comment Utility
0
 
LVL 16

Expert Comment

by:CWS (haripriya)
Comment Utility
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now