modify category_items.php on template

More
12 years 1 month ago #29416 by bobthebob01
Thanks again ggppdk!

after reading your answer, i figured that i was doing something wrong from the beginning as i was not using $i at first.
Although your trick worked, i wanted to use the template "normally" if i should say.
And voila! it's working exactly as it should:
Code:
<?php /** * @version 1.5 stable $Id: category_items.php 1033 2011-12-08 08:58:02Z enjoyman@gmail.com $ * @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' ); // first define the template name $tmpl = $this->tmpl; JFactory::getDocument()->addScript( JURI::base().'components/com_flexicontent/assets/js/tabber-minimized.js'); JFactory::getDocument()->addStyleSheet(JURI::base().'components/com_flexicontent/assets/css/tabber.css'); ?> <?php $items = & $this->items; ?> <?php foreach ($items as $item) : ?> <div class="board-member-item"> <div class="board-member-item-picture"> <?php if (isset($item->positions['board-member-picture'])) : ?> <?php foreach ($item->positions['board-member-picture'] as $field) : ?> <?php echo $field->display; ?> <?php endforeach; ?> <?php endif; ?> </div> <div class="board-member-item-description"> <?php if ($this->params->get('show_title', 1)) : ?> <h2><?php echo $item->title; ?></h2> <?php endif; ?> <?php if (isset($item->positions['description'])) : ?> <?php foreach ($item->positions['description'] as $field) : ?> <?php echo $field->display; ?> <?php endforeach; ?> <?php endif; ?> </div> </div> <?php endforeach; ?>

I guess i was just doing it wrong at first or mistyped something, or mix both ways.
Anyhow, it's working fine now.

You're a champ!

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

More
11 years 11 months ago #31800 by MikeSantana
<?php if ($blog_field_author_id = $blog_item->fields->item_id) : ?>
<?php $blog_field_author_id = $blog_item->fields->id;
$blog_item_author_id = $blog_item->fieldvalues[$blog_field_author_id][0];
$author_itemmodel = new FlexicontentModelItems();
$author_item = $author_itemmodel->getItem($blog_item_author_id, $check_view_access=false);
FlexicontentFields::getFieldDisplay($author_item,'headshot_photo');
$author_blog_image = $author_item->fields->display;
/* The $author_blog_image has the respective html to display the image related to the author */

HERE is where i need to insert the "author_blog_image" to the same position where "author_profile" is.
Here is a dump of my positions.
[array] positions
[stdClass object] before-description
Properties
[stdClass object] author_profile
[string] display = "Authors Blog02"
[string] id = "81"
[string] label = ""
[string] name = "author_profile"


I would like it to add a new object to the position in order to display it only in the front end not backend.

[stdClass object] author_profile_image
[string] display = "<img src=" dev.mysite.com/images/stories/flexicontent/m_author_blog02.png " alt="Author Blog02" class="fc_field_image">"
[string] id = "8672"
[string] label = ""
[string] name = "author_blog_image"


This Is my code to render each position (in this case "before-description")

if (isset($blog_item->positions)) : ?>
<div class="lineinfo">
<?php foreach ($blog_item->positions as $field) : ?>
<span class="element">
<div class="blog_item_author">'
<?php if ($field->label) : ?>
<span class="label field_<?php echo $field->name; ?>"><?php echo $field->label; ?></span>
<?php endif; ?>
<span class="value field_<?php echo $field->name.'_img'; ?>"><?php echo $author_blog_image; ?></span>
</div>
<?php // endif; ?>
</span>
<?php endforeach; ?>
</div>
<?php endif; ?>

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

More
11 years 11 months ago #31805 by ggppdk
Hello,

i am not sure of what you are asking,

maybe instead of pasting code, that needs studying in order for me to answer you (note custom development assistant for free is not possible, although commons questions are answered and add to our FAQ articles !!),

-- please first describe what you are trying to do in more details


1. you want to modify the template positions via PHP code in category_items.php ?

2. so that that the code that outputs field's HTML will use it and display it in a specific position?


-- 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...

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

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