If you move the www directory, the drafts will not work because the path to the prepend.inc.php file is hard coded. The _require_prepend.inc.php file was added to PHP_ASSETS, but it is not used by the drafts.

#2 | ‹‹ Qcodo System Message ››

Thursday, April 28, 2011, 9:52 AM PDT

A fix to this issue was posted by Shannon Pekary at https://github.com/qcodo/qcodo/pull/17:

Pull request to fix this. This is my first time doing this. Hope it is correct.

Thanks for the post... but unfortunately, that's not the intention of the _require_prepend.inc.php file that's in PHP Assets. The one in PHP Assets was specifically intended for the PHP Assets themselves (which are “top-level” PHP files called by the webserver directly) to be able to have one place to get to the prepend file. Note that all the PHP Assets call the _require_prepend.inc.php file through a relative path call. Unfortunately, since qcodo hasn't been loaded yet, we do not have access to any of the directory constants like _PHP_ASSETS_, _DOCROOT_, etc.

That being said, I think you bring up a good idea on having the form drafts be able to go to a single “require prepend” file that can be easily found with a relative path call. I think the fix for this would be to have another _require_prepend.inc.php file that exists in the form drafts directory... and then update the templates to simply do a single require line like this:

require(dirname(__FILE__) . '/_require_prepend.inc.php');

And that way, you can move around the includes path to wherever, and only need to update a single file to reflect then new location of the prepend.inc.php file. However, the only caveat is that if you copy/move your form draft file somewhere else, you must make sure to include the a copy of the _require_prepend.inc.php file as well -- an added burden to the developer to need to remember this.

I'm okay with it either way... I'd be curious to here others' thoughts.

I'm sorry to disagree, but I think the solution is not to start a “PHP inclusions inferno”, with extra include files that must be maintained all around (that's a thing to be avoided, in my opinion).

I really see no advantage in updating the framework path in a “prepend” file specific for the drafts. The framework path can be updated in the draft templates themselves (as it is now) and then regenerate the drafts, thus avoiding the extra cost of maintaining another inclusion file.

Submit a Bug Fix
for issue #85

Thank you for helping out the Qcodo Development Framework by submitting a bug fix!

To maintain
quality and consistency in the codebase, all submissions are reviewed before being committed to the core.
In order to ease the review process for the Qcodo administrators, please submit your codefix in one of the following formats: