This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Fogpuppy
Hi,
I'm probably being really dumb but ... how do I separate out a "common" bit of code that is needed in multiple functions. For example:
function onBtn1 () {
$var = input ('form1-text');
doCommonStuff();
}
function onBtn2 () {
$var = input ('form2-txt');
doCommonStuff();
}
function doCommonStuff () {
this['var'] = $var;
... other stuff
}
And is this the right ay to get "parameters" into the common code?
mjauvin
function onBtn1 () {
$var = input ('form1-text');
doCommonStuff($var);
}
function onBtn2 () {
$var = input ('form2-txt');
doCommonStuff($var);
}
function doCommonStuff ($var) {
$this['var'] = $var;
... other stuff
}
Fogpuppy
ok that makes sense but I'm getting an error of "Call to undefined function doCommonStuff()" on line 52 of /var/www/html/storage/cms/cache/76/67/test-update.htm.php"
but the function is defined in the page code section along with what's calling it. How can it be undefined?
1-5 of 5