Forum

Banshee: how to create my own xslt tag?

Ian
9 January 2015, 18:15
Hi Hugo,

I've tried to create a tag called $banner_logo inside controllers/banshee/page.php, to assign it the image path which will be used inside the xslt view by passing it to <img src="{banner_logo}"/>.

but unfortunately {banner_logo} gets always empty string.

so what's wrong here? and how can I solve the problem?

Thanks.

Hiawatha version: 9.7
Operating System: ArchLinux
Hugo Leisink
9 January 2015, 18:28
Make sure you master XSLT well enough and use the available modules as an example. It's not that I don't want to tell you the answer, it's that I don't know what you are doing so I don't know where it goes wrong.
Ian
9 January 2015, 19:03
Well, that's all my code:

-the code of views/banshee/page.xslt which is used for HTML output: http://pastebin.com/D6Rj3Ejp
-my modifications to controllers/page.php: http://pastebin.com/a3VMC1Zd
-my modifications to libraries/output.php: http://pastebin.com/xru7BX6H
Hugo Leisink
9 January 2015, 19:33
Try adding "title/@" to the variables in page.xslt:
       <DIV class="banner">
<A href="{title/@domain}">
<DIV><IMG class="banner-logo" src="{title/@banner_logo}"/></DIV>
</A>
<p><xsl:value-of select="title/@banner_logo"/></p>
Ian
9 January 2015, 19:57
It didn't work for me. and I still have empty value for banner_logo.
Ian
9 January 2015, 20:30
what is the reason for using "title/@" here, since I need only the banner_logo value?
Hugo Leisink
9 January 2015, 20:32
What you should do is learn more about XSLT first.
Ian
9 January 2015, 20:41
well, adding "title/@" didn't solve my problem? what to do now?
Ian
9 January 2015, 22:08
"title/@" is not needed here.
and finally I found the solution, by adding $this->add_tag("banner_logo", $this->banner_logo); inside close_tag() of the libraries/output.php which I missed up: the only mistake I did here.

all works fine for me now.
This topic has been closed.