TomRed.net

  • Increase font size
  • Default font size
  • Decrease font size
Subscribe Bookmark and Share
Home Tutorials FatWire FatWire Retrieving a list of FatWire sites (Publications)

FatWire Retrieving a list of FatWire sites (Publications)

PDF
User Rating: / 0
PoorBest 

This is a simple and very useful code snippet which allows you to list all the FatWire sites on an App Server. This can be used in designing your own custom forms where you want the user to select the site from a list. The dynamic nature of this means that this list will grow with the sites and require no maintenance of code or picklists.

Firstly you are required to add the Publication tag Library using <%@ taglib prefix="publication" uri="futuretense_cs/publication.tld" %>. This makes the functionality available using the publication prefix.

We use the tag publication:list to retrieve the list of sites and the list attribute takes the output variable name to assign the list to. In my example I am outputting this list in an html standard Ordered List <ol>. You can easily alter this code to output to a select statement or some other html set.

We then loop through the list created by passing the list name pubs into the listname attribute of the ics:listloop tag. We can then access a number of attribute of the site including the ID, Name and Description. You access these using ics:listget tag passing the name into listname attribute and the name of the field you want in the fieldname attribute. In this example I retrieve the ID and Name.

<%@ taglib prefix="publication" uri="futuretense_cs/publication.tld" %>

<publication:list list="pubs"/>
<ol>
	 <ics:listloop listname="pubs">
	 	<li> 
	 	 	 ID : <ics:listget listname="pubs" fieldname="id"/>, 
	 	 	 Name :<ics:listget listname="pubs" fieldname="name"/>
	 	</li>
	 </ics:listloop>
</ol>