Page 1 of 1

CreateFrontendLink & params problem

Posted: Mon Jan 11, 2010 11:04 am
by kochiro
I have a while loop to list records in a database table.  On each record I have an edit link.  I am creating that link with the following code:

$rec->edit = $this->CreateFrontendLink($row['id'], $returnid, 'add_edit', $this->Lang('edit'), array('id'=>$rec->id));

However, when the link is clicked the only variable that is in $params on the destination page is the action parameter which contains a value of "add_edit".  It should also contain the "id" parameter that is specified as the 5th parameter of CreateFrontendLink, shouldn't it?

The url does contain the id value however, in the example below it is "2".

http://..........moduleinterface.php?mact=ModuleName,2,add_edit,1&sp_=8dfc6a67

Additionally if I output "$id" it always has a value of "m1_" regardless of what record I choose to edit.

Why isn't the id inside of the $params array?  How do I access it?

Thanks,
Jay

Re: CreateFrontendLink & params problem

Posted: Tue Jan 12, 2010 5:50 pm
by tripp
what happens if you var_dump the $params array? Is there anything inside it?

Re: CreateFrontendLink & params problem

Posted: Wed Jan 13, 2010 3:34 pm
by milehigh
The first parameter of CreateFrontendLink is the module ID.

You need something more along these lines:

CreateFrontendLink($id,$returnid, 'add_edit', $this->Lang('edit'), array('recordID'=>$row['id']));