I'm writing a hack of sections to create a library for my site and I ran into a weird error tonight.
Each "creator" entry has a unique assigned to the cid column in the table and you click on that to bring up a full view of that entry
here's the "list" view
http://altertainment.net/Library-req-creatorsrecent.html
and here's a full view
http://altertainment.net/index.php?name=Library&req=creatorsview&cid=9
(i took off short urls wondering if it was the problem but i don't think it is)
For some reason I can't deduce, cid is only passing 1 digit in postnuke. (the column in mySQL set is "pn_cid int(11) No auto_increment")
As my entries into the cid column went to 10, 11, 12, etc my admin.php side put in the date just fine - but on the index.php side in trying to show full view you can put in any number you want for cid in the URL, but it will only look at 1-9 (well I didn't test 0)
so
http://altertainment.net/index.php?name=Library&req=creatorsview&cid=955
is the same as
http://altertainment.net/index.php?name=Library&req=creatorsview&cid=9
I can post code for my index.php file but is there any obvious "duh" reason for why this is happening?
Help! :0
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- internetking created topic »password problem« 10:33 PM
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 07:01 AM
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 06:41 AM
- ehdwma created topic »Hide "Register new account" and change template to 3 col« 06:27 AM
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 01:29 AM
- mdee created topic »How to implement returnpage ?« 01:00 AM
- nestormateo responded to »Fillters in Clip« 24. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Odd Problem with String only passing 1 digit
-
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
The usual cause of this is mis-using list and pnVarCleanFromInput. In many places in the code we have list ($var1, $var2, ....) = pnVarCleanFromInput('var1', 'var2') so for one variable people have list($var) = pnVarCleanFromInput('var') but this is incorrect.
pnVarCleanFromInput only returns an array when more than one variable is passed in otherwise it returns the value of the variable. When you use list with only one variable to pnVarCleanFromInput the result is then extracted as an array - a string is an array of characters hence you get the first character your expected var.
For a single variable use $var = pnVarCleanFromInput('var');
-Mark
--
Visit My homepage and Zikula themes. -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
There are two reasons I know this...
1) being familiar with the code (obviously)
and
2) it was one of my first mistakes when I started coding PN modules a while ago now.....
-Mark
--
Visit My homepage and Zikula themes. -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
A search for 'pnvarcleanfrominput' and 'first character' (using search for all terms) turns up a few occasions where i've discussed this before.
-Mark
--
Visit My homepage and Zikula themes. -
- Rank: Expert
- Registered: Nov 23, 2003
- Last visit: Dec 13, 2009
- Posts: 1487
I have seen a few posts regarding the same issue (been there myself... drove me mental), it's just a hard one to search for since all the terms you would use are common to so many other problems people run into.
--
Under Construction! -
**unknown user**
- Rank: Freshman
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 56
I didn't search for "first character' because I didn't have a clear grasp of what my problem was when I searched. That is always the hardest thing - to figure out what is the right question you should be asking! :) -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
Absolutely - getting the search terms is always a little difficult if you don't know what the problem is.....
However i'd suggest using the forum filter and filtering things to just the dev forum as this will substantially narrow your result set.
-Mark
--
Visit My homepage and Zikula themes. -
- Rank: Legend
- Registered: Dec 11, 2002
- Last visit: Oct 21, 2009
- Posts: 11674
Well, expect it to be part of the Knowledgebase on the new site, I've made a mental note of this one :)
--
itbegins.co.uk - Zikula Consulting
birtwistle.me.uk - Personal Blog
Please read the Support Guide
- Moderated by:
- Support
