The generation of links or URLs is as old as the history of the dynamic web applications themselves. The requirement for such a tool is easy compared with the complexity of the implemention: manipulate existing URLs to generate new ones. This functionality is included in the LinkHandler component of the adventure php framework. The class gives the opportunity to deal with URLs and alter or delete their paramaters.
The following example shows the case of generating a link for a button in the guestbook application included in this page. There a basic URL taken from the $_SERVER array is processed by the generateLink method. The second parameter of the LinkHandler's function indicates the parts of the URL that should be added or replaced by the given key-value-array. The source code of your application may therefore contain the following lines:
$id = '4711';
echo LinkHandler::generateLink(
$_SERVER['REQUEST_URI'],
array(
'view' => 'deleteentry',
'entryid' => $id,
'action' => ''
)
);import('tools::link','LinkHandler');