[development] node_load using cck fields
guillaume at resist.ca
Tue Mar 22 16:55:55 UTC 2011
-----BEGIN PGP SIGNED MESSAGE-----
That will work in most cases, but if you ever re-use one of the fields
of the date content type with another content type, the field will be
moved to its own table (content_field_date). The safe way is really of
using views, or node_load, but there are obvious scalability issues
with foreach($a = node_load($nid++)), because they are really
independant of the content_type current structure. See
http://groups.drupal.org/node/10129 for more details.
On 11-03-22 09:47 AM, Steve Edwards wrote:
> Here is the magic incantation:
> On Mar 22, 2011, at 9:45 AM, larry at garfieldtech.com wrote:
>> You can only load nodes in D6 individually by ID. However, you
>> can run raw SQL queries to find nodes meeting certain criteria,
>> then run node_load() on those IDs. I forget the functions off
>> hand but there is a magic incantation to get the right field
>> column info and build a query string yourself.
>> That said, if you're going to be displaying the node(s) then just
>> use Views. It will take much less time and be much more stable,
>> and offer better theming options.
>> In Drupal 7, you'd either use Views or the new EntityFieldQuery.
>> --Larry Garfield
>> On 3/22/11 11:40 AM, Lluís Forns wrote:
>>> I want to load a node using cck fields instead of nid or core
>>> Is there a "no-sql" way of doing this? I have read that maybe I
>>> could achieve it using views, but I think it would be an
>>> What I want to achieve is something like this:
>>> $inscripcio = node_load(array( 'type' => 'inscripcio',
>>> 'field_alumne' => $nid_alumne, 'field_convocatoria' =>
>>> $nid_convocatoria, ));
>>> any hint?
>>> If I could get which tables use a cck type and how to join
>>> them, maybe I could code a "generic" way to do this, so if
>>> cck-type is changed, there is no problem.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the development