Using a string for QPanel Template

thread: 4 messages  |  last: a year ago  |  started: thursday, december 15, 2011, 2:28 pm pst


#1  |  banetbi (Gloucester, VA) Financial Contributor
Thursday, December 15, 2011, 2:28 PM PST

Hi I was wondering if there is a simple way to use a string as the template of a QPanel instead of specifying a file.  I have a QPanel that needs to render several different possible templates, these are somewhat dynamic and change based on the user logged in etc.

#2  |  Gaspar Attila (Odorheiu Secuiesc, RO) Romania
Thursday, December 15, 2011, 4:06 PM PST

Hello banetbi!

Use that string as the panel Text property value and set HtmlEntities to false.

Note: The string rendered “as is” and not evaluated.

Regards,
 Attila

#3  |  Leonardo (Minas Gerais) Brazil
Sunday, December 18, 2011, 5:22 PM PST

I suggest doing a lot. Tpl.php for each case

example

if (x)
$ this-> pnl-> Template = “another1.tpl.php”;
else if (y)
$ this-> pnl-> Template = “another2.tpl.php”;
else
$ this-> pnl-> Template = “another3.tpl.php”;

#4  |  banetbi (Gloucester, VA) Financial Contributor
Tuesday, December 20, 2011, 5:56 AM PST

Thanks for the info guys, I ended up using the dynamic template and it works great.

Thanks



Copyright © 2005 - 2013, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.