Change color of first word?

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
lordcoffee
Regular
Posts: 308
Joined: Tue Nov 29, 2005 10:22 pm
Location: Munich - Germany
Contact:

Change color of first word?

Post by lordcoffee »

Hi!

I want to modify the entry headers that the first word is always "grey" and all the others wich are following are "green".

Beispiel für das Problem von oben.

The problem I have is that I don't know how to "split" this entrytitle for the first word and the rest...

Code: Select all

{$entry.title|@default:$entry.body|truncate:37:" ..."}
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Change color of first word?

Post by garvinhicking »

Hi!

Hm, are you really sure this makes sense? I believe in usual blog contents that might look quite odd?

I believe CSS3 has an option to format "first word" occurences!

To achieve that with Smarty you might need to register a custom modifier which explodes a string using the " " space character, replaces stuff inside the first word and then concatenates the rest. That's a lot of overhead and causes performance drops...

Best 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/
lordcoffee
Regular
Posts: 308
Joined: Tue Nov 29, 2005 10:22 pm
Location: Munich - Germany
Contact:

Post by lordcoffee »

Hmm really sad, because the template I'm trying to adapt (this one) is looking very good with that ;-)

Maybe I'll combine the date and the header so I'll have two different parts wich can be edited:

01|Jan|07.Lorem ipsum dolor ...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!
lordcoffee wrote:Hmm really sad, because the template I'm trying to adapt (this one) is looking very good with that ;-)
But it only looks good because the demo uses those titles. Imagine usual Blog entries like:

"What the fuck is google all about"? which whould highlight "what".

Or "In God we trust" which would highlight "in"...I don't really think this way is usable for usual entries...even though it looks good on the page you refer to, of course :)

Putting the date there might look nice! Or maybe the authorname, or the category name(s)?

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/
lordcoffee
Regular
Posts: 308
Joined: Tue Nov 29, 2005 10:22 pm
Location: Munich - Germany
Contact:

Post by lordcoffee »

Well, I totaly forgot the "author" or "category" option. I think to display the category would be most logic option. so if I'm finished with that template we'll have another template and I'm writing a detailed (with screenshots and more) tutorial how to port templates to s9y. Maybe I'll need help with the englisch translation and maybe other languages.

Thanks and Greetings, Lordcoffee
Post Reply