drupal一些系统的常用函数

print  l(taxonomy_term_load($data->field_resource_type['und'][0]['tid'])->name, 'taxonomy/term/'.$data->field_resource_type['und'][0]['tid']); 读取节点分类 
读取节点的TAG(标签)
print module_invoke('thinkin', 'node_tags',$data->nid);


function thinkin_node_tags($nid)
{
$query = db_select('field_data_field_tags','t')
      -> fields('t', array('field_tags_tid'))
  -> condition('t.entity_id', $nid);
$t = $query->execute()->fetchAll();
$tids = '';
$d = '';
foreach ($t as $ob)
{ 
$tids .= $d . $ob -> field_tags_tid;
$d = ',';
} 
$tids = explode(",", $tids); 
 
$query = db_select('taxonomy_term_data','t')
      -> fields('t', array('tid','name'))
          -> condition('t.tid', $tids, 'IN')
  -> condition('t.vid', 1);
$t = $query->execute()->fetchAll();
$tags = '';
foreach ($t as $ob)
{ 
   //$name = trim($ob -> name);//去掉头尾空格
   //$name = preg_replace('/\s(?=\s)/', '', $name);//去掉重复空格
   //$name = preg_replace('/[\n\r\t]/', ' ', $name);//将非空格变成空格
   //$name = str_replace(' ', '-', $name);
$name = $ob -> name;
$tags .= l($ob -> name, 't/'.$name, array('attributes' => array('class' => 'post-tag')));
} 
return $tags; 
}

print image_style_url('center',$userpic->picture->uri);读取图片地址

functon uqdev_index_website(){}
$website=module_invoke('uqdev','index_website');    读取模块里面自定义的方法

image_style_url('center','图片地址')  原图裁剪之后的效果,center是图片定义的样式
libraries_get_path('pclzip'); 获取libraries路劲
 
file_create_url  将private://themefile/Download.zip类似地址的路径转换成正常的文件地址

转载于:https://my.oschina.net/haojay/blog/94827

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值