calling a field to the template

More
16 years 3 weeks ago #2529 by Jay
Hi. i would like to get some idea whats the code or format to call a specific field to the template.

i am aware that the drag n drop template, i would like to know how to customize certain fields only.

example if i have field map,gallery,contact us in the same divs i would like to design three of them differently

pls advice with a sample code.
thanks.

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

More
16 years 3 weeks ago #2532 by yopyop001
Hi,

You can call a field in your template with the code
Code:
<?php echo $this->fields['field_name']->display; ?>

And
Code:
<?php echo $this->fields['field_name']->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
16 years 3 weeks ago #2535 by Jay
Replied by Jay on topic calling a field to the template

yopyop001 wrote: Hi,

You can call a field in your template with the code

Code:
<?php echo $this->fields['field_name']->display; ?>

And
Code:
<?php echo $this->fields['field_name']->label; ?>
for the label of the field if you want to display it.

I hope it's what you were looking for.

Regards


execellent fast reply
i will try and let you know.
thanks again.

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

More
15 years 10 months ago #4983 by tcherno
Hello!

This works for the "item" template, but doesn't opperate on the "category_item" view. I just see nothing, except my empty divs and spans...

How can we call specific fields on the category view?

I started with the "default" template, but I should have my html instead of a table.

This is the code I want inside the loop (for each displayed item on the category page):
Code:
<!-- BEGIN: offer item --> <div class="offer_article"> <?php if (isset($this->item->positions['offer_article_tag'])) : ?> <!-- BEGIN: offer_article_tag group --> <div class="offer_article_tag"> <p class="offer_percent"><?php echo $this->item->fields['alkoffer_reduction']->display; ?>%</p> <p class="offer_subtext"><?php echo $this->item->fields['alkoffer_subtext']->display; ?></p> </div> <!-- END: offer_article_tag group --> <?php endif; ?> <!-- BEGIN: offer_article_details group --> <div class="offer_article_details"> <h3 class="offer_month"><span class="month_up"><?php echo $this->item->fields['alkoffer_month']->display; ?></span> - offre no. <?php echo $this->fields['title']->display; ?></h3> <h4 class="offer_type"><?php echo $this->item->fields['text']->display; ?></h3> <h5 class="offer_date"><?php echo $this->fields['alkoffer_date']->display; ?></h4> <p class="offer_prices"><span class="offer_price_01">CHF <?php echo $this->fields['alkoffer_price_chf']->display; ?>.-</span></p> <p class="offer_reservation">Réservation au <span class="tel">t</span> 000 00 00 00</p> </div> <!-- END: offer_article_details group --> </div> <div class="clr"></div> <!-- END: offer item -->

This code is between:
Code:
<?php foreach ($this->items as $item) : ?>
and
Code:
<?php endforeach; ?>

As you can see, I'm calling fields, because people can only insert specific content in specific fields. And each field as a specific css.

Thank you VERY much!

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

More
15 years 10 months ago #4984 by yopyop001
Hi,

Try to use
Code:
$item->...
instead of
Code:
$this->item->...
in the loop.

Rgds

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

More
15 years 10 months ago #4991 by tcherno
Hello,

Yes, it works!

Thank you!

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

More
15 years 8 months ago #7138 by intown
Thanks so much for the code snippet.

worked perfectly in my first attempt to create custom templates.

I love this extension so glad I have found it!

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

More
15 years 6 months ago #8465 by glowmedia
Hi I am trying the same thing, but it is not working.

I basically wish on the category page to display a thumbnail (which is linked) an artist name and a date - both from custom fields, the code I am using is:
Code:
[url=<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $this->category->slug)); ?>]<?php echo $this->escape($item->field['thumbnail']); ?>[/url] <h1><?php echo $this->field['artist_name']->display; ?></h1> <h2><?php echo $this->field['artist_date']->display; ?></h2>

Please bera with me as i am new to flexicontent and custom templating.

Cheers

Steve

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

More
15 years 6 months ago #8567 by glowmedia
Can anyone help, I still can't seem to pull the content of fields to the category page??

Steve

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

More
15 years 6 months ago #8571 by micker
some solution in french
<!-- l --><a class="postlink-local" href=" www.flexicontent.org/phpbb/viewtopic.php?f=10&t=1335 ">viewtopic.php?f=10&t=1335
regards

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.

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