欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

drupal 路径 别名路径

shiping1 的头像
我的方法 根据$term得到 别名路径
<?php   $pathArr=taxonomy_term_uri($continent);$alias= drupal_get_path_alias($pathArr['path']); ?>
这里 alias 就是别名路径


Get the URL of a Node or Term in Drupal 7

Primary tabs
ListView(active tab)
Submitted by geoff on Sat, 2012-04-28 11:33
Given a Node or Taxonomy Term - or any "entity" based object

$uri = entity_uri($entity_type, $entity);
$url = $uri['path'];
When you create a link with the l() function, it will link to the Clean URL for that entity (if one exists).

for a Node
this becomes

$uri = entity_uri("node", $node);
$url = $uri['path'];
of course, you can always just use

$uri = node_uri("node", $node);
$url = $uri['path'];
or even

$url = "node/{$nid}"
for a Taxonomy Term
$uri = entity_uri("taxonomy_term", $term);
$url = $uri['path'];
of course, you can always just use

$uri = taxonomy_term_uri("node", $term);
$url = $uri['path'];
or even

$url = "taxonomy/term/{$tid}"



$_GET['q']!= ‘user/login’
得到 当前的路径  永远都不是别名 ,是真实的原来的路径

加上 arg(0) != 'user'  && arg(1)  != 'login'
这里是参数 永远也不是别名 可能的值是 arg(0) node arg(1) 38


登录后 返回 登录前的页面

//下面这个好像是不对的
drupal_goto('mylogin', array('query'=>drupal_get_destination()) );
加上后面的登录后可以返回登录前页面



普通分类: