继续Drupal分享精神 群已满 站长QQ:532116351【drupal交流+drupal 建站+theme制作】
登录 注册

Drupal 7 外部数据提交node_save

Drupal 7 如果提交到数据库,和drupal 6 基本相同,只是drupal 7 不使用cck, 而是用field ui 模块,
这个模块,只要你建立一个字段,那就自动以一个表形式出现。

<?php

$edit
= array(
   
'status' => 1, //状态为发布
   
'sticky' => 0,//置顶为0
   
'promote' => 0,//推荐到首页为否
   
'comment' => 0,//评论
   
'uid' => 1,//管理员ID
   
'type' => 'shop',//内容类型
   
'title' => '信息标题',// 标题
   
'body' => '这里是正文',
   
'format' => 2,      /* HTML 格式*/
   
'language' => 'und',//语言 
 
);
$edit['字段名称']['und']['0']['value'] = '额外的field ui 字段的值';

$node = (object)$edit;
node_save($node);
?>

评论

发表新评论

  • 自动将网址与电子邮件地址转变为链接。
  • 允许HTML标签:<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • 自动断行和分段。
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

更多关於格式化选项的信息

CAPTCHA
请输入正确答案
Image CAPTCHA
Enter the characters (without spaces) shown in the image.