我有一个cck节点类型,它包含对节点库类型的节点引用。由于我不想为我拥有的CCK节点创建一个新的画廊,所以我想做一些休闲活动。在显示cck节点的页面中;
如果给定节点存在库引用,则显示指向该库的链接。如果不存在图库,我想显示一个链接“添加图库”,理想情况下,这将通过程序创建一个新的图库节点和引用。我还想自动填充标题以及作者信息(不允许用户访问)。我在drupal.org上找了很多信息,但都找不出来。
谢谢
我有一个cck节点类型,它包含对节点库类型的节点引用。由于我不想为我拥有的CCK节点创建一个新的画廊,所以我想做一些休闲活动。在显示cck节点的页面中;
如果给定节点存在库引用,则显示指向该库的链接。如果不存在图库,我想显示一个链接“添加图库”,理想情况下,这将通过程序创建一个新的图库节点和引用。我还想自动填充标题以及作者信息(不允许用户访问)。我在drupal.org上找了很多信息,但都找不出来。
谢谢
<?php
$node_A = node_load($some_nid);
if(empty($node_A->field_type_gallery_node_ref[][ nid ] )// imp point this field is an array
{
//link to add gallery page
//call a function for creating a node of gallery and return the nide and you can pass //parameters like nid of A etc..then return the new node from the function
$node_GALLERY = get_gallery_node_new($node_A->nid);
$node_type_A->field_type_GALLERY_node_ref[][ nid ] = $node_GALLERY;
}
else
{
//display this gallery
}
?>
要获取当前节点的nid:
<?php
if (arg(0) == node && is_numeric(arg(1)))
$nodeid = arg(1);
?>
或者使用CCK A的任何字段值(您知道)并应用与节点表的联接
$nid_ref_query = SELECT nid FROM `content_type_A` cto join node n on cto.nid=n.nid where cto.field_some_field_you_know = . $something;
$nid_array = db_fetch_array(db_query($nid_ref_query));
$nid = $nid_array[ nid ];
I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...
<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...
I found this script online that creates a thumbnail out of a image but the thumbnail image is created with poor quality how can I improve the quality of the image. And is there a better way to create ...
如何确认来自正确来源的数字。
Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...
I wonder there is a way to post a message to a facebook business page with cURL? thanks
I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...
How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...