Amen,
Amen,
Pozdrawiam, Michał,
-------------------------
wiki.joomla.pl | JAMP 3.0 - Localhost server for Joomla! | Usuwanie wirusów z Joomla! | BlueCoyote - Administracja Joomla!
Widzę, że się offtopic zrobił. Mam ten sam problem. Mianowicie pod stronę główną jest podpięty SOBI2, a w górnym menu podlinkowany Sigsiu Online Business Index 2 jako strona główna. No i teraz sprawa wygląda tak, że po bokach strony podpięte są moduły, a na środku wyświetlają się wpisy jako v-card. Po wybraniu wpisu otwiera się karta produktu, a boczne moduły zostają dalej przyprawiając mnie nie powiem o co.
Kombinowałem już na różne sposoby. Podpięte moduły wyświetlać się mają wyłącznie na stronie głównej, no a tutaj jest podpięte SOBI i wyświetlają się na wszystkich podstronach obsługiwanych przez ten moduł.
Wie ktoś może jak to rozwiązać?
Link do strony: pensjonat-ok.pl
Witam,
w takich przypadkach pomocne jest dopisanie warunku do wyświetlania wybranej pozycji menu w pliku szablonu.
Załóżmy , że Twoje wymagające ingerencji moduły umieszczone są w pozycji nazwanej: right.
W kodzie pliku index.php szablonu zazwyczaj występuje kod typu:
Należy dodać warunek sprawdzający np. zmienną GET sobi2Task, pierwszą linijkę należy zamienić na:Kod PHP:
<?php if($this->countModules('right')) : ?>
<div >
<jdoc:include type="modules" name="right" style="rounded" />
</div>
<?php endif; ?>
Kod PHP:
<?php if($this->countModules('right') && !JRequest::getVar( 'sobi2Task', '' )) : ?>
Rozumiem, że wówczas, gdy mam np warunek:
to zastąpić go tym podanym przez Ciebie, w postaci:Kod PHP:
<?php echo artxPositions($document, array('top1', 'top2', 'top3'), 'art-block'); ?>
czy też może zrobić to jakoś inaczej. Pytam z ciekawości, bo dla topów nie ma przypisanego żadnego divaKod PHP:
<?php if($this->countModules('top1', 'top2', 'top3')) && !JRequest::getVar( 'sobi2Task', '' )) : ?>
<div >
<jdoc:include type="modules" name="top" style="rounded" />
</div>
<?php endif; ?>
Napisałam zazwyczaj, u Ciebie o wyświetlaniu decyduje funkcja artxPositions(). To ją trzeba zmodyfikować. Nie jestem pewna czy mam szablon tego typu.
Czyli do
mam coś dodać?Kod PHP:
<?php echo artxPositions($document, array('top1', 'top2', 'top3'), 'art-block'); ?>
Czy to będzie wyglądało tak?
Pytam bo mam jutro zalkę i muszę to mieć gotoweKod PHP:
<?php echo artxPositions($document, array('top1', 'top2', 'top3'), 'art-block' && !JRequest::getVar( 'sobi2Task', '' )); ?>
Nie - trzeba zmodyfikować funkcję artxPositions(). Prawdopodobnie znajduje się w pliku functions.php (przykładowo w szablonie horseblack).
Czy u Ciebie wszystkie (top1, top2, top3) mają się nie wyświetlać?
U mnie na stronie głównej ma się wyświetlać wszystko to co teraz jest. Po wybraniu np. Villa Orlik znika wszystko poza headerem, footerem, user3 (menu) i zostaje karta produktu na całą stronę.
W pliku functions mam takie cuś:
Kod PHP:
function artxModules($document, $position, $style = null)
{
if ($document == null) {
// for Joomla 1.0
ob_start();
mosLoadModules($position, -2);
$content = ob_get_clean();
if (null == $style || 'xhtml' == $style)
return $content;
$decorator = 'artblock' == $style ? 'artxBlock' : ('artpost' == $style ? 'artxPost' : null);
$result = '';
$modules = preg_split('~</div>\s*<div class="moduletable">~', $content);
$lastModule = count($modules) - 1;
if ($lastModule > -1) {
$modules[0] = preg_replace('~^\s*<div class="moduletable">~', '', $modules[0]);
$modules[$lastModule] = preg_replace('~</div>\s*$~', '', $modules[$lastModule]);
foreach ($modules as $module) {
if (preg_match('~^\s*<h3>([^<]*)</h3>~', $module, $matches, PREG_OFFSET_CAPTURE)) {
$result .= $decorator($matches[1][0], substr($module, 0, $matches[0][1])
. substr($module, $matches[0][1] + strlen($matches[0][0])));
} else {
$result .= $decorator(null, $module);
}
}
}
return $result;
}
// for Joomla 1.5
return '<jdoc:include type="modules" name="' . $position . '"' . (null != $style ? ' style="artstyle" artstyle="' . $style . '"' : '') . ' />';
}
$artxFragments = array();
function artxFragmentBegin($head = '')
{
global $artxFragments;
$artxFragments[] = array('head' => $head, 'content' => '', 'tail' => '');
}
function artxFragmentContent($content = '')
{
global $artxFragments;
$artxFragments[count($artxFragments) - 1]['content'] = $content;
}
function artxFragmentEnd($tail = '', $separator = '')
{
global $artxFragments;
$fragment = array_pop($artxFragments);
$fragment['tail'] = $tail;
$content = trim($fragment['content']);
if (count($artxFragments) == 0) {
echo (trim($content) == '') ? '' : ($fragment['head'] . $content . $fragment['tail']);
} else {
$result = (trim($content) == '') ? '' : ($fragment['head'] . $content . $fragment['tail']);
$fragment =& $artxFragments[count($artxFragments) - 1];
$fragment['content'] .= (trim($fragment['content']) == '' ? '' : $separator) . $result;
}
}
function artxFragment($head = '', $content = '', $tail = '', $separator = '')
{
global $artxFragments;
if ($head != '' && $content == '' && $tail == '' && $separator == '') {
$content = $head;
$head = '';
} elseif ($head != '' && $content != '' && $tail == '' && $separator == '') {
$separator = $content;
$content = $head;
$head = '';
}
artxFragmentBegin($head);
artxFragmentContent($content);
artxFragmentEnd($tail, $separator);
}
}
Może coś nie teges z moimi oczami, ale nie widzę tu funkcji, o której cały czas mowa. Nie odpowiedziałeś też na pytanie - które pozycje nie mają się wyświetlać. Wiedza, które mają - nie jest mi potrzebna.
Mają zniknąć top1, top2, top3, left, right i bottom1.
Fragment z index.php
<jdoc:include type="modules" name="user3" />
<jdoc:include type="modules" name="banner1" style="artstyle" artstyle="art-nostyle" />
<?php echo artxPositions($document, array('top1', 'top2', 'top3'), 'art-block'); ?>
<div class="art-contentLayout">
<?php if (artxCountModules($document, 'left')) : ?>
<div class="art-sidebar1"><?php echo artxModules($document, 'left', 'art-block'); ?>
</div>
<?php endif; ?>
<div class="art-<?php echo artxGetContentCellStyle($document); ?>">
<?php
echo artxModules($document, 'banner2', 'art-nostyle');
if (artxCountModules($document, 'breadcrumb'))
echo artxPost(null, artxModules($document, 'breadcrumb'));
echo artxPositions($document, array('user1', 'user2'), 'art-article');
echo artxModules($document, 'banner3', 'art-nostyle');
?>
<?php if (artxHasMessages()) : ?><div class="art-Post">
<div class="art-Post-body">
<div class="art-Post-inner">
<div class="art-PostContent">
<jdoc:include type="message" />
</div>
<div class="cleared"></div>
</div>
</div>
</div>
<?php endif; ?>
<jdoc:include type="component" />
<?php echo artxModules($document, 'banner4', 'art-nostyle'); ?>
<?php echo artxPositions($document, array('user4', 'user5'), 'art-article'); ?>
<?php echo artxModules($document, 'banner5', 'art-nostyle'); ?>
</div>
<?php if (artxCountModules($document, 'right')) : ?>
<div class="art-sidebar2"><?php echo artxModules($document, 'right', 'art-block'); ?>
</div>
<?php endif; ?>
</div>
<div class="cleared"></div>
<?php echo artxPositions($document, array('bottom1', 'bottom2', 'bottom3'), 'art-block'); ?>
<jdoc:include type="modules" name="banner6" style="artstyle" artstyle="art-nostyle" />
<div class="art-Footer">
<div class="art-Footer-inner">
<?php echo artxModules($document, 'syndicate'); ?>
<div class="art-Footer-text">