XactCommerce Xact Objects
Home
News
XactCommerce
Typical Applications
Custom Development
Private Backend
XactScript Language
Performance
Deployment
Partners
Portfolio
About Us
leXml Language < Interface Modules & Commands < If_Utils

If_Utils

Various random utilities that could be useful to call from an XML page that don't fit into any other category.

isempty
Checks to see if a string is empty (string=...)


listgeneric
Prints a list of whatever is in 'listitems' (comma-seperated)


liststates
Prints a list of states as an option list


liststatesjs
Lists states as JavaScript


listcountries
Prints a list of countries as an option list


getrandomstring
Returns and prints a random string
Arguments:
length - Length of string (default=8)


generictemplate
This command allows you to do a generic template. All the argument=value
pairs become template ##macro## replaces except the 'template' argument
that should be of course the template itself.


getyear
Prints and returns the current full year


getmonth
Prints and returns the current number of the month from 1 to 12


getmonthname
Prints and returns the current name of the month


getlongmonthname
Prints and returns the current name of the month


getweekday
Prints and returns the current number of the day of the week


getweekdayname
Prints and returns the current name of the day of the week


getlongweekdayname
Prints and returns the current name of the day of the week long


getday
Prints and returns the current day of the month


getdate
Prints and returns a string representing the current date and time


getmyurl
This returns and prints the current URL


getmybaseurl
This returns and prints the current base URL


getarrayformvar
This prints and returns an array form variable with the given seperator between entities.
 
Arguments:
separator=(separator) (default=,)
name=(name of form variable) (required)


printtemppage
Prints the contents of a temporary page stored in the temporary page cache.
 
pagename=(page name)


settemppage
Sets the contents of a temporary page
 
pagename=(page name)
content=(page content)


print
Prints the results of the toString method of whatever is in the 'value' body element.


printloop
Prints the results of the toString method of whatever is in the 'value' body element 'loop' number of times


printnbsp
Same as print but replaces spaces with  


printstatus
This prints a little bit of status info about the currently running Java VM and LeXml instance.


printhiddenfield
Prints any number of things as hidden fields
 
Arguments:
hiddenfieldname=value (any number of these)


printcreditcardnumber
Used to print a credit card number.


environmental
Prints and returns the passed environmental variable value


urlencode
Same as 'print' but URLencodes result. Also returns urlencoded result.


lowercase
Same as 'print' but lowercased result. Also returns lowercased result.


uppercase
Same as 'print' but uppercased result. Also returns uppercased result.


substring
Same as 'print' but substringed result. Also returns substringed result.
 
Arguments:
startat: character to start at (default=0)
endat: character to end at (default=string length)


getemailuser
Prints all of the passed email address before the @ symbol
 
Arguments:
email address


random
Prints & Returns a random number
 
Arguments:
digits: number of digits (default=1)


utctime
Prints & Returns the current utc time
 
Arguments:
digits: number of digits from the end (default=all)


return
Returns whatever is in the 'value' body element.. for doing.. say.. if comparisons with form elements or variables.


printyearoptionlist
Prints an option list for years starting with the present year and going 'yearcount' years in the future (10=default). For credit card expiration year lists.printmonthoptionlist. Prints an option list for months (from 0 to 12)


zapsession
Invalidates the session


setsession
Sets variable(s) in the session


commitsession
This command will *force* the session to be committed to disk even though the page is not yet done processing. This is useful for credit card processing and some such other things.


getsession
Views and returns a session variable 'var'


dumpformelements
Dumps form elements and URL arguments as hidden form fields


getsessionid
Prints and returns the session ID (for doing.. for instance.. a hidden form element based session that doesn't require cookies). Returns an empty string if there's no session.


browserid
Returns the browser type, with the possible results being:
 
IE4+ - Internet Explorer 4.0 or newer
NS4 - Netscape 4.something
OLD - Netscape 3, IE3, IE2, Mosiac, etc.
TEXT - Lynx and other text browsers
OPERA - Opera
MOZ - Mozilla, Netscape 6, etc.
??? - Unknown browser


listtooptions
This generates a series of option tags from a carriage-return-delimited list (list=...)


listitems
This lists a series of items delimited by a given delimiter (and trimmed) that match a given wildcard mask. Use prefix and postfix to give prefix and postfix to each item in the list. (This can be used to do things like generating img tags for precaching of images, etc...)
 
Arguments:
list - The list of items (required)
delim - Delimiter (default=\n)
mask - Wildcard mask (* and ? allowed) (default=*)
cs - Case sensitive? (default=false)


settempvars
This command stores a series of variables in the global teporary variable cache. These are stored as a Java properties file in the LeXml global temp directory. These variables persist for about 6 hours.
 
Arguments:
name - Name of this entry in the temporary variable cache
var1..var2.. = value - Any other arguments are set as variables in cache


gettempvars
Reads a stored temp var set into page variables corresponding to the names of the stored variables. (name=name of entry) Returns 'ok' or 'error: not found'.


gethttpheader
This returns an HTTP header

Arguments:

name - The Name of the Header you wish to retrieve

Possible Headers:
  • accept-language
  • connection
  • accept
  • host
  • accept-charset
  • accept-encoding
  • user-agent
  • referer