function.jurlpattern.php
Tags
Table of Contents
- jtpl_function_html_jurlpattern() : mixed
- function plugin: write the url corresponding to the given jelix action, inserting placeholder name (between two %) for some parameter, so you can generate the url dynamically in JS by replacing placeholders by javascript values.
Functions
jtpl_function_html_jurlpattern()
function plugin: write the url corresponding to the given jelix action, inserting placeholder name (between two %) for some parameter, so you can generate the url dynamically in JS by replacing placeholders by javascript values.
jtpl_function_html_jurlpattern(jTpl $tpl, string $selector[, array<string|int, mixed> $params = array() ][, array<string|int, mixed> $placeholders = array() ]) : mixed
example :
it may produce something like that (depending how the url is configured for the 'jxacl~admin_rightslist' action):
index.php/acl/rightslist/%idgroup%/bar?acl=%acl%
Then you can replace placeholders
var urlpattern = document.getElementById("baz").dataset.url; var id_group = 45, acl = 'hello'; var url = urlpattern.replace("%idgroup%", id_group); url = url.replace("%acl%", acl);
Parameters
- $tpl : jTpl
template engine
- $selector : string
selector action
- $params : array<string|int, mixed> = array()
static parameters for the url
- $placeholders : array<string|int, mixed> = array()
list of placeholders: key=name of an url parameter, value=a placeholder name you choose
Tags
Return values
mixed —Search results