custom smarty function to 'get' and 'replace'
I am fairly new to Smarty and I am facing a little problem in writing a
function for a plugin where I'd like to fetch a value from the smarty tag
inserted inside any page and then I want that value to be added inside the
code in the plugin file. To be precise, for example, this is going to be
my Smarty tag which i'll insert inside a page:
{gallery link="../images/ball.png"}
Now what I want is that, I want the image link, which I've added inside
the link="" tags, to be inserted inside the href="" and the src="" tags in
the following code which is going to be inside the plugin file:
<a class="fancybox" rel="gallery1" href="IMAGE LINK FROM SMARTY TAG
ABOVE"><img src="IMAGE LINK FROM SMARTY TAG ABOVE" alt="" width="200"
height="200" /></a>
So basically, if I use the following tag:
{gallery link="../images/car.png"}
I want this to be echo'd out on the page:
<a class="fancybox" rel="gallery1" href="../images/car.png"><img
src="../images/car.png" alt="" width="200" height="200" /></a>
After a lot of research, I found and read this tutorial at last and I've
learned how to create a Smarty Plugin but I am not sure how to write the
correct function in order to achieve the functionality which I want.
No comments:
Post a Comment