Solved

How to parse smarty template to the variable?

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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
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…
The viewer will learn how to dynamically set the form action using jQuery.

624 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