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 fields.

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 overkill.

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.

Reply via email to