Referencing 'An URL' catalogue CPF
Posted
#5585
(In Topic #1294)
Standard member

+ possible bug
I have a catalogue with a CPF that needs to be a URL. The Field Type is set to "An URL" (on a side note, shouldn't it read 'A URL'?)Problem is when I reference this CPF in my catalogue templates, I can't get the link to display properly unless I switch the Field Type to "A brief line of text (no Comcode support)".
Code
{+START,IF_NON_EMPTY,{FIELD_6}}
<a href="{FIELD_6*}">Click here</a>
{+END}..this tries to place another anchor tag inside the HREF attribute (for the sake of reference, it's an anchor tag with a classname of "user_link"). I assume this is because the "An URL" CPF Field Type uses some Comcode to append extra stuff to the URL.
If I use {$STRIP_TAGS*,{FIELD_6}} then it just adds the title of the website being linked to inside my anchor tag (not an actual URL)
{$STRIP_HTML} seems to have the same effect as {$STRIP_TAGS}
There's also some weird stuff going on when using https versus http in a URL CPF Field Type when referencing it inside a catalogue template. I get different and odd results each time depending on what syntax I use to output {FIELD_6} (i.e. using {$STRIP_TAGS*,{FIELD_6}} on a link that contains https displays differently than if the link contained only http)
So my question is, is this normal behavior? Should I be using another Tempcode symbol to somehow remove Comcode from the output of {FIELD_6} (assuming that's even what's happening)? Because as it is, the only way to correctly display this link within my catalogue template is to change the Field Type to just a plain line of text.
Posted
Site director

- CPF = Custom Profile Field, i.e. on an account
- Catalogue field = A field on a catalogue (what you have here)
- Custom field = A custom field on a content type (implemented under-the-hood as a catalogue field on that content type's auto-bound catalogue)
on a side note, shouldn't it read 'A URL'?
Some people pronounce 'URL' as 'earl', so it would be 'an earl'.
However, I did some Googling and this seems to have fallen out of favour, it seems it was once popular with computer science professors. I can't see any reference to an official pronounciation.
So we'll change it to 'A URL' in v11.
…
Try {FIELD_6_PLAIN}.
There's also some weird stuff going on when using https versus http
You mean sometimes the title is not showing and you get a URL showing instead?
I'd need to know the URL to run checks.
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
- If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
- If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
- If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
1 guest and 0 members have just viewed this.

