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类似地址的路径转换成正常的文件地址

你可能感兴趣的:(drupal)