|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
chichongo Smarty n00b
Joined: 30 Apr 2014 Posts: 1
|
Posted: Wed Apr 30, 2014 11:14 am Post subject: How can I assign variable to new variable?? Help! |
|
|
Hello
I'm new to smarty, wanted to know if I can fetch the value of a variable that is displayed on a .tpl file, from a plugin, then use this value and return it to the .tpl to update the plugin.
this is what I'm trying to achieve, I'm getting data from an XML file which works, but I need the variable from .tpl file for the correct sorting to be done.
please note the below code is not a correct plugin for smarty.
Code: |
<?php
function smarty_function_picloader($params, &$smarty, $template)
{
$all_urls = array('http://data.domain.com/xml/media/This needs to return productcode value from a variable in template/');
foreach ($all_urls as $stockList) {
$stockList = simplexml_load_file($stockList, "SimpleXMLElement", LIBXML_NOCDATA);
foreach ($stockList->products->product as $prod) {
$screenshot = $prod->trailers->trailer;
print "<div class=\"thumbs\" style=\"width: 620px; height: auto; display: block; padding: 10px;\">";
foreach ($screenshot as $shots){
$pics = $shots->still;
print "<a class=\"fancybox\" data-fancybox-group=\"gallery\" href=\"$pics\" title=\"This needs to return the title value from a variable in template\">
<img src=\"$pics\" width=\"100px\" height=\"auto\" style=\"border: solid 1px #f1f1f2; float: left; padding: 10px;\" alt\"\">
</a>";
}
print "</div>";
print "<div style='clear:both;'></div>";
}
}
}
?>
|
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|