klox7 VIP
Total posts: 914
04 Dec 2013 12:27

In template output I don't want to show the whole url. Instead I want to show just clickable label. I don't want to use "Allow enter label" parameter because every user will then have own label. I want the label to be same accross all pages.

Last Modified: 02 Mar 2014


Sergey
Total posts: 13,748
05 Dec 2013 00:46

I think best way is to create custom field output template.


klox7 VIP
Total posts: 914
05 Dec 2013 14:34

In the output template of url field I found this

<?php echo isset($val['label']) != '' ? $val['label'] : $val['url'] ?>

I have to change $val['url'] to remove url and replace it with something else. Can you please help me how to replace it with field label. Regards


Sergey
Total posts: 13,748
06 Dec 2013 01:28

klox7 VIP
Total posts: 914
06 Dec 2013 01:38

Thanks, this is what my solution is now (hardcoded). I was think if I can show field label with something like $this->fields[id]->label. But I couldn't make it work.


klox7 VIP
Total posts: 914
09 Dec 2013 04:20

To change url with label you have to simply replace $val['url'] with $this->label

Or download this template and paste it in components/com_cobalt/fields/url/tmpl/output. Then in field parameters "Template in the article full view" select new template "url_as_label".

Powered by Cobalt