If I create a block and add links to nodes using the node name such as node/1. When I click it it goes to that link and displays in title bar. However I have pathauto on so when I click from a primary link it goes to the aliased name. So how do I make the link so that it will change if the alias of the node changes and that the link actually uses the alias name instead?

I seen one post where someone mentioned using this. However I have no idea what this is used for or how to use it if this will work for me. print l(t('link text', "node/$nid");

Thanks for your help

Comments

vm’s picture

If using links, ala menus, why not use drupal's menu system? for these blocks? then if the alias changes your menus are updated with those changes.

creating a new menu, automagically creates a new block to be added to regions in administer -> blocks

grobemo’s picture

You're on the right track: <?php print l('link text','node/123'); ?> will do what you want. It uses Drupal's l() function, which returns a formatted link, handles aliases, etc. Take a look at the Drupal API page for l() for details.

jpietrowiak’s picture

I want to assign a node to multiple menus for the site and as far as I can tell I can only do one. So thats part of it as well as putting links within my content to a node. My question in using l($text, $path, $options = array()) is how and where do I put my link is it something link this? l(My URL link, node/1, $options = array()) or do I have to put that entire code that is in the API link you posted?

Thanks