Solved

How to parse smarty template to the variable?

Posted on 2011-02-22
5
223 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Crazy text will not be removed no matter what I try! 13 29
hosting images 4 27
php string detection problem 7 33
000webhost.com default error log 1 26
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

785 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