[英]how can i add a delete link/button option in a drupal 6 module?
$block_content = l('delete', 'onthisdate/'.$links->cid);
I have used this l()
function to create a delete link but after clicking this delete link how can i delete a data from my database. 我已经使用此
l()
函数创建了一个删除链接,但是单击此删除链接后,如何从数据库中删除数据。 I want to delete data for $cid
that means if $cid=1
then row 1 will be deleted. 我要删除
$cid
数据,这意味着如果$cid=1
则将删除第1行。 I will wait for your easiest answer please. 我将等待您最简单的回答。
You need to create a hook_menu implementation in your module that maps the 'onthisdate/%cid' URL to a function to handle the database deletion, similar to the example below from the User Badges module : 您需要在模块中创建一个hook_menu实现,该实现将'onthisdate /%cid'URL映射到处理数据库删除的功能,类似于下面的用户徽章模块示例:
$items['admin/user/user_badges/delete/%'] = array(
'title' => 'Delete badge',
'page callback' => 'drupal_get_form',
'page arguments' => array('user_badges_delete_form', 4),
'access arguments' => $access,
'type' => MENU_CALLBACK,
'file' => 'user_badges.admin.inc',
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.