API: Page
Filename:
fwpPage_urlParamsFile.ctag
Released With:
5.0.0
Current Version:
1.1.0
Status: Active
Min Lasso Tested: 8.1.0
Max Lasso Tested: 8.5.3
Related:
Still don't get it?
Check out the talk list archives, or join and ask your questions.
Documentation Error or Request?
Email documentation corrections or comments
Creates a URL with a list of variables converted as a prefix to a page's filename. This replaces the ? based parameter list in a URL to improve compatability with some search engines and somewhat clean up URL appearance for pages dynamically generated based on URL parameters.
The final URL looks like http://sub.domain.dom/folder/name,value,pagename
The actual name-value separation character is defined by the var fw_kURLparamsChar, with the default character being a comma.
This method of embedding paramaters in the URL should be compatible with all HTTP servers, and should work without any server configuration modification. There may be an issue with file name length in some servers.
The name-value pairs are automatically stripped from the URL and converted into page variables.
fwpPage_urlParamsFile: -domain = domainName, -folder = pathName, -page = fileName, -vars = varNames;
-domain - optional : the domain name of the target site in the format of sub.domain.dom, not necessary for links internal to the same site.
-folder - optional : the path name of the page, in the form of /folder/folder/ where leading and trailing slashes are optional (the tag rebuilds the complete page pathname). Leave empty if the page is in the site root directory.
-page - required : the name of the page in the form of pagename.ext
-vars - required : a comma separated list of variable names to include in the URL (list can have spaces or not).
<a href="[fwpPage_urlParamsFile: -folder = '/products/sprockets/', -page = 'prodDetails', -vars = 'prodID,color, size' ]">Go Here</a>
Generates a link that might look like this:
/products/sprockets/prodID,WR4500,color,blk,size,12,prodDetails
<?lassoscript
//............................................................................
//
// pageblocks: (c) 2002-2007 http://www.pageblocks.org/
//
//............................................................................
/*
{fileName= fwpPage_urlParamsFile.ctag }
{rsrcType= tag }
{rsrcName= fwpPage_urlParamsFile }
{rsrcHTTP= www.pageblocks.org/refc/fwpPage_urlParamsFile }
{lassoVrsnMin= 8.1.0 }
{lassoVrsnMax= 8.5.3 }
{author= Greg Willits }
{authorEmail= subscribe to pbTalk at www.pageblocks.org/talk/ }
{authorHTTP= www.pageblocks.org }
{desc= Creates a URL in the form of:
sub.domain.com/folder/subfolder/name-value-page.lasso
to embed name/value pairs in a URL. }
{maintvsrn= 1.1.0 }
{maintrelease= 5.1.0 }
{maintdate= 2006-05-30}
{maintauthor= Greg Willits }
{maintnotes= added tagTrace }
{maintvsrn= 1.0 }
{maintrelease= 5.0.0 }
{maintdate= 2006-01-16 }
{maintauthor= Greg Willits }
{maintnotes= initial release }
*/
//............................................................................
//
// Usage:
//
// fwpPage_urlParamsFile:
// -folder='/folder/subfolder/',
// -page='page.lasso',
// -vars='cat,size,color';
//
// -domain -- with or without slashes
// -folder -- with or without slashes
// -page -- without slashes
// -vars -- comma separated list of variable names
// can be comma or comma-space (red,blue, green)
//
// Insantiation of (fwp_corralPaths) in siteConfig will
// automatically create vars from the name/value pairs.
//
//.............................................................................
define_tag:'fwpPage_urlParamsFile', -priority='replace',
-optional='domain',
-optional='folder',
-required='page',
-required='vars';
$fw_debug ? $fw_tagTracer->(add:'fwpPage_urlParamsFile');
local:
'fw_urlDomain'=@local:'domain',
'fw_urlFolder'=@local:'folder',
'fw_urlPage'=@local:'page',
'fw_urlVars'=local:'vars',
'fw_urlStr'=(string),
'fw_urlParam'=(string);
// remove leading and trailing slashes from
// path names to standardize their format
// add them back in below
if: local:'fw_urlDomain';
#fw_urlDomain->removetrailing:'/';
/if;
if: local:'fw_urlFolder';
#fw_urlFolder->removeleading:'/';
#fw_urlFolder->removetrailing:'/';
/if;
// convert to array
#fw_urlVars = (fwpCnfg_splitComma: #fw_urlVars);
// start the url string
if: local:'fw_urlDomain';
#fw_urlStr += 'http://' + #fw_urlDomain;
/if;
if: local:'fw_urlFolder';
#fw_urlStr += '/' + #fw_urlFolder + '/';
else;
#fw_urlStr += '/';
/if;
// add name-value pairs with separator after each,
// fw_kUrlParamsChar is a siteConfig var that sets
// what the separation character is
iterate: #fw_urlVars, #fw_urlParam;
if: var:#fw_urlParam;
#fw_urlStr +=
(#fw_urlParam +
fw_kUrlParamsChar +
(var:#fw_urlParam) +
fw_kUrlParamsChar);
/if;
/iterate;
// add page name and we`re done
#fw_urlStr += #fw_urlPage;
return: #fw_urlStr;
/define_tag;
?>
© 2002-2010, pageblocks.org