by
KK » Mon Mar 18, 2019 2:41 pm
Hi,
No such tag in the core but it should be easy to create a custom one.
Please paste the following in your 'couch/addons/kfunctions.php' file (if the file does not exist, rename the 'kfunctions.example.php' to it) -
- Code: Select all
// TAG: <cms:admin_create_link />
// outputs 'create page' admin link
$FUNCS->register_tag( 'admin_create_link',
function( $params, $node ){
global $FUNCS, $CTX, $AUTH;
if( count($node->children) ) {die("ERROR: Tag \"".$node->name."\" is a self closing tag");}
// if current user is not an administrator or template is non-clonable, return.
if( $AUTH->user->access_level < K_ACCESS_LEVEL_ADMIN || $CTX->get('k_is_list_page')) return;
$nonce = $FUNCS->create_nonce( 'create_page_'.$CTX->get('k_template_id') );
$link = K_ADMIN_URL . K_ADMIN_PAGE . '?o='. $CTX->get('k_template_name') .'&q=create/'. $nonce;
return $link;
});
And now you should have a new tag named <cms:admin_create_link /> ready for use e.g.
- Code: Select all
<a href="<cms:admin_create_link />">Create a new page</a>
Hope this helps.