- Moderated by:
- Support
-
- rank:
-
Freshman
- registered:
- July 2006
- Status:
- offline
- last visit:
- 27.07.06
- Posts:
- 4
I'm trying to create my first module. I'm basing it off of the Example module.
The URL that is causing me a problem is ..../postnuke/html/index.php?module=SpyTools&type=admin&func=modify&hector=zabcde
The problem?
The value for hector after
list($hector)= pnVarCleanFromInput('hector');
is "z". Just one "z". I'm guessing the answer is simple, but my brain is fried and can't come up with possibilities.
Has anyone experienced this before?
-
- rank:
-
Freshman
- registered:
- July 2006
- Status:
- offline
- last visit:
- 27.07.06
- Posts:
- 4
And the problem mysteriously disappeared. I have no idea what, if anything, I changed to get it behave.
Now to figure out why one of my modules is returning the dreaded:
"Error! Sorry! Bad arguments passed to API function" message. -
- rank:
-
Freshman
- registered:
- July 2006
- Status:
- offline
- last visit:
- 27.07.06
- Posts:
- 4
Ok. The problem is back again. I think the disappearance of the problem had to do with re-using the same URL in the browser address bar.
I'm on the admin view page for all of my entries and click on the edit link. The link has the proper value for the element "&name=test", but when I "extract($args)" only one character is extracted.
This is making me wonder if there is a setting, somewhere, that tells it to extract only one character.
I just checked the Example module and it seems to be working ok when the link for edit has a parameter > than 1 character.
Ideas?
*edit*
More information. When the admin function is called to create an item, extract appears to be pulling all of the values properly. They gets stored into the database properly because it is displayed properly on a "view". The link for edit has the whole name, but extract does not extract the whole name from the URL. Just the first letter.
edited by: madmoravian, Jul 26, 2006 - 04:59 PM -
- rank:
-
Moderator
- registered:
- March 2002
- Status:
- offline
- last visit:
- 26.08.08
- Posts:
- 7720
personofinterest
Just out of curiosity, why are you using 'list' when you're only getting one val? Why not just:
Code
$hector = pnVarCleanFromInput('hector');
Which is the exact problem... List breaks that single variable apart as if it where an array. i.e. a string is an array of characters so list puts the first character into the variable.
This issue is a common one and has been covered in the developers forums a number of times.
-Mark
-
- rank:
-
Freshman
- registered:
- July 2006
- Status:
- offline
- last visit:
- 27.07.06
- Posts:
- 4
Uh, because I didn't know better. That's what taking existing code and tweaking without thinking will do to you.
Thanks for the help. My brain and my code thank you.
I apologize for posting a topic that had been covered before. I did search before posting, but didn't find anything.
