Referencing 'An URL' catalogue CPF

Post

Posted
Rating:
#5173 (In Topic #1041)
Joe

+ 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.

Post

Posted
Rating:
#5185
First a clarification on terminology:
  • 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.
1 guest and 0 members have recently viewed this.