Solved

How to parse smarty template to the variable?

Posted on 2011-02-22
5
233 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:Dushan De Silva
ID: 34956807
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
ID: 34969744
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:
Dushan De Silva earned 50 total points
ID: 34974823
0
 
LVL 16

Expert Comment

by:CWS (haripriya)
ID: 39686710
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

830 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