【发布时间】:2015-11-25 13:14:29
【问题描述】:
我需要我的节点有多个别名,例如 www.example.com/1/title-of-node。应由 www.example.com/2/title-of-node 或 www.example.com/3/title-of-node 打开。 drupal 中是否存在任何功能? Pathauto 不提供此功能。
【问题讨论】:
标签: drupal-7 alias drupal-views
我需要我的节点有多个别名,例如 www.example.com/1/title-of-node。应由 www.example.com/2/title-of-node 或 www.example.com/3/title-of-node 打开。 drupal 中是否存在任何功能? Pathauto 不提供此功能。
【问题讨论】:
标签: drupal-7 alias drupal-views
为此,您必须创建一个自定义模块,我正在编写下面的伪代码
step1 : create a custom trigger in module
step2 : write db_insert query in a function which will be call just after a node is saved in trigger
db_insert 代码如下
$nid = db_insert('url_alias')
->fields(array(
'alias' => 'another alise',
'source' => 'node/'.$node->id,
))
->execute();
在drupal url_alise 表中可以重新使用以保持alise 相对于节点。
【讨论】: