WebGik
Total posts: 16
07 Jul 2014 16:06

Сверстал для сайта адаптивный шаблон и наблюдаю следующую проблему с отображением поля Field - Gallery на форме добавления статьи:

ScreenClip

т. е. поле выводится 3 раза, при этом добавить изображения можно только при помощи первого, 2 нижних не активны, ярлык выводится только для первого поля.

В шаблоне для каждого вида устройства используются свои выводы содержимого

.... Для ПК

<div class="visible-desktop>
<jdoc:include type="component" />
</div>

.....

.... Для планшетов

<div class="visible-tablet>
<jdoc:include type="component" />
</div>

.....

.... Для смартфонов

<div class="visible-phone>
<jdoc:include type="component" />
</div>

.....

Если убрать выводы содержимого для планшетов и смартфонов, то все норм, поле остается одно.

На планшете и смарфоне поле вообще не выводится.

Пожалуйста, помогите решить проблему.

Last Modified: 08 Jul 2014


pepperstreet VIP
Total posts: 3,837
07 Jul 2014 19:06

Your sample code snippet does not make sense to me... I mean, why a conditional display of the whole J! component area?

1.) What do you want to achieve in the final output?
2.) Did you try 3 gallery fields simultaneously in a default J! Joomla template? What happens there...

HeadsUp:

Just noticed, that you have 3! occurrencies of the main component. No matter which BS utility class you use, it does not prevent the actual code from execution. Although, those classes are for hiding things... it seems bad practice to stack multiple main content areas. (see conditional PHP tip by Sergey)


Sergey
Total posts: 13,748
08 Jul 2014 00:13

Наверно как то так.

<?php
$class = "visible-desctop";
if(...) {
    $class = "visible-tablet";
}
elseif(...) {
    $class = "visible-phone";
}
?>
<div class="<?php echo $class; ?>">
    <jdoc:include type="component" />
</div>

Sergey
Total posts: 13,748
08 Jul 2014 02:32

pepperstreet Just noticed, that you have 3! occurrencies of the main component. No matter which BS utility class you use, it does not prevent the actual code from execution. Although, those classes are for hiding things... it seems bad practice to stack multiple main content areas. (see conditional PHP tip by Sergey)

In addition it may significantly affect load time of the page especialy on mobile. Becayse щстеуте should be loaded 3 times anyway.

Powered by Cobalt