简体   繁体   English

从Drupal 6中的节点表获取nid

[英]Get nid from node table in Drupal 6

I am new in Drupal and using Drupal6. 我是Drupal的新手,正在使用Drupal6。 I need a help to get "nid" field from "node" table. 我需要帮助才能从“节点”表中获取“ nid”字段。

I have added some data in node table from admin side. 我已经从管理员端在节点表中添加了一些数据。 Currently it is listed in view.tpl page page perfectly.For some other needs I need to get "nid" also. 目前,它在view.tpl页面的完美页面中列出。对于其他一些需求,我还需要获取“ nid”。

I understand that the array name is $row and it contains the data. 我知道数组名称是$ row并且它包含数据。 But i couldn't find from where this $row comes, so I couldnt edit $row. 但是我找不到$ row的来源,所以我无法编辑$ row。 Currently "nid" is not included in that array, see - 目前,该数组中不包含“ nid”,请参见-

[0] => Array
    (
        [created] => 09-11-11
        [title] => Co-Sponsors Golf Events
    )

[1] => Array
    (
        [created] => 09-09-12
        [title] => Co-Sponsors Golf Events2
    ) 

I want to include node id in $ row, like this - 我想在$行中包含节点ID,像这样-

[0] => Array
    (
        [created] => 09-11-11
        [title] => Co-Sponsors Golf Events
        [nid] => 3748
    )

[1] => Array
    (
        [created] => 09-09-12
        [title] => Co-Sponsors Golf Events2
        [nid] => 3747
    ) 

I tried admin side of D-6 (content management>content type>edit , then manage field), but I couldn't find any option. 我尝试了D-6的管理端(内容管理>内容类型>编辑,然后管理字段),但找不到任何选项。 I think from admin side we can manage the fields in $row OR can we pragmatically do this ? 我认为从管理员的角度来看,我们可以管理$ row中的字段,还是可以实用地做到这一点?

Please let me know if my question is not clear and help me with detail description 如果我的问题不清楚,请告诉我,并向我提供详细说明

Are you using views module to get the data?..Which page is this content displayed. 您是否正在使用视图模块获取数据?..显示该内容的页面。 This is most probably a view page and to get the nid in the template, you need to edit the corresponding view (you need to figure out which view is generating the content) and add a field content: nid there. 这很可能是一个视图页面,要使nid进入模板,您需要编辑相应的视图(您需要弄清楚哪个视图正在生成内容)并在其中添加字段内容:nid。 $row is basically the data views generate for a single row. $ row基本上是为单行生成的数据视图。 After doing this you will have nid in the $row variable. 完成此操作后,您将在$ row变量中添加了nid。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM