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
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
Wie genau schneidest du denn den Beitragstitel ab?
Gruß
Kubik-Rubik.de - Entdecke die vielfältigen Möglichkeiten!
Easybook Reloaded - SIGE - Simple Image Gallery Extended - EasyCalcCheck Plus - Skript - PHP Backlink Checker
Mittels core hack, rot markiert.
helper.php:
default.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;
}
}
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?<?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;?>
mfg
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 nutzenProblem gelöst? | Joomla FAQ
FF Springen
Dank dir erstmal.
Ein titel wird zwar angezeigt, aber leider nur das erste wort...
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 nutzenProblem gelöst? | Joomla FAQ
FF Springen
Danke für deine mühe, also das ist der helper code:
und der default.php 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;
}
}
Es wird einfach nur das erste wort des titels angezeigt... an was könnte das nur liegen...<?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;?>
bin für jee hilfe dankbar.
mfg
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 nutzenProblem gelöst? | Joomla FAQ
FF Springen
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>
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 nutzenProblem gelöst? | Joomla FAQ
FF Springen
Lesezeichen