Any experts using the l() function in a php script?

Events happening in the community are now at Drupal community events on www.drupal.org.
bobmct's picture

I figure a few more questions by me and our group will be well on its way to its own wiki!!!

I'm trying to resurrect a custom view that output pages (of course) and many of the fields have links back to their source. The code is using the l() function.

From the Drupal docs and discussions of this function I've tried two ways to call it and both don't return the correct link content. Here are the two way's I've tried it:

1st way:

$L1 = l('Instructor, $p, array(), "f=".$f."&a=".$a."&s=0&o=".$ag);

2nd way:

$L1a = 'Instructor';
$L1b = "f=".$f."&a=".$a."&s=0&o=".$ag;
$L1 = l($L1a, $p, array(), $L1b);

Both result in links that only reference what is in parameter 1. The variable $p as well as the other fields are
defined as thus:

$p = drupal_get_path_alias(arg(0) ."/". arg(1));
$s = $_GET['s']; // sort
$o = $_GET['o']; // order
$f = $_GET['f'];  // filter
$a = $_GET['a']; // argument

Again, the href's generated read

'<a href="Instructor">

and that's it.

What is desired is something like this:

'<a href="/content/exam_archive_view?f=&a=&s=0&o=2">Instructor</a>'

Has anyone had enough experience with the l() function to explain further? Sometime hearing from a guru helps a tremendous amount.

Thanks

Comments

What version of Drupal are

rolodmonkey's picture

What version of Drupal are you using? The arguments you list look like they are for version 5. The arguments have changed for 6 & 7.

http://api.drupal.org/api/drupal/includes!common.inc/function/l/6
http://api.drupal.org/api/drupal/includes!common.inc/function/l/7

Learn more at iRolo.net.

Connecticut

Group categories

County or Region

Event Type

Featured Item (Admin Only)

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: