calling a field to the template

More
14 years 4 months 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
14 years 4 months 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
14 years 4 months 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
14 years 1 month 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
14 years 1 month 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
14 years 1 month ago #4991 by tcherno
Hello,

Yes, it works!

Thank you!

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.272 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