我有简单的jquery文件,它可以播放新闻,但现在出现了一些问题而且它没有选择元素。在调试它时触发器中的空值。
Php文件的代码
<?php
/**
* copyright (C) 2008 GWE Systems Ltd - All rights reserved
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();
/**
* HTML View class for the module frontend
*
* @static
*/
include_once(JPATH_SITE."/modules/mod_jevents_latest/tmpl/default/latest.php");
class GeraintModLatestView extends DefaultModLatestView
{
function displayLatestEvents(){
$document = JFactory::getDocument();
$this->getLatestEventsData();
$content = "";
$var=count($this->eventsByRelDay);
$testVar=1;
if(isset($this->eventsByRelDay) && count($this->eventsByRelDay)){
$content .='<html>';
$content.='<body>';
$urls= "http://localhost/Mineral/modules/mod_jevents_latest/tmpl/myjs/jquery.min.js";
$content.='<script src="'.$urls.'"></script>';
$urls= "http://localhost/Mineral/modules/mod_jevents_latest/tmpl/myjs/slideshow.js";
$content.='<script src="'.$urls.'"></script>';
$content.='<script> jQuery.noConflict(true);</script>';
$content.='<div style="height:200px; width=300px; overflow: hidden; position:relative; top:0; border:5px double #206BA4; border-radius:7px; text-align:center; ">';
$content .= '<ul class="triggers" width="100%" border="0" cellspacing="0" cellpadding="0" align="center">';
// Now to display these events, we just start at the smallest index of the $this->eventsByRelDay array
// and work our way up.
$firstTime=true;
$lastElem=false;
// initialize name of com_jevents module and task defined to view
// event detail. Note that these could change in future com_event
// component revisions!! Note that the '$this->itemId' can be left out in
// the link parameters for event details below since the event.php
// component handler will fetch its own id from the db menu table
// anyways as far as I understand it.
$task_events = 'icalrepeat.detail';
$this->processFormatString();
foreach($this->eventsByRelDay as $relDay => $daysEvents){
reset($last);
reset($daysEvents);
// get all of the events for this day
foreach($daysEvents as $dayEvent){
if($testVar==$var)
$lastTime=true;
if(($dayEvent->bgcolor()=='#FF0000')&&($lastTime))
$dst = "text-decoration:blink;border-color:".$dayEvent->bgcolor();
else
$dst = "border-color:".$dayEvent->bgcolor();
if($firstTime) $content .= '<li style="'.$dst.'">';
else $content .= '<li style="'.$dst.'">';
// generate output according custom string
foreach($this->splitCustomFormat as $condtoken) {
if (isset($condtoken['cond'])) {
if ( $condtoken['cond'] == 'a' && !$dayEvent->alldayevent()) continue;
else if ( $condtoken['cond'] == '!a' && $dayEvent->alldayevent()) continue;
else if ( $condtoken['cond'] == 'e' && !($dayEvent->noendtime() || $dayEvent->alldayevent())) continue;
else if ( $condtoken['cond'] == '!e' && ($dayEvent->noendtime() || $dayEvent->alldayevent())) continue;
else if ( $condtoken['cond'] == '!m' && $dayEvent->getUnixStartDate()!=$dayEvent->getUnixEndDate() ) continue;
else if ( $condtoken['cond'] == 'm' && $dayEvent->getUnixStartDate()==$dayEvent->getUnixEndDate() ) continue;
}
foreach($condtoken['data'] as $token) {
unset($match);
unset($dateParm);
$dateParm="";
$match='';
if (is_array($token)) {
$match = $token['keyword'];
$dateParm = isset($token['dateParm']) ? trim($token['dateParm']) : "";
}
else if (strpos($token,'${')!==false){
$match = $token;
}
else {
$content .= $token;
continue;
}
$this->processMatch($content, $match, $dayEvent, $dateParm,$relDay);
} // end of foreach
} // end of foreach
$content .= "</li>\n";
$firstTime=false;
$testVar++;
} // end of foreach
} // end of foreach
//$content=var_dump($var);
$content .="</ul>";
$content .="</div>";
$content .="</body>";
$content .="</html>";
} else {
$content.='<div style="height:200px; width=300px; overflow: hidden; position:relative; top:0; border:5px double #206BA4; border-radius:7px; text-align:center; ">';
$content .= '<ul class="mod_events_latest_table" width="100%" border="0" cellspacing="0" cellpadding="0" align="center">';
$content .= '<li class="mod_events_latest_first" >'. JText::_('JEV_NO_EVENTS') . '</li>' . "\n";
$content .="</ul>\n";
$content.='</div>';
}
$callink_HTML = '<div class="mod_events_latest_callink">'
.$this->getCalendarLink()
. '</div>';
if ($this->linkToCal == 1) $content = $callink_HTML . $content;
if ($this->linkToCal == 2) $content .= $callink_HTML;
if ($this->displayRSS){
$rssimg = JURI::root() . "media/system/images/livemarks.png";
$callink_HTML = '<div class="mod_events_latest_rsslink">'
.'<a href="'.$this->rsslink.'" title="'.JText::_("RSS_FEED").'" target="_blank">'
.'<img src="'.$rssimg.'" alt="'.JText::_("RSS_FEED").'" />'
.JText::_("SUBSCRIBE_TO_RSS_FEED")
. '</a>'
. '</div>';
$content .= $callink_HTML;
}
return $content;
} // end of function
} // end of class
Jquery文件
$(window).load(function ()
{
jQuery.noConflict();
var triggers = $('ul.triggers li');
var lastElem = triggers.length-1;
var target;
triggers.first().addClass('selected');
triggers.hide().first().show();
function sliderResponse(target)
{
triggers.removeClass('selected').
fadeOut(9000).eq(target).addClass('selected').fadeIn(9000);
}
function sliderTiming()
{
if(triggers.length==1)
{
triggers.first().show();
clearInterval(timingRun);
}
else
{
target = $('ul.triggers li.selected').index();
if ( target === lastElem )
{ target = 0; }
else
{ target = target+1; }
sliderResponse(target);
}
}
var timingRun = setInterval(function() { sliderTiming(); },9000);
function resetTiming()
{
clearInterval(timingRun);
timingRun = setInterval(function() { sliderTiming(); },9000);
}
});
同一文件在其他joomla模板中正常工作。并且我认为他们不应该是任何冲突的问题,因为我通过禁用其他模型来检查它。