Can I replace plugin titles with images?

Creating and modifying plugins.
Post Reply
dsuccess
Posts: 1
Joined: Thu Jul 21, 2005 10:41 pm

Can I replace plugin titles with images?

Post by dsuccess »

For each plugin there's a title that appears above the plugin content on the main page: Quicksearch, Shoutbox, Archives, Syndicate This Blog, etc. I'd like to change this text to an image file, something like imgs/<pluginname>.jpg but I can't find where the plugin title is displayed. Is there a simple way to go about doing this?

Edit: I figured it out, somewhat. I can get images to display, but I don't think I understand how TEMPLATE_PATH works. This is the code I'm using now to get my images to display, from sidebar.tpl:

Code: Select all

{if $item.title != ""}<img src="/templates/myskin/img/{$item.title}_header.gif">{/if}
As you can see, I need to use the full site path to get it to work. How can I change this to use TEMPLATE_PATH? I tried inserting it into my code above but I got PHP errors.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Can I replace plugin titles with images?

Post by garvinhicking »

Try this:

Code: Select all

{assign var="item_imagebase" value=$item.title}
{assign var="item_image" value="img/headers/$item_imagebase.gif"}
{if $item.title != ""}<img src="{serendipity_getFile file=$item_image}" />{/if}
Note that in this example you CANNOT add a "_header.gif" to a variable, as the variable interproplation would not return "XXX_header.gif" but would look for a variable called "$XXX_header" which does not exist

Also note that you could solve your problem with CSS and background-image property already much easier! There you could use the {$TEMPLATE_PATH} thing easily, since it is only available in that CSS and for the Smarty Templates it uses the serendipity_getFile command.
Look at the additional_themes/dreisechzig/ template for an example of that (in our CVS repository).

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply