[SOLVED] Category layout : how to choose 2 images source field

More
8 years 2 months ago - 8 years 1 month ago #64795 by lclaude
Hello,

In the layout configuration of a category I can choose 1 image custom field. Is it possible to choose 2?

My need:
I have 2 types of content to be displayed in 1 category vue.
Each type of content have it's own image field (can't be the same!), and only it's own image field: the 2 image fields aren't shared between type of content. So no conflicts, because by type of content only 1 field can be set.
I use the params of the category: position, link, size...

At your opinion, what is my solution: to override the category vue, or to play with template and fields, or something else?

Thanks by advance.

Laurent
Last edit: 8 years 1 month ago by lclaude. Reason: typo

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

More
8 years 2 months ago #64796 by ggppdk
Hello

a solution can be not to use the image parameters of the "category layout" of the blog template

Instead add the 2 image fields in the same layout position
- thus only the image field that exists for every item will be show

Explanation, when
- a field does not exist for an item type
- or has no value thus it create empty HTML display

then it cause no error, it is just skipped

but i understand that you want to display the image in specific position,
- so you may have to edit the HTML and CSS that effects the 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.

More
8 years 2 months ago #64797 by ggppdk
Hello

see my above responce

- i see that for blog we already have parameter "per type" for default image:
Default images (per type)

Maybe it would make sense to make the image parameter "multi-value" so that 2 or more image fields are tried in the specified order, or maybe convert it too, to be per type

any way currently there are other priorities


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

More
8 years 2 months ago #64864 by lclaude
Hello,

Thanks for your answers.

I think your first answer is a good solution, thanks.
But it's not actually my way : I started to hack the php template file, it works ...almost ;) !
I have just 1 question : how to display the thumb of my second field.

Here is my code (templates/blog-customised/category_items.php lines 600+) :
Code:
<div class="lineinfo image_descr"> <?php if ($this->params->get('intro_use_image', 1) && ($src || $item->fields['field104'])) : ?> <?php if ($src) : ?> <div class="image<?php echo $this->params->get('intro_position') ? ' right' : ' left'; ?>"> <?php if ($this->params->get('intro_link_image', 1)) : ?> <a href="<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug, 0, $item)); ?>" class="hasTip" title="<?php echo JText::_( 'FLEXI_READ_MORE_ABOUT' ) . ' : ' . htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>"> <img src="<?php echo $thumb; ?>" alt="<?php echo htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>" /> </a> <?php else : ?> <img src="<?php echo $thumb; ?>" alt="<?php echo htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>" /> <?php endif; ?> </div> <?php else : ?> <div class="image<?php echo $this->params->get('intro_position') ? ' right' : ' left'; ?>"> <?php if ($this->params->get('intro_link_image', 1) && $item->fields['field104']) : ?> <a href="<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug, 0, $item)); ?>" class="hasTip" title="<?php echo JText::_( 'FLEXI_READ_MORE_ABOUT' ) . ' : ' . htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>"> <img src="<?php echo $item->fields['field104']->{"display_medium_src"}; ?>" alt="<?php echo htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>" /> </a> <?php else : ?> <img src="<?php echo $thumb; ?>" alt="<?php echo htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>" /> <?php endif; ?> </div> <?php endif; ?> <?php endif; ?>

My pb is here :
Code:
<img src="<?php echo $item->fields['field104']->{"display_medium_src"}; ?>" .......

$item->fields->{"display_medium_src"} do not disply my image thumb

the output is :
Code:
<a href="/category/myitemtitle.html" class="hasTip" title="Lire la suite : myitemtitle"> <img src="/" alt="myitemtitle"></a>

It works fine for everything (tooltip, link...) except the thumb.
Do you know what I miss ?

Laurent

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

More
8 years 2 months ago - 8 years 2 months ago #64867 by ggppdk
Hello

for custom display cases e.g. image path URL, or single image display with total counter,
read this:

About custom display of image / gallery field


-- 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: 8 years 2 months ago by ggppdk.

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

More
8 years 2 months ago - 8 years 2 months ago #64879 by lclaude
Hello,

Thanks to have update the faq.

I'm sorry, I done a mistake on my precedent post.
When I wrote :
$item->fields->{"display_medium_src"} do not disply my image thumb

In fact, it was :
$item->fields->{"display_medium_src"}

However, I didn't find the solution.

I'm not sure of what I'm doing, so I've tested a lot of code.
When I use :
$item->fields->{"display_medium_src"}
$item->fields->display_medium
or anythings on this structure, the output is always
src="/"

When I test with :
FlexicontentFields::getFieldDisplay($this->item, 'fieldname', null, 'display_small');
the output is
src="/getFieldDisplay(): empty item data given"

Can you help me with this elements?

Laurent
Last edit: 8 years 2 months ago by lclaude.

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

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