CreateFrontendLink & params problem

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
kochiro
Forum Members
Forum Members
Posts: 15
Joined: Wed Sep 09, 2009 9:09 pm
Location: Sweden

CreateFrontendLink & params problem

Post 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
Last edited by kochiro on Mon Jan 11, 2010 11:30 am, edited 1 time in total.
tripp
Forum Members
Forum Members
Posts: 10
Joined: Thu Dec 03, 2009 11:23 pm

Re: CreateFrontendLink & params problem

Post by tripp »

what happens if you var_dump the $params array? Is there anything inside it?
milehigh

Re: CreateFrontendLink & params problem

Post 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']));
Post Reply

Return to “Developers Discussion”