简体   繁体   中英

Get nid from node table in Drupal 6

I am new in Drupal and using Drupal6. I need a help to get "nid" field from "node" table.

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.

I understand that the array name is $row and it contains the data. But i couldn't find from where this $row comes, so I couldnt edit $row. Currently "nid" is not included in that array, see -

[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 -

[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. I think from admin side we can manage the fields in $row OR can we pragmatically do this ?

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. $row is basically the data views generate for a single row. After doing this you will have nid in the $row variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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