I’m having a great time with Maxigallery - thank you.
Is it possible (and if so how!) to get this working:
Image Title="image_name.jpg" (but display without underscore and extension)
and
Image Description=email me about "image_name.jpg" (sends an email with subject of ’image name’)
Sounds like a bit of a toughie to me but somehow I think it might be possible.
Of course it’s possible and quite easy. You need to do custom templates and replace the [+maxigallery.picture.title+] placeholders with [+maxigallery.picture.filename:mystrip+]
Then do the PHx modifier mystrip what modifies the filename and returns it the way you want.. eg. "phx:mystrip" would be something like:
<?php
return str_replace('_', ' ', substr($output, 0, strrpos($output, '.')));
?>
Then replace the [+maxigallery.picture.desc+] placeholders with
<a href="mailto:[email protected]?subject=[+maxigallery.picture.filename:mystrip+]">E-Mail me about "[+maxigallery.picture.filename:mystrip+]"</a>
And I would highly suggest to install some of the available e-mail address obfuscators from the resource repository, see:
http://modxcms.com/resource-listing.html&tags=anti-spam and
http://modxcms.com/resource-listing.html&tags=avoid+spamming
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
Many thanks - I’ll give it a go - I’m not too hot PHP but your instructions seem clear.
Thanks again
I changed the strripos function to strrpos in the example, because the strripos is PHP 5 function and the case insensitiveness is not needed in this case..
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
The default templates are in /assets/snippets/maxigallery/templates.. See more information about the templates from MaxiGallery wiki page in MODx wiki.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
-
☆ A M B ☆
- 24,524 Posts
The sleazy way would be to use rtrim on the whole thing:
return rtrim(str_replace('_', ' ', substr($output, 0, strrpos($output, '.'))), '.jpg');
Quote from: turtle_in_time at Feb 12, 2008, 06:32 PM
i manage to mess around with the templates, but where do i write the code for "mystrip" below? now i am showing only filename and i would like to remove the .jpg at the end...
Create a snippet called "phx:mystrip" and put the code there. Read more information about how PHx works from the modx wiki.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."