Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Assigning array to smarty variables (http://www.mysidiaadoptables.com/forum/showthread.php?t=4510)

IntoRain 05-30-2014 11:04 PM

Assigning array to smarty variables
 
Hi. I've been changing the theme around now that Kyttias made it possible to use bootstrap, and I wanted to know where I could assign an array to the smarty variables. I found a way to add native variables through the frame class, but it seems hashmaps don't take arrays :(

Hall of Famer 06-01-2014 12:14 PM

Well standard smarty array assignment works like this:

PHP Code:

$myArray = array('no' => 10'label' => 'Peanuts'); $smarty->assign('foo',$myArray); 

In this script I made a class called Template inheriting the parent Smarty class, and the assign method still works. The template object is stored inside the mysidia object from registry, you can access it like this:

PHP Code:

$mysidia Registry::get("mysidia");
$mysidia->template->assign('arrayname'$array); 


IntoRain 06-01-2014 12:31 PM

OOoh! Thank you! I've been messing around with the class_frame render() function and arrays didn't work obviously xD I've been doing it wrong all along xD Thank you! That solves it! ^^

Hall of Famer 06-03-2014 02:06 PM

Glad I can be of any help. ^^


All times are GMT -5. The time now is 02:55 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.