test
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • cansay Friend
    #149999

    Writing an article and placing an image in the top of the article = the image is considered to be txt and the fronpage will only have a few lines of txt.

    Pretty frustrating that one has to consider where you place an image inside articles because ja_sidenews2 cant handle ignoring images or html code 🙁

    http://www.octeamdenmark.com


    1. ja_sidenews2_imagevstxt
    Saguaros Moderator
    #338714

    Dear cansay!

    I have accessed your host to fix the style for ja slidenews displaying on the left side.

    <blockquote>Writing an article and placing an image in the top of the article = the image is considered to be txt and the fronpage will only have a few lines of txt.
    </blockquote>

    The problem is from the content of this articles, you try to edit its content same as other example http://www.octeamdenmark.com/news/1-nyheds-kategori/412-nvidia-frigiver-de-sidste-detaljer-om-gtx470

    GOod luck

    cansay Friend
    #338787

    <em>@tienhc 172573 wrote:</em><blockquote>Dear cansay!

    I have access your host to fix the style for ja slidenews displaying on the left side.

    The problem is from the content of this articles, you try to edit its content same as other example http://www.octeamdenmark.com/news/1-nyheds-kategori/412-nvidia-frigiver-de-sidste-detaljer-om-gtx470

    GOod luck</blockquote>

    Yes I just saw tienhc 😀

    Thank you very much for helping me so much mr 😉

    I know I can fix the problem by editing the article the same way.
    But With my old module, one made by a freind this was never a problem.

    So I was hoping Joomlart could change the coding of the module so it checks for html, images or something and dosent count these charachters as txt for the frontpage.

    In my oppenion this is a small bug of JaSidenews that would help me alot, and others 2 😀

    cansay Friend
    #338810

    Another problem is this.

    The more detail button dosent stay the same place. And somtimes text is placed after the button 🙁

    my third problem is I tried to change the name of the more detail button, in the language file
    named: “en-GB.mod_jasidenews.ini” , but it dident work 🙁


    1. ja_sidenews2_problem2
    Saguaros Moderator
    #339078

    Dear cansay!

    I have customize your module, i did this as following:

    1) open the file modules/mod_jasidernews/helper.php and add the following code at end of file:
    [PHP]

    <?php
    if (! class_exists ( ‘SmartTrim’ )) {
    class SmartTrim {
    /*
    $hiddenClasses: Class that have property display: none or invisible.
    */
    function mb_trim($strin, $pos = 0, $len = 10000, $hiddenClasses = ”, $encoding = ‘utf-8’) {
    mb_internal_encoding ( $encoding );
    $strout = trim ( $strin );

    $pattern = ‘/(<[^>]*>)/’;
    $arr = preg_split ( $pattern, $strout, – 1, PREG_SPLIT_DELIM_CAPTURE );
    $left = $pos;
    $length = $len;
    $strout = ”;
    for($i = 0; $i < count ( $arr ); $i ++) {
    $arr [$i] = trim ( $arr [$i] );
    if ($arr [$i] == ”)
    continue;
    if ($i % 2 == 0) {
    if ($left > 0) {
    $t = $arr [$i];
    $arr [$i] = mb_substr ( $t, $left );
    $left -= (mb_strlen ( $t ) – mb_strlen ( $arr [$i] ));
    }

    if ($left <= 0) {
    if ($length > 0) {
    $t = $arr [$i];
    $arr [$i] = mb_substr ( $t, 0, $length );
    $length -= mb_strlen ( $arr [$i] );
    if ($length <= 0) {
    $arr [$i] .= ‘…’;
    }

    } else {
    $arr [$i] = ”;
    }
    }
    } else {
    if (SmartTrim::isHiddenTag ( $arr [$i], $hiddenClasses )) {
    if ($endTag = SmartTrim::getCloseTag ( $arr, $i )) {
    while ( $i < $endTag )
    $strout .= $arr [$i ++] . “n”;
    }
    }
    }
    $strout .= $arr [$i] . “n”;
    }
    //echo $strout;
    return SmartTrim::toString ( $arr, $len );
    }

    function trim($strin, $pos = 0, $len = 10000, $hiddenClasses = ”) {
    $strout = trim ( $strin );

    $pattern = ‘/(<[^>]*>)/’;
    $arr = preg_split ( $pattern, $strout, – 1, PREG_SPLIT_DELIM_CAPTURE );
    $left = $pos;
    $length = $len;
    $strout = ”;
    for($i = 0; $i < count ( $arr ); $i ++) {
    $arr [$i] = trim ( $arr [$i] );
    if ($arr [$i] == ”)
    continue;
    if ($i % 2 == 0) {
    if ($left > 0) {
    $t = $arr [$i];
    $arr [$i] = substr ( $t, $left );
    $left -= (strlen ( $t ) – strlen ( $arr [$i] ));
    }

    if ($left <= 0) {
    if ($length > 0) {
    $t = $arr [$i];
    $arr [$i] = substr ( $t, 0, $length );
    $length -= strlen ( $arr [$i] );
    if ($length <= 0) {
    $arr [$i] .= ‘…’;
    }

    } else {
    $arr [$i] = ”;
    }
    }
    } else {
    if (SmartTrim::isHiddenTag ( $arr [$i], $hiddenClasses )) {
    if ($endTag = SmartTrim::getCloseTag ( $arr, $i )) {
    while ( $i < $endTag )
    $strout .= $arr [$i ++] . “n”;
    }
    }
    }
    $strout .= $arr [$i] . “n”;
    }
    //echo $strout;
    return SmartTrim::toString ( $arr, $len );
    }

    function isHiddenTag($tag, $hiddenClasses = ”) {
    //By pass full tag like img
    if (substr ( $tag, – 2 ) == ‘/>’)
    return false;
    if (in_array ( SmartTrim::getTag ( $tag ), array (‘script’, ‘style’ ) ))
    return true;
    if (preg_match ( ‘/displays*:s*none/’, $tag ))
    return true;
    if ($hiddenClasses && preg_match ( ‘/classs*=*(‘ . $hiddenClasses . ‘)*/’, $tag ))
    return true;
    }

    function getCloseTag($arr, $openidx) {
    $tag = trim ( $arr [$openidx] );
    if (! $openTag = SmartTrim::getTag ( $tag ))
    return 0;

    $endTag = “<$openTag>”;
    $endidx = $openidx + 1;
    $i = 1;
    while ( $endidx < count ( $arr ) ) {
    if (trim ( $arr [$endidx] ) == $endTag)
    $i –;
    if (SmartTrim::getTag ( $arr [$endidx] ) == $openTag)
    $i ++;
    if ($i == 0)
    return $endidx;
    $endidx ++;
    }
    return 0;
    }

    function getTag($tag) {
    if (preg_match ( ‘/A<([^/>]*)/>Z/’, trim ( $tag ), $matches ))
    return ”; //full tag
    if (preg_match ( ‘/A<([^ />]*)([^>]*)>Z/’, trim ( $tag ), $matches )) {
    //echo “[“.strtolower($matches[1]).”]”;
    return strtolower ( $matches [1] );
    }
    //if (preg_match (‘/<([^ />]*)([^/>]*)>/’, trim($tag), $matches)) return strtolower($matches[1]);
    return ”;
    }

    function toString($arr, $len) {
    $i = 0;
    $stack = new JAStack ( );
    $length = 0;
    while ( $i < count ( $arr ) ) {
    $tag = trim ( $arr [$i ++] );
    if ($tag == ”)
    continue;
    if (SmartTrim::isCloseTag ( $tag )) {
    if ($ltag = $stack->getLast ()) {
    if (‘</’ . SmartTrim::getTag ( $ltag ) . ‘>’ == $tag)
    $stack->pop ();
    else
    $stack->push ( $tag );
    }
    } else if (SmartTrim::isOpenTag ( $tag )) {
    $stack->push ( $tag );
    } else if (SmartTrim::isFullTag ( $tag )) {
    //echo “n”;
    if ($length < $len)
    $stack->push ( $tag );
    } else {
    $length += strlen ( $tag );
    $stack->push ( $tag );
    }
    }

    return $stack->toString ();
    }

    function isOpenTag($tag) {
    if (preg_match ( ‘/A<([^/>]+)/>Z/’, trim ( $tag ), $matches ))
    return false; //full tag
    if (preg_match ( ‘/A<([^ />]+)([^>]*)>Z/’, trim ( $tag ), $matches ))
    return true;
    return false;
    }

    function isFullTag($tag) {
    //echo “n”;
    if (preg_match ( ‘/A<([^/>]*)/>Z/’, trim ( $tag ), $matches ))
    return true; //full tag
    return false;
    }

    function isCloseTag($tag) {
    if (preg_match ( ‘/</(.*)>/’, $tag ))
    return true;
    return false;
    }
    }

    class JAStack {
    var $_arr = null;
    function JAStack() {
    $this->_arr = array ();
    }

    function push($item) {
    $this->_arr = $item;
    }
    function pop() {
    if (! $c = count ( $this->_arr ))
    return null;
    $ret = $this->_arr [$c – 1];
    unset ( $this->_arr [$c – 1] );
    return $ret;
    }
    function getLast() {
    if (! $c = count ( $this->_arr ))
    return null;
    return $this->_arr [$c – 1];
    }
    function toString() {
    $output = ”;
    foreach ( $this->_arr as $item ) {
    $output .= $item . “n”;
    }
    return $output;
    }
    }
    }

    ?>
    [/PHP]

    2) find a function :

    [PHP]
    /**
    * trim string with max specify
    *
    * @param string $title
    * @param integer $max.
    */
    function trimString( $title, $max=60 ){

    if( strlen($title) > $max ){
    return substr( $title, 0, $max ) . ‘…’;
    }
    return $title;
    }
    [/PHP]
    replace:
    [PHP]
    /**
    * trim string with max specify
    *
    * @param string $title
    * @param integer $max.
    */
    function trimString( $title, $maxchars=60 ){

    if ($maxchars && strlen ( $title ) > $maxchars) {
    $doc = JDocument::getInstance ();
    if (function_exists ( ‘mb_substr’ )) {
    return SmartTrim::mb_trim ( $title, 0, $maxchars, $doc->_charset );
    } else {
    return SmartTrim::trim ( $title, 0, $maxchars );
    }
    }

    return $title;
    }

    [/PHP]

    Pls try to check your site again

    Thanks

    cansay Friend
    #340072

    <em>@tienhc 173044 wrote:</em><blockquote>Dear cansay!

    I have customize your module, i did this as following:

    Pls try to check your site again

    Thanks</blockquote>

    WOW I dident understand that you did this for me sir 😀 HAHAHAH :-*;):D

    Im not sure it worked 100% though?
    It still looks the same?

    Saguaros Moderator
    #340167

    Dear Cansay !

    <blockquote>Im not sure it worked 100% though?
    It still looks the same?</blockquote>

    please give show me where having the problem with the module ? i saw the module is working well .

    Thanks

    cansay Friend
    #340344

    Sry I have not replied tienhc 🙁

    It works here.
    http://www.octeamdenmark.com/index.php?option=com_content&view=article&id=456:cpu-overclocking-a-stromforbrug&catid=1:nyheds-kategori&Itemid=77

    It was on an older article a few days ago.

    Dont know if this is because jasidenews only loads the article once, and that the the change you made for me dident affect the old article 🙂

    Lets just considder this one solved 😀
    And Im stating you ROCK tienhc 😉

    cansay Friend
    #345798

    Not quite solved 🙁

    Jasidenews now takes the last image on the first page of the article 🙁

    http://www.joomlart.com/forums/showthread.php?p=181296#post181296

    Saguaros Moderator
    #345964

    I answered in there 😐

Viewing 10 posts - 1 through 10 (of 10 total)

This topic contains 10 replies, has 2 voices, and was last updated by  Saguaros 14 years, 6 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum