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

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
yabune
Forum Members
Forum Members
Posts: 40
Joined: Wed Dec 05, 2007 7:28 pm

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

Post 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!
Last edited by yabune on Sat Oct 04, 2008 1:15 pm, edited 1 time in total.
yabune
Forum Members
Forum Members
Posts: 40
Joined: Wed Dec 05, 2007 7:28 pm

Re: Problems in admin after upgrade to 1.4.1

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Problems in admin after upgrade to 1.4.1

Post by calguy1000 »

$id is a reserved variable.
don't use it in your actions.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
yabune
Forum Members
Forum Members
Posts: 40
Joined: Wed Dec 05, 2007 7:28 pm

Re: Problems in admin after upgrade to 1.4.1

Post 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?
yabune
Forum Members
Forum Members
Posts: 40
Joined: Wed Dec 05, 2007 7:28 pm

Re: Problems in admin after upgrade to 1.4.1

Post 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!
Post Reply

Return to “CMSMS Core”