I've managed to retrieve a custom set of nodes, and now I'm trying to link to the nodes themselves.

Effectively, I'm trying to accomplish a derivative of the following:
http://drupal.org/node/63683

In the above example, as the results are looped through, the links are built by using node.nid. I would like to build these links by using the path alias instead.

I've tried using path_load and providing node.nid as an argument. However, this is a terribly inefficient, not to mention a non-working solution (since by the time the a query from a path_load gets executed, the main loop already done printing the results).

How can one modify the page snippet mentioned above to link to the results with path aliases instead of "/node/##"?

Thanks for your help.

Comments

nevets’s picture

Where the example you point to has

<a href=\"node/$node->nid\"> $node->title </a> 

replace that with

<?php print l($node->title, "node/$node->nid"); ?>

and you will end up with alias if there is one.