Page 1 of 1

split $blogTitle or $entry.title into two

Posted: Thu Aug 17, 2006 6:42 am
by carl_galloway
Hi, I want to split $blogTitle or $entry.title at a word boundary so that I can wrap a span around the one of them. This would allow me to style the bit with the span with a different color or font size. Ideally I would like to be able to take the blog title/entry title and place the span after the second word, so the new html might look like this

this is <span> my new blog title </span>

Is this possible? The guys at the smarty forums have suggested creating a function or using modifiers but how do I do that?

Thanks, Carl

Re: split $blogTitle or $entry.title into two

Posted: Thu Aug 17, 2006 10:37 am
by garvinhicking
Hi!

You would create such a smarty function in your template's config.inc.php file (see the tech docs on www.s9y.org for an example).

However.

Do you really need to go that route? Why do you want to use blogTitle? Why not use different fields alltogether? Hardcode the spans into your template file, use a Custom Entryproperty field for a "second" entry title? I guess that splitting a variable on word boundary might yield strange results in a dynamic way?

Best regards,
Garvin