Page 1 of 1

[SOLVED] Variables not being posted in module creation...

Posted: Fri Oct 03, 2008 10:30 pm
by yabune
After upgrading to version 1.4.1 I got a strange behaviour in a module I created.

I'm sorry that my explanation will look a bit confused, but it's difficult to describe this kind of problem, but maybe someone had the same kind of problem...

I have two modules created in the same way but one works fine and the other don't.

In the first page of the module I have a list of documents from a table database. Each title of this link has a link so that when I click on it I can edit the document. In this link I pass the id of the document. The problem is that after upgrading the Id can't be read on the other side.

I create the link like this:

Code: Select all

$onerow->categoria = $this->CreateLink($id, 'categorias_edit', $returnid, $row['categoria'], array('categoria_id'=>$row['categoria_id']));
In here the categoria_id is correct.
But when I read the categoria_id on the categorias_edit page with this:

Code: Select all

$params['categoria_id']
categoria_id is empty...

I'm doing the exact same thing in another tab of the module, but the id comes ok, it has a correct value...

Does anyone have any ideia why this happens...

Thank you!

Re: Problems in admin after upgrade to 1.4.1

Posted: Fri Oct 03, 2008 11:41 pm
by yabune
Here it is a better example:

I have the following code:

Code: Select all

$db = &$this->GetDb();
$query= "SELECT * FROM ".TBL_CONTENT." ORDER BY item_order";
$dbresult= $db->Execute($query);

$values = array ();
while ($row= $dbresult->FetchRow()) {
  $onerow= new StdClass();
  $onerow->titulo = $this->CreateLink($id, 'textos_edit', $returnid, $row['content_name'], array('content_id'=>$row['content_id']));
  $values []= $onerow;
}
$smarty->assign('itemcount_values', count($values));
$smarty->assign('items', $values);
The problem I noticed is that for some rows I get a link that doesn't post correctly the content_id.

The links that the id is posted correctly are like this:

Code: Select all

http://www.site.net/admin/moduleinterface.php?mact=MyModule,m1_,textos_edit,0&m1_content_id=15
And the kind of links that don't post the content_id:

Code: Select all

http://www.site.net/admin/moduleinterface.php?mact=MyModule,15,textos_edit,0&15content_id=51
Could it be the fact that in the first kind of links there is a _ after m1, and in the second kind of links there isn't a _ after the 15?


I've noticed also that someone else had this kind of problem recently: http://forum.cmsmadesimple.org/index.php/topic,25411.msg123408.html#msg123408

Thanks

Re: Problems in admin after upgrade to 1.4.1

Posted: Fri Oct 03, 2008 11:44 pm
by calguy1000
$id is a reserved variable.
don't use it in your actions.

Re: Problems in admin after upgrade to 1.4.1

Posted: Sat Oct 04, 2008 12:02 pm
by yabune
calguy1000 wrote: $id is a reserved variable.
don't use it in your actions.
what does that $id means? What do I have to pass?

Re: Problems in admin after upgrade to 1.4.1

Posted: Sat Oct 04, 2008 1:14 pm
by yabune
ok, i found out the problem.

I gave to another variable the name $id and that was changing the reserved word $id value, that is used when creating the link...

Now it's working!

Thanks calguy1000!