+ Antworten
Seite 1 von 2 1 2 LetzteLetzte
Ergebnis 1 bis 10 von 14

Thema: Latest News Modul, mit title attribut

  1. #1
    Neu an Board
    Registriert seit
    29.08.2009
    Beiträge
    34
    Bedankte sich
    7
    Erhielt 0 Danksagungen
    in 0 Beiträgen

    Standard Latest News Modul, mit title attribut

    Hallo.
    Wie kan man das title attribut in das latest news modul einfügen, da ich die Beitragstitel abschneide möchte ich das trotzdem der ganze Beitragstitel beim mouse over(als tooltip) erscheint. Bin für jede Hilfe dankbar.
    mfg

  2. #2
    Wohnt hier Avatar von Kubik-Rubik
    Registriert seit
    20.10.2005
    Ort
    Kubik-Rubik.de
    Beiträge
    2.596
    Bedankte sich
    147
    Erhielt 969 Danksagungen
    in 753 Beiträgen

    Standard

    Wie genau schneidest du denn den Beitragstitel ab?

    Gruß

  3. #3
    Neu an Board
    Registriert seit
    29.08.2009
    Beiträge
    34
    Bedankte sich
    7
    Erhielt 0 Danksagungen
    in 0 Beiträgen

    Standard

    Mittels core hack, rot markiert.
    helper.php:
    <?php
    /**
    * @version $Id: helper.php 10857 2008-08-30 06:41:16Z willebil $
    * @package Joomla
    * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
    * @license GNU/GPL, see LICENSE.php
    * Joomla! is free software. This version may have been modified pursuant
    * to the GNU General Public License, and as distributed it includes or
    * is derivative of works licensed under the GNU General Public License or
    * other free or open source software licenses.
    * See COPYRIGHT.php for copyright notices and details.
    */

    // no direct access
    defined('_JEXEC') or die('Restricted access');

    require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'h elpers'.DS.'route.php');

    class modLatestNewsHelper
    {
    function getList(&$params)
    {
    global $mainframe;

    $db =& JFactory::getDBO();
    $user =& JFactory::getUser();
    $userId = (int) $user->get('id');

    $count = (int) $params->get('count', 5);
    $catid = trim( $params->get('catid') );
    $secid = trim( $params->get('secid') );
    $show_front = $params->get('show_front', 1);
    $aid = $user->get('aid', 0);

    $contentConfig = &JComponentHelper::getParams( 'com_content' );
    $access = !$contentConfig->get('show_noauth');

    $nullDate = $db->getNullDate();

    $date =& JFactory::getDate();
    $now = $date->toMySQL();

    $where = 'a.state = 1'
    . ' AND ( a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).' )'
    . ' AND ( a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).' )'
    ;

    // User Filter
    switch ($params->get( 'user_id' ))
    {
    case 'by_me':
    $where .= ' AND (created_by = ' . (int) $userId . ' OR modified_by = ' . (int) $userId . ')';
    break;
    case 'not_me':
    $where .= ' AND (created_by <> ' . (int) $userId . ' AND modified_by <> ' . (int) $userId . ')';
    break;
    }

    // Ordering
    switch ($params->get( 'ordering' ))
    {
    case 'm_dsc':
    $ordering = 'a.modified DESC, a.created DESC';
    break;
    case 'c_dsc':
    default:
    $ordering = 'a.created DESC';
    break;
    }

    if ($catid)
    {
    $ids = explode( ',', $catid );
    JArrayHelper::toInteger( $ids );
    $catCondition = ' AND (cc.id=' . implode( ' OR cc.id=', $ids ) . ')';
    }
    if ($secid)
    {
    $ids = explode( ',', $secid );
    JArrayHelper::toInteger( $ids );
    $secCondition = ' AND (s.id=' . implode( ' OR s.id=', $ids ) . ')';
    }

    // Content Items only
    $query = 'SELECT a.*, ' .
    ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'.
    ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug'.
    ' FROM #__content AS a' .
    ($show_front == '0' ? ' LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id' : '') .
    ' INNER JOIN #__categories AS cc ON cc.id = a.catid' .
    ' INNER JOIN #__sections AS s ON s.id = a.sectionid' .
    ' WHERE '. $where .' AND s.id > 0' .
    ($access ? ' AND a.access <= ' .(int) $aid. ' AND cc.access <= ' .(int) $aid. ' AND s.access <= ' .(int) $aid : '').
    ($catid ? $catCondition : '').
    ($secid ? $secCondition : '').
    ($show_front == '0' ? ' AND f.content_id IS NULL ' : '').
    ' AND s.published = 1' .
    ' AND cc.published = 1' .
    ' ORDER BY '. $ordering;
    $db->setQuery($query, 0, $count);
    $rows = $db->loadObjectList();

    $i = 0;
    $lists = array();
    foreach ( $rows as $row )
    {
    if($row->access <= $aid)
    {
    $lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
    } else {
    $lists[$i]->link = JRoute::_('index.php?option=com_user&view=login');
    }

    $date = new JDate($row->created);

    $created_month = $date->toFormat("%m");
    $month_name = $date->toFormat("%B");
    $created_day = $date->toFormat("%d");
    $created_year = $date->toFormat("%Y");

    $lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
    $lists[$i]->showcreated = $created_day.'/ '.$created_month.'/ '.$created_year;
    $lists[$i]->text = htmlspecialchars( substr( $row->title,0,24 ) )."..."; // titel verkürzen mit 24
    $i++;
    }
    return $lists;
    }
    }
    default.php:
    <?php // no direct access
    defined('_JEXEC') or die('Restricted access'); ?>
    <?php if (count($list)) : ?>
    <ul class="menu2">
    <li>
    <?php foreach ($list as $item) : ?>
    <a href="<?php echo $item->link; ?>" class="latestnews<?php echo $params->get('pageclass_sfx'); ?>">
    <?php echo $item->text; ?></a><span style="font-size: 8pt; padding-left:10px;">vom <?php echo $item->showcreated; ?></span>
    <hr /><?php endforeach; ?></li></ul>
    <?php endif;?>
    So zeigt das modul auch das datum an, falls es wer benötigt. Aber wie kann ich nun machen das ein title attribut eingefügt wird?
    mfg

  4. #4
    Gehört zum Inventar Avatar von blaulichttreff
    Registriert seit
    30.04.2007
    Ort
    Heidenrod
    Beiträge
    7.703
    Bedankte sich
    134
    Erhielt 2.557 Danksagungen
    in 2.421 Beiträgen

    Standard

    Code:
    $lists[$i]->text = htmlspecialchars( substr( $row->title,0,24 ) )."..."; // titel verkürzen mit 24
    $lists[$i]->title =  $row->title; 
    Code:
    <a href="<?php echo $item->link; ?>" title=<?php echo $item->title; ?>" class="latestnews<?php echo $params->get('pageclass_sfx'); ?>">
    <?php echo $item->text; ?></a>
    Gruß Sascha
    Viele kennen Google, aber nur wenige scheinen es zu nutzen Problem gelöst? | Joomla FAQ
    FF Springen

  5. Erhielt Danksagungen von:


  6. #5
    Neu an Board
    Registriert seit
    29.08.2009
    Beiträge
    34
    Bedankte sich
    7
    Erhielt 0 Danksagungen
    in 0 Beiträgen

    Standard

    Dank dir erstmal.
    Ein titel wird zwar angezeigt, aber leider nur das erste wort...

  7. #6
    Gehört zum Inventar Avatar von blaulichttreff
    Registriert seit
    30.04.2007
    Ort
    Heidenrod
    Beiträge
    7.703
    Bedankte sich
    134
    Erhielt 2.557 Danksagungen
    in 2.421 Beiträgen

    Standard

    hmm, bei mit klappts, habe aber mal nachgeschaut, ich hatte es so notiert
    Code:
    $lists[$i]->title =  htmlspecialchars($row->title); 
    $lists[$i]->text = htmlspecialchars( substr( $row->title,0,24 ) )."..."; // titel verkürzen mit 24
    Gruß Sascha
    Viele kennen Google, aber nur wenige scheinen es zu nutzen Problem gelöst? | Joomla FAQ
    FF Springen

  8. #7
    Neu an Board
    Registriert seit
    29.08.2009
    Beiträge
    34
    Bedankte sich
    7
    Erhielt 0 Danksagungen
    in 0 Beiträgen

    Standard

    Danke für deine mühe, also das ist der helper code:
    <?php
    /**
    * @version $Id: helper.php 10857 2008-08-30 06:41:16Z willebil $
    * @package Joomla
    * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
    * @license GNU/GPL, see LICENSE.php
    * Joomla! is free software. This version may have been modified pursuant
    * to the GNU General Public License, and as distributed it includes or
    * is derivative of works licensed under the GNU General Public License or
    * other free or open source software licenses.
    * See COPYRIGHT.php for copyright notices and details.
    */

    // no direct access
    defined('_JEXEC') or die('Restricted access');

    require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'h elpers'.DS.'route.php');

    class modLatestNewsHelper
    {
    function getList(&$params)
    {
    global $mainframe;

    $db =& JFactory::getDBO();
    $user =& JFactory::getUser();
    $userId = (int) $user->get('id');

    $count = (int) $params->get('count', 5);
    $catid = trim( $params->get('catid') );
    $secid = trim( $params->get('secid') );
    $show_front = $params->get('show_front', 1);
    $aid = $user->get('aid', 0);

    $contentConfig = &JComponentHelper::getParams( 'com_content' );
    $access = !$contentConfig->get('show_noauth');

    $nullDate = $db->getNullDate();

    $date =& JFactory::getDate();
    $now = $date->toMySQL();

    $where = 'a.state = 1'
    . ' AND ( a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).' )'
    . ' AND ( a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).' )'
    ;

    // User Filter
    switch ($params->get( 'user_id' ))
    {
    case 'by_me':
    $where .= ' AND (created_by = ' . (int) $userId . ' OR modified_by = ' . (int) $userId . ')';
    break;
    case 'not_me':
    $where .= ' AND (created_by <> ' . (int) $userId . ' AND modified_by <> ' . (int) $userId . ')';
    break;
    }

    // Ordering
    switch ($params->get( 'ordering' ))
    {
    case 'm_dsc':
    $ordering = 'a.modified DESC, a.created DESC';
    break;
    case 'c_dsc':
    default:
    $ordering = 'a.created DESC';
    break;
    }

    if ($catid)
    {
    $ids = explode( ',', $catid );
    JArrayHelper::toInteger( $ids );
    $catCondition = ' AND (cc.id=' . implode( ' OR cc.id=', $ids ) . ')';
    }
    if ($secid)
    {
    $ids = explode( ',', $secid );
    JArrayHelper::toInteger( $ids );
    $secCondition = ' AND (s.id=' . implode( ' OR s.id=', $ids ) . ')';
    }

    // Content Items only
    $query = 'SELECT a.*, ' .
    ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'.
    ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug'.
    ' FROM #__content AS a' .
    ($show_front == '0' ? ' LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id' : '') .
    ' INNER JOIN #__categories AS cc ON cc.id = a.catid' .
    ' INNER JOIN #__sections AS s ON s.id = a.sectionid' .
    ' WHERE '. $where .' AND s.id > 0' .
    ($access ? ' AND a.access <= ' .(int) $aid. ' AND cc.access <= ' .(int) $aid. ' AND s.access <= ' .(int) $aid : '').
    ($catid ? $catCondition : '').
    ($secid ? $secCondition : '').
    ($show_front == '0' ? ' AND f.content_id IS NULL ' : '').
    ' AND s.published = 1' .
    ' AND cc.published = 1' .
    ' ORDER BY '. $ordering;
    $db->setQuery($query, 0, $count);
    $rows = $db->loadObjectList();

    $i = 0;
    $lists = array();
    foreach ( $rows as $row )
    {
    if($row->access <= $aid)
    {
    $lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
    } else {
    $lists[$i]->link = JRoute::_('index.php?option=com_user&view=login');
    }

    $date = new JDate($row->created);

    $created_month = $date->toFormat("%m");
    $month_name = $date->toFormat("%B");
    $created_day = $date->toFormat("%d");
    $created_year = $date->toFormat("%Y");

    $lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
    $lists[$i]->showcreated = $created_day.'/ '.$created_month.'/ '.$created_year;
    $lists[$i]->title = htmlspecialchars($row->title);
    $lists[$i]->text = htmlspecialchars( substr( $row->title,0,23 ) )."...";
    $i++;
    }
    return $lists;
    }
    }
    und der default.php code:
    <?php // no direct access
    defined('_JEXEC') or die('Restricted access'); ?>
    <?php if (count($list)) : ?>
    <ul class="menu2">
    <li>
    <?php foreach ($list as $item) : ?>
    <a href="<?php echo $item->link; ?>" title=<?php echo $item->title; ?>" class="latestnews<?php echo $params->get('pageclass_sfx'); ?>">
    <?php echo $item->text; ?></a><span style="font-size: 8pt; padding-left:10px;">vom <?php echo $item->showcreated; ?></span>
    <hr /><?php endforeach; ?></li></ul>
    <?php endif;?>
    Es wird einfach nur das erste wort des titels angezeigt... an was könnte das nur liegen...
    bin für jee hilfe dankbar.
    mfg

  9. #8
    Gehört zum Inventar Avatar von blaulichttreff
    Registriert seit
    30.04.2007
    Ort
    Heidenrod
    Beiträge
    7.703
    Bedankte sich
    134
    Erhielt 2.557 Danksagungen
    in 2.421 Beiträgen

    Standard

    ja, den code kenne ich, habs mir ja auch umgebaut, hier links bei neuigkeiten
    der code sieht bei dir genauso aus wie bei mir, ich habe nur eine variable beim kürzen eingefügt, damit das vom backend steuerbar ist.

    gib doch mal einen link zu deiner seite.
    Gruß Sascha
    Viele kennen Google, aber nur wenige scheinen es zu nutzen Problem gelöst? | Joomla FAQ
    FF Springen

  10. #9
    Neu an Board
    Registriert seit
    29.08.2009
    Beiträge
    34
    Bedankte sich
    7
    Erhielt 0 Danksagungen
    in 0 Beiträgen

    Standard

    hey. die seite ist elider noch nciht online, aber hier der quelltext, irgendwas zerreißt die darstellung:
    <hr><a href="/allgemeines/bald" title="bald" geht="" s="" los="" class="latestnews">
    bald geht's los...</a><span style="font-size: 8pt; padding-left: 10px;">vom 15/ 12/ 2009</span>
    <hr></li>

  11. #10
    Gehört zum Inventar Avatar von blaulichttreff
    Registriert seit
    30.04.2007
    Ort
    Heidenrod
    Beiträge
    7.703
    Bedankte sich
    134
    Erhielt 2.557 Danksagungen
    in 2.421 Beiträgen

    Standard

    du hast auch was doppelt, fällt mir auf
    Code:
    if($row->access <= $aid)
    {
    $lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row ->slug, $row->catslug, $row->sectionid));
    } else {
    $lists[$i]->link = JRoute::_('index.php?option=com_user&view=login');
    }
    
    $date = new JDate($row->created);
    
    $created_month = $date->toFormat("%m");
    $month_name = $date->toFormat("%B");
    $created_day = $date->toFormat("%d");
    $created_year = $date->toFormat("%Y");
    
    $lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row ->slug, $row->catslug, $row->sectionid));
    $lists[$i]->showcreated = $created_day.'/ '.$created_month.'/ '.$created_year;
    $lists[$i]->title = htmlspecialchars($row->title);
    $lists[$i]->text = htmlspecialchars( substr( $row->title,0,23 ) )."...";
    $i++;
    }
    return $lists;
    }
    }
    Gruß Sascha
    Viele kennen Google, aber nur wenige scheinen es zu nutzen Problem gelöst? | Joomla FAQ
    FF Springen

  12. Erhielt Danksagungen von:


+ Antworten
Seite 1 von 2 1 2 LetzteLetzte

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein