Module masqué si les contenus sont vides

More
6 years 2 months ago #71744 by id-pop
Bonjour,
J'ai créé un module universal content pour afficher un champ spécifique de l'élément courant. Comment puis-je faire pour que le module ne s'affiche pas si le champ est vide ? En effet, quand je regarde dans le code, les div's et span sont créés jusqu'à <div class="field_value">. Le champ est de type related item.
Bonne journée et merci,
Alexandre

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

More
6 years 2 months ago #71749 by ggppdk
Hello

all module output is skipped
- if zero items found
- if no data are configured to be displayed in header and in footer

if items are found then module containers will be added regardless if fields are empty


But there is configuration for skipping items when fields are empty
- you can enable this in "Item list: Basic"

First try without stripping field's display HTML as it is much faster


-- 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
6 years 2 months ago #71753 by id-pop
In my case, an item is found because I am displaying the current active item. A custom field is configured to be displayed. It is the only element how is configured to be displayed.

I have found a solution using jquery and a custom css class. The problem is that I have to create a specific class for each module.

For example :
On a module, I have added the "allerplusloin_2" class.
In index.php of my template, I have added :
jQuery(document).ready(function(){
var aa=$('div.moduletable.allerplusloin_2');
if($('div.moduletable.allerplusloin_2 div.field_value').text().length != 0){
aa.removeClass("affichepasmod");
}
else{
aa.addClass("affichepasmod");
}
});
In my cs, I have added :
.affichepasmod{display:none}

I am sur there is an easyer solution.
If you have an idea...

Thanks

Alexandre

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

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