How to display fields in a custom template

More
9 years 5 months ago #55385 by Bold
My apologies for not understanding.

I have the fields assigned to render only. In the item_html5.php I am using echo $item->fields->display; to call the values. But the resulting page is still blank. I tried attaching item_html5 as a text file but sill get an error so I'm adding it below. Can you take a quick look to see what I am doing wrong? Thank you so much for your time!
Code:
<?php /** * @version 1.5 stable $Id: item.php 1538 2012-11-05 02:44:34Z ggppdk $ * @package Joomla * @subpackage FLEXIcontent * @copyright (C) 2009 Emmanuel Danan - www.vistamedia.fr * @license GNU/GPL v2 * * FLEXIcontent is a derivative work of the excellent QuickFAQ component * @copyright (C) 2008 Christoph Lukes * see www.schlu.net for more information * * FLEXIcontent is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ defined( '_JEXEC' ) or die( 'Restricted access' ); // USE HTML5 or XHTML $html5 = $this->params->get('htmlmode', 0); // 0 = XHTML , 1 = HTML5 if ($html5) { /* BOF html5 */ echo $this->loadTemplate('html5'); } else { // first define the template name $tmpl = $this->tmpl; $item = $this->item; $menu = JFactory::getApplication()->getMenu()->getActive(); JFactory::getDocument()->addScript( JURI::base(true).'/components/com_flexicontent/assets/js/tabber-minimized.js'); JFactory::getDocument()->addStyleSheet(JURI::base(true).'/components/com_flexicontent/assets/css/tabber.css'); // Prepend toc (Table of contents) before item's description (toc will usually float right) // By prepend toc to description we make sure that it get's displayed at an appropriate place if (isset($item->toc)) { $item->fields['text']->display = $item->toc . $item->fields['text']->display; } // *********** // DECIDE TAGS // *********** $page_heading_shown = $this->params->get( 'show_page_heading', 1 ) && $this->params->get('page_heading') != $item->title; // Main container $mainAreaTag = 'div'; // SEO, header level of title tag $itemTitleHeaderLevel = '2'; // SEO, header level of tab title tag $tabsHeaderLevel = $itemTitleHeaderLevel == '2' ? '3' : '2'; $page_classes = 'flexicontent'; $page_classes .= $this->pageclass_sfx ? ' page'.$this->pageclass_sfx : ''; $page_classes .= ' fcitems fcitem'.$item->id; $page_classes .= ' fctype'.$item->type_id; $page_classes .= ' fcmaincat'.$item->catid; if ($menu) $page_classes .= ' menuitem'.$menu->id; ?> <?php echo '<'.$mainAreaTag; ?> id="flexicontent" class="<?php echo $page_classes; ?> group" > <?php echo ( ($mainAreaTag == 'section') ? '<header>' : ''); ?> <?php if ($item->event->beforeDisplayContent) : ?> <!-- BOF beforeDisplayContent --> <div class="fc_beforeDisplayContent group"> <?php echo $item->event->beforeDisplayContent; ?> </div> <!-- EOF beforeDisplayContent --> <?php endif; ?> <?php if (JRequest::getCmd('print')) : ?> <!-- BOF Print handling --> <?php if ($this->params->get('print_behaviour', 'auto') == 'auto') : ?> <script type="text/javascript">window.addEvent('domready', function() { window.print(); });</script> <?php elseif ($this->params->get('print_behaviour') == 'button') : ?> <input type='button' id='printBtn' name='printBtn' value='<?php echo JText::_('Print');?>' class='btn btn-info' onclick='this.style.display="none"; window.print(); return false;'> <?php endif; ?> <!-- EOF Print handling --> <?php else : ?> <?php $pdfbutton = flexicontent_html::pdfbutton( $item, $this->params ); $mailbutton = flexicontent_html::mailbutton( FLEXI_ITEMVIEW, $this->params, $item->categoryslug, $item->slug, 0, $item ); $printbutton = flexicontent_html::printbutton( $this->print_link, $this->params ); $editbutton = flexicontent_html::editbutton( $item, $this->params ); $statebutton = flexicontent_html::statebutton( $item, $this->params ); $approvalbutton = flexicontent_html::approvalbutton( $item, $this->params ); ?> <?php if ($pdfbutton || $mailbutton || $printbutton || $editbutton || $statebutton || $approvalbutton) : ?> <!-- BOF buttons --> <div class="buttons"> <?php echo $pdfbutton; ?> <?php echo $mailbutton; ?> <?php echo $printbutton; ?> <?php echo $editbutton; ?> <?php echo $statebutton; ?> <?php echo $approvalbutton; ?> </div> <!-- EOF buttons --> <?php endif; ?> <?php endif; ?> <?php if ( $this->params->get( 'show_page_heading', 1 ) ) : ?> <!-- BOF page heading --> <h1 class="componentheading"> <?php echo $this->params->get('page_heading'); ?> </h1> <!-- EOF page heading --> <?php endif; ?> <?php echo ( ($mainAreaTag == 'section') ? '</header>' : ''); ?> <?php echo ( ($mainAreaTag == 'section') ? '<article>' : ''); ?> <?php $header_shown = $this->params->get('show_title', 1) || $item->event->afterDisplayTitle || isset($item->positions['subtitle1']) || isset($item->positions['subtitle2']) || isset($item->positions['subtitle3']); ?> <?php if ($this->params->get('show_title', 1)) : ?> <!-- BOF item title --> <?php echo '<h'.$itemTitleHeaderLevel; ?> class="contentheading"><span class="fc_item_title"> <?php echo ( mb_strlen($item->title, 'utf-8') > $this->params->get('title_cut_text',200) ) ? mb_substr ($item->title, 0, $this->params->get('title_cut_text',200), 'utf-8') . ' ...' : $item->title; ?> </span><?php echo '</h'.$itemTitleHeaderLevel; ?>> <!-- EOF item title --> <?php endif; ?> <?php if ($item->event->afterDisplayTitle) : ?> <!-- BOF afterDisplayTitle --> <div class="fc_afterDisplayTitle group"> <?php echo $item->event->afterDisplayTitle; ?> </div> <!-- EOF afterDisplayTitle --> <?php endif; ?> <!-- ROW --> <div class="row"> <?php if (isset($item->positions['description'])) : ?> <div class="description group"> <?php foreach ($item->positions['description'] as $field) : ?> <div class="span6"> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgDepartment01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgDepartment01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgDepartment01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgDepartment01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgStatus01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgStatus01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgType01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgType01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['modified']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['modified']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['tags']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['tags']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['text']->label; ?></div> <!-- description--> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['text']->display; ?></div> <!-- description--> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgMemo01']->label; ?></div> <!-- description--> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgMemo01']->display; ?></div> <!-- description--> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgEligibility01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgEligibility01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgEligibilityMemo01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgEligibilityMemo01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgLanguages01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgLanguages01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralStaffOnlyMemo01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralStaffOnlyMemo01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralStaffOnlyRating01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralStaffOnlyRating01']->display; ?></div> </div> </div> <div class="span6"> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralGoogleMap01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralGoogleMap01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgAddress01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgAddress01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgAddress02']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgAddress02']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgCity01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgCity01']->display; ?>, <?php echo $item->fields['ReferralOrgState01']->display; ?> <?php echo $item->fields['ReferralOrgZip01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgPhone01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgPhone01']->display; ?> <?php echo $item->fields['ReferralOrgPhoneExt01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgPhone02']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgPhone02']->display; ?> <?php echo $item->fields['ReferralOrgPhoneExt01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgFax01']->label; ?></div> <?php endif; ?> <div class="desc-content">Fax: <?php echo $item->fields['ReferralOrgFax01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgEmail01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgEmail01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgEmailAlternate01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgEmailAlternate01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgWebsite01']->label; ?></div> <?php endif; ?> <div class="desc-content"><a href="<?php echo $item->fields['ReferralOrgWebsite01'] ?>">Website</a></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgFacebook01']->label; ?></div> <?php endif; ?> <div class="desc-content"><a href="<?php echo $item->fields['ReferralOrgFacebook01'] ?>">Facebook</a></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgTwitter01']->label; ?></div> <?php endif; ?> <div class="desc-content"><a href="<?php echo $item->fields['ReferralOrgTwitter01'] ?>">Twitter</a></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgHoursType01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgHoursType01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgHoursMonday01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgHoursMonday01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgHoursTuesday01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgHoursTuesday01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgHoursWednesday01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgHoursWednesday01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgHoursThursday01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgHoursThursday01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgHoursFriday01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgHoursFriday01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgHoursSaturday01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgHoursSaturday01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgHoursSunday01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgHoursSunday01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralOrgHoursMemo01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralOrgHoursMemo01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralContactFirstName01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralContactFirstName01']->display; ?> <?php echo $item->fields['ReferralContactLastName01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralContactTitle01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralContactTitle01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralContactPhone01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralContactPhone01']->display; ?> <?php echo $item->fields['ReferralContactPhoneExt01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralContactFax01']->label; ?></div> <?php endif; ?> <div class="desc-content">Fax: <?php echo $item->fields['ReferralContactFax01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralContactEMail01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralContactEMail01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralContactAffiliation01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralContactAffiliation01']->display; ?></div> </div> <div class="row"> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $item->fields['ReferralContactMemo01']->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $item->fields['ReferralContactMemo01']->display; ?></div> </div> </div> <?php endforeach; ?> </div> <?php endif; ?> </div> <?php if ($item->event->afterDisplayContent) : ?> <!-- BOF afterDisplayContent --> <div class="fc_afterDisplayContent group"> <?php echo $item->event->afterDisplayContent; ?> </div> <!-- EOF afterDisplayContent --> <?php endif; ?> <div class="span12"> <?php if (isset($item->positions['bottom_tab'])) : ?> <div class="description group"> <?php foreach ($item->positions['bottom_tab'] as $field) : ?> <?php if ($field->label) : ?> <div class="desc-title"><?php echo $field->label; ?></div> <?php endif; ?> <div class="desc-content"><?php echo $field->display; ?></div> <?php endforeach; ?> </div> <?php endif; ?> </div> <?php echo $mainAreaTag == 'section' ? '</article>' : ''; ?> <?php if ($this->params->get('comments') && !JRequest::getVar('print')) : ?> <!-- BOF comments --> <div class="comments group"> <?php if ($this->params->get('comments') == 1) : if (file_exists(JPATH_SITE.DS.'components'.DS.'com_jcomments'.DS.'jcomments.php')) : require_once(JPATH_SITE.DS.'components'.DS.'com_jcomments'.DS.'jcomments.php'); echo JComments::showComments($item->id, 'com_flexicontent', $this->escape($item->title)); endif; endif; if ($this->params->get('comments') == 2) : if (file_exists(JPATH_SITE.DS.'plugins'.DS.'content'.DS.'jom_comment_bot.php')) : require_once(JPATH_SITE.DS.'plugins'.DS.'content'.DS.'jom_comment_bot.php'); echo jomcomment($item->id, 'com_flexicontent'); endif; endif; ?> </div> <!-- BOF comments --> <?php endif; ?> <?php echo '</'.$mainAreaTag.'>'; ?> <?php } /* EOF if html5 */ ?>

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

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

This should work
1. place field in 'renderonly' position:
2. then use:
Code:
echo $item->fields['fieldname']->display; echo $item->fields['myimage']->display; echo $item->fields['mycheckbox']->display; echo $item->fields['name2']->display; echo $item->fields['name3']->display;

Also please note that the field will be empty if it does not have value for the current item

-- also please do this
in Joomla global configuration , set error reporting to maximum or development

are you editting the correct file?

e.g. if you add:
echo "reached 22";

do you see it getting printed?


-- 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...
Last edit: 9 years 5 months ago by ggppdk.

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

More
9 years 5 months ago #55392 by Bold
As stated above I've put my fields in the renderonly position and my php file above is already using $item->fields->display; and it's not working. Again my apologies if I'm not understanding. Could you possibly send me a link to (or an example of) a properly working custom template I can use as reference?

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

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

After doing what is described below, please send me a PM with admin access
Code:
-- also please do this in Joomla global configuration , set error reporting to maximum or development are you editting the correct file? e.g. if you add: echo "reached 22"; do you see it getting printed?

also make sure that you are using fieldname and not field label

after doing the above send me a PM with admin access,
provide
- the FLEXIcontent item id
- the field id that you are trying to display


-- 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...
Last edit: 9 years 5 months ago by ggppdk.

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

More
9 years 5 months ago #55396 by Bold
PM Sent

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

More
9 years 5 months ago #55397 by ggppdk
Hello

you were editing file:
item_html5.php

but default file to load is item.php
- copying your code into item.php, it worked



In type configuration
inside template TAB, click to open the parameter slider, the last parameter
IS:
HTML Version: use global, XHTML (item.php), html5 (item_html5.php)


-- 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...
The following user(s) said Thank You: Bold

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

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