How to display a field in a module template?

More
5 years 10 months ago #78588 by grabit
I need to display a field in a A tag around my item the href of the link is in a field called "slideshow-link".

As I have also other custom fields displayed elsewhere, I planned to write the link directly in the template but it is not rendering.

I used that method:
Code:
<?php $myfield_html = FlexicontentFields::getFieldDisplay($item, 'slideshow-link'); echo '<a class="uk-cover-container uk-transition-toggle uk-display-block uk-link-reset" tabindex="0" href="' . $item->fields['slideshow-link']->display .'">'; ?>

The answer for the href is /

Any idea why it is not working?

An Apple a days keeps the doctor away

Please Log in or Create an account to join the conversation.

More
5 years 10 months ago #78590 by micker
hello
1 you need to allow field in module option
2 check the code

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
5 years 10 months ago #78591 by grabit
Where can i allow the field in the module option?

An Apple a days keeps the doctor away

Please Log in or Create an account to join the conversation.

More
5 years 10 months ago #78593 by micker
go to
layout
content via parameters
scroll down to custom field and allow display field

check news.php file to check code
github.com/FLEXIcontent/flexicontent-cck...t/tmpl/news.php#L842
i recommend you create your template output
copy news.php / news.xml and edit file

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
5 years 10 months ago #78595 by grabit
That is what I did. As I need to display other fields I use already that part. My need is to have a link around the item that’s why I did my template like that. My concern is that I followed the tutorial of ggppdk and it is not working. ( www.flexicontent.org/documentation/tutor...to-work-in-v156.html )

An Apple a days keeps the doctor away

Please Log in or Create an account to join the conversation.

More
5 years 10 months ago - 5 years 10 months ago #78597 by ggppdk
Hello

your code for creating field's HTML display looks proper

add this to your template to make sure that the field has values
Code:
print_r($item->fieldvalues[57]);

replace 57 with your field id
- does it show any values ?

Also test this
Code:
print_r($item->fields['slideshow-link']->label);
- does it show field label ?


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
Last edit: 5 years 10 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
5 years 10 months ago #78600 by grabit
Hello I tried your suggestion but it stays empty!

If I put the field in the customs fields part of the layout, I see the value so I am sure that the value exist.

I also use the pro plug-in and hen I created a similar version with substitution and it works.

Code:
<?php echo '<a class="uk-cover-container uk-transition-toggle uk-display-block uk-link-reset" tabindex="0" href="{flexi_field:130 item:'.$item->id.' method:display}">'; ?>

But I prefer to stay with a non pro version.

An Apple a days keeps the doctor away

Please Log in or Create an account to join the conversation.

More
5 years 9 months ago - 5 years 9 months ago #78608 by ggppdk
Hello

so what is the output of the 2 code cases that i gave you above ?
(Also temporarily enable Joomla Debug to see if we get some non-set variable warnings)


add this to your template to make sure that the field has values
Code:
print_r($item->fieldvalues[57]);

replace 57 with your field id
- does it show any values ?

Also test this
Code:
print_r($item->fields['slideshow-link']->label);

- does it show field label ?


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
Last edit: 5 years 9 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
5 years 9 months ago #78616 by grabit
It doesn't output anything but if I put the field in the custom fields, there is an output so I am sure the field is not empty.

If I use the pro feature "content replacement" it works. Where is my mistake?

An Apple a days keeps the doctor away

Please Log in or Create an account to join the conversation.

More
5 years 9 months ago #78633 by ggppdk
Hello

this is strange !
Code:
$item->fieldvalues[NNN]

is always populated, regardless of creating field's display

i would like access to check this


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save