Announcement

#1 2014-02-24 19:49:17

dennisyan
Translation Team
2012-07-14
17

How to make text links in photo description clickable?

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

 

#2 2014-02-24 21:39:24

flop25
Piwigo Team
2006-07-06
7037

Re: How to make text links in photo description clickable?

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?


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#3 2014-02-25 21:13:07

dennisyan
Translation Team
2012-07-14
17

Re: How to make text links in photo description clickable?

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

 

#4 2014-02-25 21:15:40

flop25
Piwigo Team
2006-07-06
7037

Re: How to make text links in photo description clickable?

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


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#5 2014-02-25 21:18:40

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: How to make text links in photo description clickable?

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

Code:

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

 

#6 2014-02-25 21:20:33

flop25
Piwigo Team
2006-07-06
7037

Re: How to make text links in photo description clickable?

ho! indeed seems like that should be. Thx mistic


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#7 2014-02-26 14:03:51

msakik
Translation Team
São Paulo, Brazil
2013-09-06
78

Re: How to make text links in photo description clickable?

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

 

#8 2014-02-26 14:09:29

flop25
Piwigo Team
2006-07-06
7037

Re: How to make text links in photo description clickable?

if you worry about your ranking/seo, the links are set to nofollow


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#9 2014-02-26 20:35:41

dennisyan
Translation Team
2012-07-14
17

Re: How to make text links in photo description clickable?

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

 

#10 2014-03-04 22:18:27

dennisyan
Translation Team
2012-07-14
17

Re: How to make text links in photo description clickable?

PS. Found this solution incompatible with Extended Description.

Offline

 

#11 2015-03-16 20:41:36

dutchguru
Member
2015-03-16
2

Re: How to make text links in photo description clickable?

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

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact