Hi,
I want create a back top system using an anchor to back top of the web page.
I create a chunk BackTop with this code
[[BackTop? &docid=`[+id+]`]]
end the snippet BackTop with this code
<?php
$id = (isset($docid)) ? $docid: false;
$output='';
if(is_numeric($id)){
$output = '<div class="back-top"><a href="' . [~$id~] . '#top">Back top</a></div>';
return $output;
}
?>
but when I call the chunk in a page the output is this error:
Parse error: syntax error, unexpected ’[’ in C:\xampplite\htdocs\dmsite\manager\includes\document.parser.class.inc.php(748) : eval()’d code on line 5
I realize that error is [~$id~] in php code but how can I make the path of the link using modx api?
Thanks
___________________________________________________________________
..:: Samuele ::..
Your error is from using a MODx variable [tt][*id*][/tt] in your php code (without putting it inside your quotes like laurentc said). If you want to get the ID in php you need to use this code:
$modx->documentIdentifier;
You can look here for more API functions and variables:
http://wiki.modxcms.com/index.php/API:DocumentParser
"Regret for the things we did can be tempered by time; it is regret for the things we did not do that is inconsolable."
-- Sydney Harris
___________________________________________________________________
..:: Samuele ::..