API: Page
Filename:
fwpPage_urlParamsFldrs.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/realfolder/-/name/value/pagename
This URL method only works with HTTP servers that allow virtual folder names, and may require custom configuration of the server for the virtual host site.
The name-value pairs are automatically stripped from the URL and converted into page variables during the page init step.
fwpPage_urlParamsFldrs: -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_urlParamsFldrs: -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_urlParamsFldrs.ctag }
{rsrcType= tag }
{rsrcName= fwpPage_urlParamsFldrs }
{rsrcHTTP= www.pageblocks.org/refc/fwpPage_urlParamsFldrs }
{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_urlParamsFldrs:
// -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_urlParamsFldrs', -priority='replace',
-optional='domain',
-optional='folder',
-required='page',
-required='vars';
$fw_debug ? $fw_tagTracer->(add:'fwpPage_urlParamsFldrs');
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;
// get rid of any spaces in the list so the split is more reliable
#fw_urlVars = (fwpCnfg_splitComma: #fw_urlVars);
// start the url string
if: local:'fw_urlDomain';
#fw_urlStr += #fw_urlDomain;
/if;
if: local:'fw_urlFolder';
#fw_urlStr += '/' + #fw_urlFolder + '/';
/if;
#fw_urlStr += '-';
// 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 +
'/' +
(var:#fw_urlParam));
/if;
/iterate;
// add page name and we`re done
#fw_urlStr += ('/' + #fw_urlPage);
return: #fw_urlStr;
/define_tag;
?>
© 2002-2010, pageblocks.org