- Posts: 58
COMMUNITY FORUM
Add custom fields to k2 content module -> Error
- Johann Scharfetter
-
Topic Author
- Offline
- Senior Member
Less
More
11 years 6 months ago - 11 years 6 months ago #120505
by Johann Scharfetter
Add custom fields to k2 content module -> Error was created by Johann Scharfetter
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
Log in or Create an account to join the conversation.
- Vitaly
-
- Offline
- Junior Member
Less
More
- Posts: 24
11 years 6 months ago - 11 years 6 months ago #120506
by Vitaly
Replied by Vitaly on topic Re: Add custom fields to k2 content module -> Error
You can now(ver.2.6.X) just call any extra_field you need via code
Log in or Create an account to join the conversation.
- olsen
-
- Offline
- Elite Member
- Joomla and K2 Freelancer
11 years 6 months ago #120507
by olsen
Didn't solve your issues?? Why dont you consider hire me? Email me or contact me www.xevedigital.com for details
Replied by olsen on topic Re: Add custom fields to k2 content module -> Error
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
Didn't solve your issues?? Why dont you consider hire me? Email me or contact me www.xevedigital.com for details
Please Log in or Create an account to join the conversation.
- Johann Scharfetter
-
Topic Author
- Offline
- Senior Member
Less
More
- Posts: 58
11 years 6 months ago - 11 years 6 months ago #120508
by Johann Scharfetter
Replied by Johann Scharfetter on topic Re: Add custom fields to k2 content module -> Error
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 codeFatal 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
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
11 years 6 months ago #120509
by Yiota
Replied by Yiota on topic Re: Add custom fields to k2 content module -> Error
You are missing a semicolon at the end of your statement. It should be:
<?php echo $item->extraFields->Fecha->value; ?>
Please Log in or Create an account to join the conversation.
- Johann Scharfetter
-
Topic Author
- Offline
- Senior Member
Less
More
- Posts: 58
11 years 6 months ago #120510
by Johann Scharfetter
Replied by Johann Scharfetter on topic SOLVED! Add custom fields to k2 content module
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
Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
11 years 6 months ago #120511
by Yiota
Replied by Yiota on topic Re: SOLVED! Add custom fields to k2 content module
You are right. Didn't see that one.
Glad you worked it out. :)
Glad you worked it out. :)
Please Log in or Create an account to join the conversation.
- baggiesmad
-
- Offline
- New Member
Less
More
- Posts: 15
10 years 6 months ago #120512
by baggiesmad
Replied by baggiesmad on topic Re: SOLVED! Add custom fields to k2 content module
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 codeLog in or Create an account to join the conversation.