In Drupal 6, you could node_load( array( 'title' => 'node title', 'type' => 'page' ) Is there something similar in D7? It seems to force you to know the NID. I need to load by node title.
This is actually for a Panel context, which is NID also, so I was going to make a new argument for Node Title. I think there is a Views Context, but I don't fully grasp that right now, so I haven't really looked into it. Suggestions?
Joel Willers
In Drupal 6, you could node_load( array( 'title' => 'node title', 'type' => 'page' ) Is there something similar in D7?
See http://stackoverflow.com/questions/4709483/how-should-i-get-the-value-contai...
Fred
You can do that with node_load_multiple:
http://api.drupal.org/api/drupal/modules--node--node.module/function/node_lo...
The conditions are going away in the future though. You're best off to use EntityFieldQuery:
http://drupal.org/node/1343708
Jamie Holly http://www.intoxination.net http://www.hollyit.net
On 1/23/2012 4:32 PM, Joel Willers wrote:
In Drupal 6, you could node_load( array( 'title' => 'node title', 'type' => 'page' ) Is there something similar in D7? It seems to force you to know the NID. I need to load by node title.
This is actually for a Panel context, which is NID also, so I was going to make a new argument for Node Title. I think there is a Views Context, but I don't fully grasp that right now, so I haven't really looked into it. Suggestions?
Joel Willers
Are you sure you don't have the nid somewhere? How did you get to the Panel without it?
The problem with using the title is the node's title need not be unique. What are you going to do if there are two nodes with the same title? Yes, you could use the Views context - it's really not difficult if you read the form descriptions.
Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
From: Joel Willers
In Drupal 6, you could node_load( array( 'title' => 'node title', 'type' => 'page' )
Is there something similar in D7? It seems to force you to know the NID. I need to load by node title.
This is actually for a Panel context, which is NID also, so I was going to make a new argument for Node Title. I think there is a Views Context, but I don't fully grasp that right now, so I haven't really looked into it. Suggestions?
I’m trying to create a page that accepts the title of a content type as an argument: example.com/type/title_of_node/option and I want to be able to have the node editable on each of the options pages.
For instance: example.com/type/title_of_node will show the base node. example.com/type/title_of_node/images will show the description, plus an image gallery of all associated images, with the ability to edit the node. example.com/type/title_of_node/videos will be similar, showing video gallery, with the ability to edit the node.
I can’t send the node ID, it has to be the node title. Any other thoughts for a solution?
Joel
From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Ms. Nancy Wichmann Sent: Monday, January 23, 2012 9:39 PM To: support@drupal.org Subject: Re: [support] node_load in Drupal 7
Are you sure you don't have the nid somewhere? How did you get to the Panel without it?
The problem with using the title is the node's title need not be unique. What are you going to do if there are two nodes with the same title? Yes, you could use the Views context - it's really not difficult if you read the form descriptions.
Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
________________________________ From: Joel Willers In Drupal 6, you could node_load( array( 'title' => 'node title', 'type' => 'page' ) Is there something similar in D7? It seems to force you to know the NID. I need to load by node title.
This is actually for a Panel context, which is NID also, so I was going to make a new argument for Node Title. I think there is a Views Context, but I don't fully grasp that right now, so I haven't really looked into it. Suggestions?
Pathauto?
Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
From: Joel Willers
I’m trying to create a page that accepts the title of a content type as an argument: example.com/type/title_of_node/option and I want to be able to have the node editable on each of the options pages. For instance: example.com/type/title_of_node will show the base node. example.com/type/title_of_node/images will show the description, plus an image gallery of all associated images, with the ability to edit the node. example.com/type/title_of_node/videos will be similar, showing video gallery, with the ability to edit the node. I can’t send the node ID, it has to be the node title. Any other thoughts for a solution?
I’m using Pathauto. It does annoying things like removing the periods in titles, so Dr. Martin L. King, Jr. turns into dr_martin_l_king_jr which, then, can’t be used as a Title Argument in Views. Every avenue I’ve explored so far has been a bit of a failure.
Joel
From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Ms. Nancy Wichmann Sent: Tuesday, January 24, 2012 8:20 AM To: support@drupal.org Subject: Re: [support] node_load in Drupal 7
Pathauto?
Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
________________________________ From: Joel Willers
I’m trying to create a page that accepts the title of a content type as an argument: example.com/type/title_of_node/optionhttp://example.com/type/title_of_node/option and I want to be able to have the node editable on each of the options pages.
For instance: example.com/type/title_of_nodehttp://example.com/type/title_of_node will show the base node. example.com/type/title_of_node/imageshttp://example.com/type/title_of_node/images will show the description, plus an image gallery of all associated images, with the ability to edit the node. example.com/type/title_of_node/videoshttp://example.com/type/title_of_node/videos will be similar, showing video gallery, with the ability to edit the node.
I can’t send the node ID, it has to be the node title. Any other thoughts for a solution?
You can tell it not to do that, but then the setting affects all nodes. You'll also have to change the replacement character to +.
You can also code a hook_node_insert() to create special URL aliases.
Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
From: Joel Willers
I’m using Pathauto. It does annoying things like removing the periods in titles, so Dr. Martin L. King, Jr. turns into dr_martin_l_king_jr which, then, can’t be used as a Title Argument in Views. Every avenue I’ve explored so far has been a bit of a failure.
Thanks! I think the pathauto punctuation changes will do the trick! I still wish I could have figured out how to add a custom Argument into Panels, though. I added a .inc file, but it basically ignored it. Google wasn’t much help, either. Perhaps my Google Fu is too weak. Still, Views gave me a solution.
Thanks for the help!
Joel
From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Ms. Nancy Wichmann Sent: Tuesday, January 24, 2012 9:34 AM To: support@drupal.org Subject: Re: [support] node_load in Drupal 7
You can tell it not to do that, but then the setting affects all nodes. You'll also have to change the replacement character to +.
You can also code a hook_node_insert() to create special URL aliases.
Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
________________________________ From: Joel Willers
I’m using Pathauto. It does annoying things like removing the periods in titles, so Dr. Martin L. King, Jr. turns into dr_martin_l_king_jr which, then, can’t be used as a Title Argument in Views. Every avenue I’ve explored so far has been a bit of a failure.