How to call a SPECIFIC field value?

More
14 years 3 months ago #3268 by ComposerRyan
I was wondering, if I created a text field called "mytestfield" how would I go about calling that SPECIFIC field in my template?

I need to be able to do this for specific reasons...

Thanks for your help!

Ryan

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

More
14 years 3 months ago #3269 by ComposerRyan
Did a quick search of these forums and found this...I haven't tried it, but will let you know if it works:

Re: calling a field to the template

by yopyop001 » Mon 11 Jan 2010 10:16

Hi,

You can call a field in your template with the code

Code: Select all
<?php echo $this->fields->display; ?>



And

Code: Select all
<?php echo $this->fields->label; ?>

for the label of the field if you want to display it.

I hope it's what you were looking for.

Regards

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

More
14 years 3 months ago #3273 by ComposerRyan
It appears to be working, however when grabbing an image it only grabs the medium sized thumbnail. Here is the code I am using to grab a SPECIFIC image field:

<?php echo $this->fields->display; ?>


I want to be able to tell it to grab either the large, medium, or small image. How can I do that? Thanks for the help.

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

More
14 years 2 months ago #3631 by brandonroot
I'm also trying to figure out how to do this. Help!

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

More
13 years 7 months ago #10193 by ComposerRyan
I am actually starting on a new project and was wondering if anyone ever figured this out?

Thanks for your help and for such an awesome component!

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

More
13 years 7 months ago #10196 by yopyop001
Hi,

Here is a way to get the src of an image field in the file item.php of your template :
Code:
if (isset($this->fields['field_name']->value[0])) : $dir = $this->fields['field_name']->parameters->get('dir'); $value = unserialize($this->fields['field_name']->value[0]); $image = $value['originalname']; $src_small = $dir.'/s_'.$image; $src_medium = $dir.'/m_'.$image; $src_large = $dir.'/l_'.$image; endif;

So you can call the image you want to display using
Code:
<img src="<?php echo $src_... ?>... />

regards

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.471 seconds
Save
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