IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

EDI, CMS, Outils, Scripts et API PHP Discussion :

Problème d'affichage d'article en blog


Sujet :

EDI, CMS, Outils, Scripts et API PHP

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2014
    Messages
    9
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 28
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Octobre 2014
    Messages : 9
    Points : 5
    Points
    5
    Par défaut Problème d'affichage d'article en blog
    Bonjour à tous,
    j'ai un problème par rapport à l'affichage de mes articles en blog.
    Sur ma page d'accueil j'affiche les articles d'une catégories en blog, et je souhaite afficher en premier les deux derniers articles en vedette publié de la même catégorie.
    Pour cela j'ai modifié le fichier blog.php (component/com_content/category), mon problème est que j'affiche que le dernier publié.
    Voila mon code qui affiche bien un article en vedette, si quelqu'un peut m'aider svp à afficher le deuxième :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    <?php if ($this->params->get('show_description', 1) || $this->params->def('show_description_image', 1)) : ?>
    	<div class="category-desc">
    	<?php if ($this->params->get('show_description_image') && $this->category->getParams()->get('image')) : ?>
    		<img src="<?php echo $this->category->getParams()->get('image'); ?>"/>
    	<?php endif; ?>
    	<?php if ($this->params->get('show_description') && $this->category->description) : ?>
    		<?php echo JHtml::_('content.prepare', $this->category->description, '', 'com_content.category'); ?>
    	<?php endif; ?>
    	<div class="clr"></div>
    	</div>
    <?php endif; ?>
    <?php if (empty($this->lead_items) && empty($this->link_items) && empty($this->intro_items)) : ?>
    	<?php if ($this->params->get('show_no_articles', 1)) : ?>
    		<p><?php echo JText::_('COM_CONTENT_NO_ARTICLES'); ?></p>
    	<?php endif; ?>
    <?php endif; ?>
    	<?php $leadingcount = 0; ?>
    	<?php if (false && !empty($this->lead_items)) : ?>
    		<div class="items-leading clearfix" id="leadarticle" style="min-height: 135px">
    			<?php foreach ($this->lead_items as &$item) : ?>
    				<div
    					class="leading-<?php echo $leadingcount; ?><?php echo $item->state == 0 ? ' system-unpublished' : null; ?>">
    					<?php
    					$this->item = & $item;
    					echo $this->loadTemplate('item');
    					?>
    				</div>
    				<?php $leadingcount++; ?>
    			<?php endforeach; ?>
    		</div><!-- end items-leading -->
                    <script>
                        jQuery("#leadarticle h2").css({"font-size":"16px"});
                    </script>
    	<?php endif; ?>
    
    <?php
    	$this->lead = 0;
    	$introcount = (count($this->intro_items));
    	$counter = 0;
    ?>
    <?php //if (true || !empty($this->intro_items)) : 
    if (true ) :
    
    
    ?>
    	<?php
    		$featured = 1;
    		$feat_data = array();
    		foreach ($this->lead_items as $key => &$item){
    			if($item->featured && $featured){
    				$featured = 0;
    				$feat_data = $item;
    				break;
    			}
    		}
    		if($feat_data&&!empty($this->lead_items)){
    
    
    ?>
    <?php if ($this->params->get('show_page_heading') != 0 or $this->params->get('show_category_title')) : ?>
    <h1 id="hightitle-article">
    	<?php echo $this->escape($this->params->get('page_heading')); ?>
    </h1>
    <?php endif; ?>
    	<!-- start items-leading
    		<h1><?php echo $this->escape($this->params->get('page_heading')); ?></h1> -->
    		<div class="items-leading clearfix" id="leadarticle"  style="min-height: 135px">
    
    // ici j'aimerai afficher deux article au lieu de 1 !!
    			<article style="padding-bottom: 30px;" class="leading-<?php echo $leadingcount; ?><?php echo $item->state == 0 ? 'system-unpublished' : null; ?>">
    				<?php
    					$this->lead = 1;
    					$this->item = $feat_data;
    					echo $this->loadTemplate('item');
    					$this->lead = 0;
    				?>
    			</article>
    			                
    		</div>
                    <script>
                        jQuery("#leadarticle h2").css({"font-size":"16px"});
                    </script>
    
    <!-- end items-leading -->

  2. #2
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2014
    Messages
    9
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 28
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Octobre 2014
    Messages : 9
    Points : 5
    Points
    5
    Par défaut
    Bonjour,

    Voila c'est cette partie de mon code que je n'arrive pas à dupliquer avec un second article :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    <article style="padding-top: 20px; border-top: 1px solid #d9d9d9;" class="leading-<?php echo $leadingcount; ?><?php echo $item->state == 0 ? 'system-unpublished' : null; ?>">
    				<?php
    					$this->lead = 1;
    					$this->item = $feat_data;
    					echo $this->loadTemplate('item');
    					$this->lead = 0;
    				?>
    			</article>
    Merci d'avance pour votre aide.

  3. #3
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2014
    Messages
    9
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 28
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Octobre 2014
    Messages : 9
    Points : 5
    Points
    5
    Par défaut
    Bonjour,

    J'arrive toujours pas à résoudre ce problème, quelqu'un peut jeter un œil svp?

  4. #4
    Inactif
    Homme Profil pro
    Sans emploi
    Inscrit en
    Septembre 2014
    Messages
    35
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 33
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Sans emploi

    Informations forums :
    Inscription : Septembre 2014
    Messages : 35
    Points : 52
    Points
    52
    Par défaut
    Import vers ton template pour corriger l'affichage (/templates/NOM/html/com_content/category/default.php)

Discussions similaires

  1. articles des blogs : problèmes causés par le passage au nouveau format
    Par zinzineti dans le forum Evolutions du club
    Réponses: 3
    Dernier message: 06/09/2012, 15h42
  2. [Joomla!] Problème d'affichage en blog dans un template que je viens de concevoir
    Par marydee dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 1
    Dernier message: 22/12/2011, 19h11
  3. [eZ Publish] Affichage des articles façon "blog"
    Par cheche49 dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 3
    Dernier message: 28/08/2009, 15h05

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo