[ic] Passing parameters to usertags

Stefan Hornburg interchange-users@icdevgroup.org
Mon May 26 11:44:00 2003


On Mon, 26 May 2003 11:23:36 -0400
Interchange User <interchange@framework.cx> wrote:

> Hi folks,
> 
> 	I'm having some trouble with (what I think is) a very basic question 
> on a custom usertag.  I have the following tag, which I am constructing 
> to dynamically build a navbar on an IC 4.9.7 site.  The problem I am 
> having is getting parameters passed to the subroutine.  I thought if I 
> wanted to access a section of the web site called "search" under a page 
> called "database" (where "section" and "page" are just terms I'm using 
> to describe different parts of my site) I could do something like
> 
> 	[test_nav page=database section=search]
> 
> and have the variables $page and $section be accessible to me, but that 
> doesn't appear to work.
> 
> 	So instead, I started calling my tag with positional parameters, like 
> so:
> 
> 	[test_nav database search]
> 
> 	This works, sort of.  I am able to shift arguments off the @_ 
> variable, but everything after the tag name (eg: "database search") 
> gets pulled off as one variable, whereas I expected this to come off as 
> a list.  In my subroutine, I thought I could do
> 
> 	my ($page, $section) = @_;
> 
> but that doesn't work, and instead I have to do the following:
> 
> UserTag test_nav Interpolate
> UserTag test_nav Routine <<ENDTEST
> sub {
> 	my $nav;
> 	my $page;
> 	my $section;
> 	my $args = shift;		# Gets arguments that were passed, as a single 
> string?
> 	($section, $page) = split / /, $args;
> 	
> 	#	do stuff with $section and $page...
> 
> }
> ENDTEST
> 
> 
> 	Is this normal?

Dear Peter,

there are tons of examples in the Interchange source code and in
the mailing list archives. It should not be too hard to figure
out how to pass parameters.

Bye
	Racke


-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team