Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to parse smarty template to the variable?

Posted on 2011-02-22
5
Medium Priority
?
250 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 200 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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 create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

688 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