Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-12-22 14:31:00

Marek Zelenka
New Member
Registered: 2010-11-23
Posts: 6

How to remove diacritic and spaces form <txp:image_info type="alt" />

Brothers,

I have in Gallery Page template next the images this code:

<a href=”/artists/<txp:image_info type=“alt” />”>+ see artist biography</a>

What I need is to go through the ALT content to the URL biography part.
I cannot use section or category. I one category there will be more authors and there is not any connection between the biography section.
I have the biography content ready on the right URL, but in the ALT there will be diacritics and spaces. And this is the problem.

The question is if I can use somehow PHP script to clean the <txp:image_info type=“alt” /> content before I will put it in “a href”.
Remove diacritic, space replace with hyphen, and use lowercase only.

Thank you!

Marek

Offline

#2 2010-12-22 14:55:24

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: How to remove diacritic and spaces form <txp:image_info type="alt" />

Not tested, but try this:

<a href="/artists/<txp:php>echo stripSpace(image_info(array('type'=>'alt')));</txp:php>">

I think that will perform exactly the same conversion used to produce the url-only title when you save an article. I’m assuming you are using /section/title as the URL scheme?

Last edited by jsoo (2010-12-22 17:28:21)


Code is topiary

Offline

#3 2010-12-22 17:20:58

Marek Zelenka
New Member
Registered: 2010-11-23
Posts: 6

Re: How to remove diacritic and spaces form <txp:image_info type="alt" />

Absolutely perfect. Exactly what I need!! Unbelievable! :-D
Thanks a lot!

Marek

Offline

Board footer

Powered by FluxBB