Display image in the title

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Jr Prod
Regular
Posts: 18
Joined: Thu Jul 14, 2005 12:18 pm

Display image in the title

Post by Jr Prod » Mon Nov 21, 2005 4:46 pm

Hi everybody,

I would like to display an image near to the title. But it wouldn't be an image assiciated to a category but a different image for each note.
I don't have any idea how to do that, so thanks for any clue. :D

Jr Prod
___________________________
http://www.fosenbauer.com/blog

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Display image in the title

Post by garvinhicking » Mon Nov 21, 2005 7:24 pm

Try to edit your entries.tpl template, there you can insert any HTML you like. Or use CSS and the background-image property to style elements.

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/

MySchizoBuddy
Regular
Posts: 340
Joined: Sun Jun 12, 2005 5:28 am

Post by MySchizoBuddy » Tue Nov 22, 2005 12:09 am

u can also use the customs fields thingy right. so every post u can assign a new image
Image

JrProd

Post by JrProd » Tue Nov 22, 2005 11:42 am

Try to edit your entries.tpl template


Yep, but if I do this, all my entries will have the image near to the title. My wish is that only entries that talk about argentina would have a little flag near to the title...

use the customs fields thingy right


That sounds nice. Where can I find this. Is that a plugin or is there an option in the sending formular ?

Thanks
___________________________
http://www.fosenbauer.com/blog

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Tue Nov 22, 2005 11:44 am

# 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/

JrProd

Post by JrProd » Tue Nov 22, 2005 1:08 pm

OK, thanks a lot, I'll try that :D

Regards,
Jr Prod

MySchizoBuddy
Regular
Posts: 340
Joined: Sun Jun 12, 2005 5:28 am

Post by MySchizoBuddy » Tue Nov 22, 2005 11:03 pm

ok here is the solution. :)

First open up entries.tpl (don't change the default entries.tpl, copy one to ur template folder and change that) and find this line

Code: Select all

        <h4 class="serendipity_title"><a href="{$entry.link}">{$entry.title}</a></h4>


replace it with this line

Code: Select all

                <h4 class="serendipity_title"><img src="{$entry.properties.ep_icon}" /><a href="{$entry.link}">{$entry.title}</a></h4>


Now install "Extended properties for entries" and type this in your custom fields.
Image

then when u make a new post u just type in the url of the flag
Image

thats it, ur done.
now if u don't provide a url then a question mark appears. there is a way to detect if a smarty field is empty of not, garvin might know that.
if not then i'll look into it more. u could just call the whole <img> tag as a field that way u don't have to worry about the question amrk.

try it out and let me know.

I'm in LOVE with this custom fields thingy. :oops:
Image

Post Reply