1
Herko
theme override feature: how to override system images
  • 2006/8/17 18:23

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


Hello,

I'm working on some templates, and for that I need to override the comment system images (edit, delete, reply) with custom images in the theme folder, as per 2.0.14 features. Overriding system module templates isn't a problem, what I need to do is override images from the xoopsroot/images/icons/ folder. Where in my theme folder do I need to put the custom images to have them overridden?

Herko

2
Will_H
Re: theme override feature: how to override system images
  • 2006/8/17 19:51

  • Will_H

  • Friend of XOOPS

  • Posts: 1786

  • Since: 2004/10/10


Wouldn't you just override the comment system template and change the image path?

So you arent necessarily overiding the images as the template that calls the images.

As for which template it is, I am unable to check atm.

So bump.

3
Will_H
Re: theme override feature: how to override system images
  • 2006/8/17 20:39

  • Will_H

  • Friend of XOOPS

  • Posts: 1786

  • Since: 2004/10/10


ok

modules/system/templates/system_comment.html

<td class="even" align="right">
            <
a href="<{$editcomment_link}>&amp;com_id=<{$comment.id}>"><img src="<{$xoops_url}>/images/icons/edit.gif" alt="<{$lang_edit}>" /></a><a href="<{$deletecomment_link}>&amp;com_id=<{$comment.id}>"><img src="<{$xoops_url}>/images/icons/delete.gif" alt="<{$lang_delete}>" /></a><a href="<{$replycomment_link}>&amp;com_id=<{$comment.id}>"><img src="<{$xoops_url}>/images/icons/reply.gif" alt="<{$lang_reply}>" /></a>
          </
td>

          <{elseif 
$xoops_isuser == true && $xoops_userid == $comment.poster.id}>

          <
td class="even" align="right">
            <
a href="<{$editcomment_link}>&amp;com_id=<{$comment.id}>"><img src="<{$xoops_url}>/images/icons/edit.gif" alt="<{$lang_edit}>" /></a><a href="<{$replycomment_link}>&amp;com_id=<{$comment.id}>"><img src="<{$xoops_url}>/images/icons/reply.gif" alt="<{$lang_reply}>" /></a>
          </
td>

          <{elseif 
$xoops_isuser == true || $anon_canpost == true}>

          <
td class="even" align="right">
            <
a href="<{$replycomment_link}>&amp;com_id=<{$comment.id}>"><img src="<{$xoops_url}>/images/icons/reply.gif" alt="<{$lang_reply}>" /></a>
          </
td>


Just change the <img src="">

4
rowdie
Re: theme override feature: how to override system images
  • 2006/8/18 5:02

  • rowdie

  • Just can't stay away

  • Posts: 846

  • Since: 2004/7/21


Hi Herko,

You need to mimic the same directory structure, but then in your theme folder. So for images from xoopsroot/images/icons/ you would put the overriding images in:

/themes/customTheme/images/icons/


and in your overiding template use for example:
<img src="<{xoImgUrl /images/icons/edit.gif}>" alt="<{$smarty.const._EDIT}>" />


@biteronboard
yep, could also just use a static image path. Only then the template can't readily be used for another theme, as there's no fallback to the default icons if the theme doesn't include custom ones.

Minor detail I guess, but I always prefer generic solutions

5
Herko
Re: theme override feature: how to override system images
  • 2006/8/18 7:19

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


Thanks for the replies Rowd hits the hammer on the nail when she said that she prefers a generic solution. Ideally, the templates I'm building are generic templates that can be used n different themes. So generic solutions are best.

That brings me to a question about Rowds solution tho, xoImgUrl mimics $xoops_imageurl, which usually points to xoopsroot/themes/themename/. If I use that in the template, would it know the original image location in xoopsroot/images/icons/ or will it look for the original in the template folder under images/icons/, thereby not overriding, but as biter suggests, changing the path? The only thing that's generic about that solution is that the path is dynamic...?

If I now add a modules/news/images/topics/ folder to my theme folder, I can override the xoopsroot/modules/news/images/topics/ images without changing anything in the templates. If I add an images/icons folder to my theme folder (mimicing the xoopsroot/images/icons/ structure), the override doesn't take effect. Does this only work in module folders?

Herko

6
Will_H
Re: theme override feature: how to override system images
  • 2006/8/18 12:47

  • Will_H

  • Friend of XOOPS

  • Posts: 1786

  • Since: 2004/10/10


If you are using the template override in a custom theme, wouldnt it divert back to stock templates on selection of a new theme anyway?

For it to work in every theme you would need to move the template, so why not point it at your images which you keep in the same directory....

<{$xoops_imageurl}>modules/system/images/

7
Herko
Re: theme override feature: how to override system images
  • 2006/8/18 13:08

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


Biter: the whole point of image override is that you can replace images *no matter what template you use*, because you're overriding the image, and not just serve a custom template with a custom image location.

Putting a custom image in themes/customTheme/images/icons/ doesn't work, I'm afraid. It works for themes/customTheme/modules/news/images/topics/ for instance, but not the former example...

Herko

8
Will_H
Re: theme override feature: how to override system images
  • 2006/8/18 13:13

  • Will_H

  • Friend of XOOPS

  • Posts: 1786

  • Since: 2004/10/10


ah, I hear ya.

I guess I just assumed that because you were doing an image override you were adding buttons that complimented your theme.

Well its still nice to know that you cant override images outside of your module folders.

9
rowdie
Re: theme override feature: how to override system images
  • 2006/8/18 17:45

  • rowdie

  • Just can't stay away

  • Posts: 846

  • Since: 2004/7/21


Um Herko, it works for me - I always test before commenting

Try clearing your templates_c folder. If it's still not working then go through the usual troubleshooting routine, you know the deal It *should* work, if not then there's a problem we need to fix.

'xoImgUrl' is a custom Smarty plugin made by Skalpa, it is not just reusing the old theme url $xoops_imageurl. It first looks in the current theme folder for the image, if not found then it uses the path from the XOOPS root.

10
WebSiteGuru
Re: theme override feature: how to override system images

Quote:

rowdie wrote:
Hi Herko,

You need to mimic the same directory structure, but then in your theme folder. So for images from xoopsroot/images/icons/ you would put the overriding images in:

/themes/customTheme/images/icons/


and in your overiding template use for example:
<img src="<{xoImgUrl /images/icons/edit.gif}>" alt="<{$smarty.const._EDIT}>" />


@biteronboard
yep, could also just use a static image path. Only then the template can't readily be used for another theme, as there's no fallback to the default icons if the theme doesn't include custom ones.

Minor detail I guess, but I always prefer generic solutions


Will this be the same with Forum Images?

default Forum images folder is:

modules\newbb\images

And Custom Theme images folder is:

themes\CustomTheme\modules\newbb\images

Or will it be different?

Login

Who's Online

167 user(s) are online (84 user(s) are browsing Support Forums)


Members: 0


Guests: 167


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits