Thanks everybody for the help, but it still not working...so I think I forget it !
Anyway perhaps this portion of code will help someone one day...
In the code above the line: $url = $modx->makeUrl([~id~], '', '', 'full'); should be $url = $modx->makeUrl([+id+], '', '', 'full');
[~[+id+]~]