Fieldtype, Module

Archived
Forum
(read-only)

VZ URL extension

ExpressionEngine 1.x, ExpressionEngine 2, ExpressionEngine 3

Back to this add-on's main page
View Other Add-ons From Eli Van Zoeren

     

How to get a VZ URL field to display in a {custom_fields} loop?

General

FCGRX
FCGRX

I am trying to create a generic Safecracker form for my site, which can be used for every channel the client can modify. I’m trying to avoid hard-coded conditionals for supporting any specific fields, so I wonder whether the following handlers for my various VZ URL fields can be simplified?

{if vz_url}
 {if field_name 
== "purveyor_link"}
  {field
:purveyor_link} 
 {
/if}
 {if field_name 
== "purveyor_importer_link"}
  {field
:purveyor_importer_link} 
 {
/if}
 {if field_name 
== "blog_video"}
  {field
:blog_video} 
 {
/if}
 {if field_name 
== "community_link"}
  {field
:community_link} 
 {
/if}
 {if field_name 
== "press_link"}
  {field
:press_link} 
 {
/if}
 {if field_name 
== "staff_link"}
  {field
:staff_link} 
 {
/if}
{
/if} 

It works, but if I ever add a new VZ URL field to a channel then this block must be modified. Not entirely elegant.

I can avoid this with a very simple replacement:

{if vz_url}
   
<input type="text" dir="{text_direction}" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="50" class="span9 input-small">
{/if} 

But then I lose the VZ URL field validation and may as well discontinue using it.

Is there a better way?

 

Eli Van Zoeren
# 1
Developer
Eli Van Zoeren

What version of VZ URL are you running? I just tested it with the current version, 2.2 and apart from one PHP error (now fixed), it worked perfectly. Can you try updating to the new version from GitHub? If it still doesn’t work, can you send me a link to the page, if it’s online?

{if vz_url}
 {display_field}
{
/if}