iconlink: WacsUI's Most Important Function

We're now going to take a look at WacsUI module's most important function, iconlink. It's job is simply to display and icon with an appropriate link around it. Sounds simple enough, doesn't it? Unfortunately it isn't - there's a lot of work that needs to be done relating to permissions, access methods, checking caches and resizing which actually makes it fairly complex. The good news is that the iconlink function will do it all for you!

The iconlink function takes quite a few arguments which control how it works, but they are reasonably straightforward. In most cases parameters are optional and sensible defaults will be used instead if they are not given - obviously things like set number and the location fields (sarea, scategory and sdirectory) are necessary.

Example 5.5. Using the iconlink function

print $wacsui->iconlink(
	array( 'type'=>$setdetails[1],
	       'setno'=>$setdetails[0],
	       'sarea'=>$setdetails[2],
	       'scategory'=>$setdetails[3],
	       'sdirectory'=>$setdetails[4],
	       'model'=>$moddetails[1],
	       'resize'=> 0 ))."\n";

The perl dialect is again very much the same:

print iconlink( type=>$setdetails[1],
                setno=>$setdetails[0],
                sarea=>$setdetails[2],
                scategory=>$setdetails[3],
                sdirectory=>$setdetails[4],
                model=>moddetails[1].
                resize=> 0 ))."\n";