Re: Inserting hyperlink inside the description of a document, photo, video, stored in ResourSpace

159 views
Skip to first unread message

David Ehnebuske

unread,
Jul 1, 2012, 4:13:28 PM7/1/12
to ResourceSpace
Hello,

If I understand correctly you are trying to enable inserting live
hyperlinks into fields associated with specific resources. Normally
this is not possible because field values are just data, not HTML code
snippets. Generally, this behavior is a good thing because letting
users insert arbitrary HTML into fields can lead to all sorts of
problems.

That said, it is possible to add a live link using a value filter. If
you go to Team Centre > System Setup and click on the "+" in front of
"Resource Types / Fields" and then the "+" in front of "Global Fields"
and then on "Caption" you will open the field definition for the
Caption field. Part way down this form, you will find the box for the
"Value filter" for the Caption field. Normally it is empty, but you
can put a php statement in it that transforms the value of the Caption
field before it is displayed, including adding a bit of HTML function
such as a live link. For example, if you put

$value = preg_replace ('/^(.*)#(.*)#(.*)#(.*)/', '$1<a target="_blank"
href="$2">$3</a>$4', $value);

into the Value field, and then put something like

This is my caption with #http://www.google.com#a link to Google# in
it.

into a caption, it will be displayed as

This is my caption with a link to Google in it.

where "a link to Google" is a live link. This is a pretty "rough and
ready" way of doing it, but you don't need to change or add code to
make it work. A better solution would be to create a custom value
filter that does more error checking and allows you to insert more
than one link into a field. If you wish to pursue that path, have a
look at how the "nicedate" function is implemented and used by the
Date field.

Hope this helps and is something like what you are looking for.

David Ehnebuske

On Jun 27, 3:16 am, cb21 <charles.burr...@gmail.com> wrote:
> Good morning everyone
> I am planning some work with students and teachers.
> The documents / resources are stored in ResourceSpace, in collections. I
> begann to work with some weeks ago.
> In order to allow the access to the work done by a group of students, I
> would like to insert hyperlink in the resource description, metadata, ...
> hyperlink like URL address between the resource and the document, book,
> presentation ... the students or the teachers are developing. For instance
> a link between a series of Art photos and the presentation of the artist or
> ..., a link inside each photo and the website or thepdf document related to
> the artist, ...
> My question : is there a possibility to insert such an hyperlink, an active
> one, not only a line of text beginning by http:// ... into the photo
> description, or the means / the way to make this line really active.
> Thank you very much in advance.
> I apologize for the quality of my english but I hope it is clear enough.
> CB21 - France

Chrissy Hartman

unread,
Oct 4, 2021, 2:03:31 PM10/4/21
to ResourceSpace
Anyone have an update as to how to put a hyperlink in a metadata field?  This solution isn't working for me.

Thanks!

emily...@gmail.com

unread,
Oct 5, 2021, 9:44:53 AM10/5/21
to ResourceSpace
I have a hyperlink in one of my dropdown/fixed vocab fields that works as expected. All I did was use a regular HTML tag: <a href="URL" target="_blank">URL TITLE</a>

Chrissy Hartman

unread,
Oct 6, 2021, 9:00:29 AM10/6/21
to ResourceSpace
Thanks for your suggestion!  I hadn't thought of that, but just tried it.  Unfortunately, for me it displays the html rather than a hyperlink.  I did finally find a workaround by using the display template:

<a href="[value]"  rel="external" "target="_blank">[value]</a>

Reply all
Reply to author
Forward
0 new messages