Name

VarName — remap Interchange variables to arbitrary names in generated URLs

SYNOPSIS

original_name remapped_name

DESCRIPTION

The directive sets the names of variables that will be remapped to and from the URL when Interchange outputs it in user pages or reads from form submission requests.

DIRECTIVE TYPE AND DEFAULT VALUE

Global directive,
Catalog directive

EXAMPLES

Example: Remapping mv_session_id to session

VarName mv_session_id session

Example: Remapping mv_session_id to id

VarName mv_session_id id

NOTES

Interchange already ships with some remapping definitions (to shorten URLs, not obfuscate code or anything); see etc/varnames for a list.

When remapping mv_ variable names, make sure you avoid two-letter abbreviations — most are reserved for the search parameters. Names consisting of 1, 3 or more characters would be fine, though.

AVAILABILITY

VarName is available in Interchange versions:

4.6.0-5.7.0 (git-head)

SOURCE

Interchange 5.7.0:

Source: lib/Vend/Config.pm
Line 403

['VarName',          'varname',           ''],

Source: lib/Vend/Config.pm
Line 553

['VarName',          'varname',           ''],

Source: lib/Vend/Config.pm
Line 2867 (context shows lines 2867-2904)

sub parse_varname {
my($item,$settings) = @_;

return if $Vend::ExternalProgram;

my($iv,$vn,$k,$v,@set);
#logDebug("parse_varname: $settings");
if(defined $C) {
  return '' if ! $settings;
  $C->{IV} = { %{$Global::IV} } if ! $C->{IV};
  $C->{VN} = { %{$Global::VN} } if ! $C->{VN};
  $iv = $C->{IV};
  $vn = $C->{VN};
}
else {
  if (! $Global::VarName) {
    unless (-s "$Global::ConfDir/varnames" && -r _) {
      $settings = $Varnames . "\n$settings";
      writefile("$Global::ConfDir/varnames", $Varnames);
    }
    else {
      $settings = readfile("$Global::ConfDir/varnames");
    }
  }
  undef $Varnames;
  $Global::IV = {} if ! $Global::IV;
  $Global::VN = {} if ! $Global::VN;
  $iv = $Global::IV;
  $vn = $Global::VN;
}

@set = grep /\S/, split /\s+/, $settings;
while( $k = shift @set, $v = shift @set ) {
  $vn->{$k} = $v;
  $iv->{$v} = $k;
}
return 1;
}

AUTHORS

Interchange Development Group

SEE ALSO

ScratchDefault(7ic)

DocBook! Interchange!