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 :

plugin "auto readmore"


Sujet :

EDI, CMS, Outils, Scripts et API PHP

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Candidat au Club
    Inscrit en
    Septembre 2010
    Messages
    2
    Détails du profil
    Informations forums :
    Inscription : Septembre 2010
    Messages : 2
    Par défaut plugin "auto readmore"
    slt,
    -----------
    est ce que c'est possible de modifier le plu-gin "auto readmore"
    par ce que je veux modifier la taille de l'image automatiquement en chaque article
    ------------------------------------------------------
    c'est le code de mon plu-gin "auto readmore" sur l'image
    ----------------------------
    Code:

    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
    // Are we working with any thumbnails?
      $thumbnails = '';
      if ($this->param('Thumbnails') >= 1) {
       // Extract all images from the article.
       preg_match_all('/<img [^>]*>/i', $article->introtext . $article->fulltext, $matches); $matches = $matches[0];
       // Loop through the thumbnails.
       for ($thumbnail = 0; $thumbnail < $this->param('Thumbnails'); $thumbnail++) {
        if (!isset($matches[$thumbnail])) break;
        // Remove the image from $text
    	$text = str_replace($matches[$thumbnail], '', $text);
        // See if we need to remove styling.
        if ($this->param('Thumbnails_Class') != '') {
    	 // Remove style, class, width, border, and height attributes.
    	 $matches[$thumbnail] = preg_replace('/(style|class|width|height|border) ?= ?[\'"][^\'"]*[\'"]/i', '', $matches[$thumbnail]);
    	 // Add CSS.
    	 $matches[$thumbnail] = preg_replace('@/?>$@', 'class="' . $this->param('Thumbnails_Class') . '" />', $matches[$thumbnail]);
    	 }
    	// Make this thumbnail a link.
    	$matches[$thumbnail] = "<a href='" . JRoute::_("index.php?option=com_content&id={$article->slug}") . "'>{$matches[$thumbnail]}</a>";
    	// Add to the list of thumbnails.
    	$thumbnails .= $matches[$thumbnail];
    	}
       }
      if (strlen(strip_tags($text)) > $max_chars) {
       if ($this->param('Strip_Formatting') == 1) {
        // First, remove all new lines
        $text = preg_replace("/\r\n|\r|\n/", "", $text);
        // Next, replace <br /> tags with \n
        $text = preg_replace("/<BR[^>]*>/i", "\n", $text);
        // Replace <p> tags with \n\n
        $text = preg_replace("/<P[^>]*>/i", "\n\n", $text);
        // Strip all tags
        $text = strip_tags($text);
        // Truncate
        $text = substr($text, 0, $max_chars);
        // Pop off the last word in case it got cut in the middle
        $text = preg_replace("/[.,!?:;]? [^ ]*$/", "", $text);
        // Add ... to the end of the article.
        $text = trim($text) . "...";
        // Replace \n with <br />
        $text = str_replace("\n", "<br />", $text);
    	} else {
        // Truncate
        $text = substr($text, 0, $max_chars);
        // Pop off the last word in case it got cut in the middle
        $text = preg_replace("/[.,!?:;]? [^ ]*$/", "", $text);
    	// Pop off the last tag, if it got cut in the middle.
    	$text = preg_replace('/<[^>]*$/', '', $text);
    	// Add ... to the end of the article if the last character is a letter or a number.
        if (preg_match('/\w/', substr($text, -1))) $text = trim($text) . "...";
        // Use Tidy to repair any bad XHTML (unclosed tags etc)
    	$tidy = new tidy(); $text = $tidy->repairString($text, array('show-body-only'=>true, 'output-xhtml'=>true), 'utf8');
    	}
       // Add a "read more" link.
       $article->readmore = true;
       }
      // If we have thumbnails, add it to $text.
      $text = $thumbnails . $text;
      // If Developer Mode is turned on, add some stuff.
      if ($this->param('Developer_Mode') == 1) {
       $text = ''
    	. '<div style="height:150px;width:100%;overflow:auto;">'
        . '<b>Developer information:</b><br /><pre>'
    	. 'Developers: uncomment the next line in the code to display $GLOBALS.  If you see this message and do not know what it means, you should turn Developer_Mode off in the Auto Read More configuration.'
    	 . (htmlspecialchars(print_r($GLOBALS, 1))) // by default, this is commented out for security.  Only uncomment it if you know what you are doing.
    	. '</pre></div>'
        . $text
    	;
       }
      // Set $article->text.
      $article->text = $text;
      }
     
     function param($name) {
      static $plugin, $pluginParams;
      if (!isset($plugin)) {
       $plugin =& JPluginHelper::getPlugin('content', 'AutoReadMore');
       $pluginParams = new JParameter( $plugin->params );
       }
      return $pluginParams->get($name);
      }
     
     }
    et merci

  2. #2
    Candidat au Club
    Inscrit en
    Septembre 2010
    Messages
    2
    Détails du profil
    Informations forums :
    Inscription : Septembre 2010
    Messages : 2
    Par défaut
    0 réponse

Discussions similaires

  1. Plugin auto post load ne fonctionne qu'une fois
    Par jimmy-th dans le forum jQuery
    Réponses: 0
    Dernier message: 09/10/2019, 12h39
  2. plugin "auto suffisant"
    Par kohsaka dans le forum jQuery
    Réponses: 2
    Dernier message: 18/03/2010, 13h13
  3. Plugin : auto activation de la complétion
    Par Jehuty57 dans le forum Eclipse Platform
    Réponses: 5
    Dernier message: 05/01/2010, 15h32
  4. Réponses: 2
    Dernier message: 28/08/2007, 09h10

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