The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
Help? - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: API (https://forums.formtools.org/forumdisplay.php?fid=17) +--- Thread: Help? (/showthread.php?tid=145) |
Help? - stevenheidel - May 8th, 2009 No matter how much I try to add a single page form through the api it will not work! I am on the first step of the tutorial asking me to add that php code and I always get the error: Fatal error: Call to undefined function ft_api_init_form_page() I have the api installed fine, and the require_once path is correct. Help? RE: Help? - Ben - May 9th, 2009 Hmm... it does *sound* like the require_once() path is incorrect, I must confess. That function is defined in api.php, so if the file is included properly you should never see the error. Try switching between a relative and absolute path and see if that helps. - Ben RE: Help? - stevenheidel - May 9th, 2009 (May 9th, 2009, 12:57 PM)Ben Wrote: Hmm... it does *sound* like the require_once() path is incorrect, I must confess. That function is defined in api.php, so if the file is included properly you should never see the error. That's what I thought too... but, when I changed the path to something I knew was wrong I got this instead: "Warning: require_once(/election/database/global/api/api.php) [function.require-once]: failed to open stream: No such file or directory" So I know the other path was correct (and absolute) Maybe this will help: I'm building my website with a CMS called concrete5 and in order to execute code when I website loads it needs to be part of another function. The entire code is here: PHP Code: <?php Any more thoughts? RE: Help? - Ben - May 9th, 2009 Ah! Any time you include() or require() files you need to use server paths, not URLs. If you can't figure out the right absolute path (I've been there!) try a relative one instead - but make sure its relative from the CALLING page, not the file containing the class. If you're calling that class from multiple pages, you'll need to doctor the class like so: PHP Code: <?php But you'll need to update the relative path in the require_once() call for your setup. What that new code does is always compute the relative path to the api.php file from the file containing the class - not the original file that includes the class file. Jeez that sounds confusing. Paths are always a nuisance to figure out... maybe the absolute path is the simplest! - Ben RE: Help? - stevenheidel - May 9th, 2009 Okay now I've got the paths correct. (Checked by my boss as well). But your script keeps directing the page to error.php, which doesn't exist. Weird? EDIT: Oh I see, formtools directs you to this script when there is an error. Unfortunately, the error.php comes up in the same folder as the page itself, not in the formtools directory. New code: PHP Code: <?php Solved...ish - stevenheidel - May 13th, 2009 So I figured out from the folks at concrete5 (which, apart from being incompatible with formtools, is a great CMS) that all included scripts must be converted to libraries, which is impractical. I simply solved this problem by putting the form in an iframe and all the candidate lists and api stuff in pop-ups, which is fine. It actually makes my site a little more clear. But anyways, thanks for your help, everything is working fine now through my workaround. Sorry about posting in the forum and submitting a bug and sending you an email . (If you do stumble across a solution though, I'd be curious, but as I said I'm 100% fine with my workaround). RE: Help? - Ben - May 13th, 2009 Hey Steven, No worries at all - glad it got solved! And sorry for not responding in the bug tracker or here in the forums earlier. SO little time... I would be interested in learning more about the way concrete5 requires the code, though. Having them as libraries doesn't seem like an outrageous requirement to me. Another chap has been looking into creating Form Tools as a Joomla mod. Depending on how that goes, it may shed some light on solutions for other scripts. I'll be sure to post here if and when that ball gets rolling. All the best - Ben |