ie http://www.mysite.com/index.php for an internal page for an etomite site.
From the miscellaneous API documentation.
makeUrl($id, $alias=0, $args='')
// Modified by mikef
// returns a properly formatted URL as of 0.6.1 Final
// $id is a valid document id
// $alias is now an unused parameter because it is now calculated based on $id
// $args is a URL compliant text string of $_GET key=value pairs
// Example: makeURL(45,'','?cms=Etomite')
$id can be passed by using $etomite->documentIdentifier, by passing a numeric value for a page id, or by passing an alias for the page by using [~alias~].
$args will accept key=>value pairs to pass in the URL as GET values eg:
$etomite->makeURL(12,'','?param1=one¶m2=two');will result in:
Things to notice...The $args are prefixed by a "?", now if a "?" already exists (like in the example above), the API is smart enough to work out that another "?" will break the URL, so it adds an amperstand "&" instead.
Another implementation is:
This will create a URL to the page where it was generated.
You could also use it like this with the sendRedirect() function:
return $etomite->sendRedirect($etomite->makeURL($etomite->documentIdentifier,'',''), $count_attempts=3, $type='');
Or with templated variables like this:
or with internal snippet variables like this:
$output="<form id=\"myform\" action=\"".$etomite->makeURL($etomite->documentIdentifier,'','')."\" method=\"get / post\" > <<<SNIP>>>> </form>";This method is much more reliable than form action="" (especially for many localhosts or when the form submits to an error 404 (page not found).
makeURL also handles friendly aliases and FURL (Friendly URLs). That means that if your site is using these options, you can pass a page number or alias and the FURL will be returned.
ie $etomite->makeURL('12','',''); will return
http://yoursite.com/yourpage.html depending on the settings you have chosen to use in your site configuration settings.
Edited by Cris D., 03 March 2009 - 06:09 PM.