Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
pnVarCleanFromInput oddity
  • Posted: 26.07.2006, 00:57
     
    madmoravian
    rank:
    Freshman 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?

  • Posted: 26.07.2006, 02:32
     
    madmoravian
    rank:
    Freshman 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.
  • Posted: 26.07.2006, 20:58
     
    madmoravian
    rank:
    Freshman 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
  • Posted: 27.07.2006, 10:36
     
    personofinterest
    rank:
    Softmore Softmore
    registered:
     April 2006
    Status:
    offline
    last visit:
    17.01.07
    Posts:
    73
    Just out of curiosity, why are you using 'list' when you're only getting one val? Why not just:

    Code

    $hector = pnVarCleanFromInput('hector');
  • Posted: 27.07.2006, 13:14
     
    rank:
    Moderator 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
  • Posted: 27.07.2006, 22:09
     
    madmoravian
    rank:
    Freshman 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.

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula