cal error in list view

keith21

Member
Hi
I am using the cal element although I keep getting an error masage in list view.
error messaage>>>>>>>>

Notice: Trying to get property of non-object in C:\xampp\htdocs\xampp\eops\plugins\fabrik_element\calc\calc.php on line 377


code used in cal>>>>>>>>>>>>

$element = '{prbi___TCDate}';
$olddate = substr($element,0,10);
$newdate = date('Y-m-d');
if ($olddate > $newdate) {return "red";}
elseif ($olddate < $newdate) {return "green";}
else {return "orange";}
 
Which exact Fabrik version are you running (download/Joomla updates or GitHub)?
Is the calc plugin from the same code version?
The error line doesn't match the current (GitHub) code.
 
Which exact version?
Go to ExtensionsManager/Manage and "refresh cache" on all Fabrik plugins.
 
Oh, yes, I think I've seen this before.

You shouldn't use $element in your code.
It's overriding Fabrik's $element so $element->name (line 377 in vanilla 3.3.2 calc.php) is undefined (I think).
 
One of the inherent problems with eval() in PHP.

I strongly recommend prepending any variable you create with something unique, like 'my' ($myelement, $mydb, $myuser, etc). We can (pretty much) guarrantee nothing in Fabrik will start with $my, as that's kind of a convention for avoiding clobbering other peoples stuff in things like evals.

I'll add something to the Wiki about this.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top