K2 v2.6.5
Hi,
I tried to add selected custom fields to k2 content module.
When I do it in item.php or category_item.php it works fine, but when I do it in the content module I get the following error:
Hi,
I tried to add selected custom fields to k2 content module.
When I do it in item.php or category_item.php it works fine, but when I do it in the content module I get the following error:
Fatal error: Using $this when not in object context in /homez.428/monpetit/www/modules/mod_k2_content/tmpl/Talleres-inicio/default.php on line 75
13 years 3 weeks ago #120506
You can now(ver.2.6.X) just call any extra_field you need via code
13 years 3 weeks ago #120507
What vitaly say it is the right way to do it instead call the extrafields by its position on the array.
Anyway if you encounter troubles when calling the extarfield make the call without $this->, i mean like this:
$item->extrafields->ALIAS->name
Anyway if you encounter troubles when calling the extarfield make the call without $this->, i mean like this:
$item->extrafields->ALIAS->name
Topic Author
13 years 3 weeks ago #120508
Thank you for your kind answers.
I tried to do what you suggested, but get errors.
When I put follwoing the code
I tried to do what you suggested, but get errors.
When I put follwoing the code
Notice: Undefined property: stdClass::$extrafields in /homez.428/monpetit/www/modules/mod_k2_content/tmpl/Talleres-inicio/default.php on line 72
Notice: Trying to get property of non-object in /homez.428/monpetit/www/modules/mod_k2_content/tmpl/Talleres-inicio/default.php on line 72
Notice: Trying to get property of non-object in /homez.428/monpetit/www/modules/mod_k2_content/tmpl/Talleres-inicio/default.php on line 72
__________________
When I put follwoing the code
Fatal error: Using $this when not in object context in /homez.428/monpetit/www/modules/mod_k2_content/tmpl/Talleres-inicio/default.php on line 72
Y
13 years 3 weeks ago #120509
You are missing a semicolon at the end of your statement. It should be:
<?php echo $item->extraFields->Fecha->value; ?>
Topic Author
13 years 3 weeks ago #120510
Hello!
It is workin now.
The problem was not the semicolon but the F in extrafields it must be with upper case. 'extraFields'
working code
It is workin now.
The problem was not the semicolon but the F in extrafields it must be with upper case. 'extraFields'
working code
12 years 1 month ago #120512
scharfet wrote:Hello!
It is workin now.
The problem was not the semicolon but the F in extrafields it must be with upper case. 'extraFields'
working code
Log in or create an account to reply.