Hi there,
I always put some links related to the photo in photo's description, my question is:
how to make all text URLs in photo descriptions clickable, with out putting html code everytime?
I'm not a programmer, I've found something like putting following codes in php file:
function make_links_clickable($text){
return preg_replace('!(((f|ht)tp(s)?://)[-a-zA-Zа-яА-Я()0-9@:%_+.~#?&;//=]+)!i', '<a href="$1">$1</a>', $text);
}
problem is I don't know which php file I need to edit.
or are there some other ways to realize it?
(I use Stripped theme)
Thanks!
Offline
Hello
html is by default enable: $conf['allow_html_descriptions'] = true; | http://piwigo.org/doc/doku.php?id=user_ … onf_locale
how did you set the description? from Pwiigo, or from IPTC?
Offline
Hi flop25,
Thanks!
I know I can put <a href="http://xxx">yyy</a> to make a clickable link, but what I want to realize is: if put just a text url "http://xxx" in a photo description, when show it in the front photo page to a visitor, system can automatically recognize it and make it clickable. Then you need not use html code everytime when you input the url.
This is important because: 1.User don't need to use html (and maybe they don't know how) everytime; 2.There're already many text urls in photo descriptions, this function can make them all clickable, and one doesn't need to add html to every exist text url.
Offline
okay I understand
You can build you own plugin using Extended Description or one of smiley plugins to know how to parse text fields like descriptions
Offline
the function render_comment_content() replaces links and basic markup tags (*bold*, /italic/, _underline_) but is only applied to user comments
I think it should be applied to descriptions too
--
dennisyman add this in a personnal plugin
add_event_handler('render_category_description', 'render_comment_content'); add_event_handler('render_element_description', 'render_comment_content');
edit: no "s"
Last edited by mistic100 (2014-02-25 21:20:43)
Offline
ho! indeed seems like that should be. Thx mistic
Offline
I have tried this and seems cool. But putting url in comments always render to a clickable item. Is there a way to disable this?
Offline
if you worry about your ranking/seo, the links are set to nofollow
Offline
I built a personal plugin with LocalFiles Editor with mistic100's code inserted, and it works!
Thank you so much mistic100, and flop25 too. Your answers really helps a lot. :)
Hope this 'make text links in photo description clickable/unclickable' can be a choice in main configuration in later Piwigo.
Offline
PS. Found this solution incompatible with Extended Description.
Offline
dennisyan wrote:
I built a personal plugin with LocalFiles Editor with mistic100's code inserted, and it works!
It's an old topic, I know, but the question is relevant.
I want to set every outgoing link have a rel="nofollow".
I've seen this 'render_comment_content' in html_inc' only used for comments.
[1] Is the solution as before working well, if not combined with extended description
[2] why to set this in a personal plugin, if adding in 'render_comment_content' is also possible
[3] how should such a personal plugin look like ?
Offline