как говориться всё, да не всё. Вывести вывел, а вот с обновлением пока беда. именно с обновление Description. Я в принципе понимаю почему, потому что в update.js и ajax.php не задано соответствующего контента.
Файл update.js содиржимое:
IceCastUpdater = new Class({
title: '',
el: Class.empty,
active: false,
initialize: function(id, el) {
this.id = id;
this.el = el;
this.update.periodical(5000, this);
},
update: function() {
var t = this;
if (this.active) return;
this.active = true;
var myAjax = new Ajax(siteroot + '/modules/mod_icecast/ajax.php?id=' + this.id + '&ts=' + $time(), {
method: 'get',
onComplete: function(response) {
t.active = false;
var result = Json.evaluate(response);
$ES('.icecast-song', t.el).setText(result.title);
$ES('.icecast-listeners', t.el).setText(result.listeners);
}
}).request();
}
});
window.addEvent('domready', function() {
$$('.icecast_title').each(function(el) {
new IceCastUpdater(el.getText(), el.getParent());
});
});
тут как я понял надо добавить строчку $ES('.icecast-description', t.el).setText(result.description); после $ES('.icecast-listeners', t.el).setText(result.listeners);
и ajax.php
<?php
/**
* ICECAST - A Joomla internet radio statistic module
* @version 1.0.9
* @package mod_icecast.zip
* @copyright (C) 2010 by sli
*/
/*
* Поскольку этот скрипт является отдельной точкой входа,
* инициализируем фреймворк так же, как это сделано в /index.php
*/
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(dirname(dirname(__FILE__))) );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
// Подключаем хелпер
require_once(dirname(__FILE__).DS.'helper.php');
jimport('joomla.application.module.helper');
function paramsById($id)
{
$db = JFactory::getDBO();
$db->setQuery('SELECT params FROM #__modules WHERE id = '. $db->quote($id));
return new JParameter($db->loadResult());
}
$data = ModHelperIceCast::getParams(paramsById(JRequest::getInt('id')));
if (!isset($data->listeners)) {
$data->listeners = 0;
$data->cur_song = 'n/a';
}
echo '{listeners: ', $data->listeners, ', title: "', str_replace('"', '\'\'', $data->cur_song), '"}';
?>
как я понял мне надо что-то дописать в этой части:
if (!isset($data->listeners)) {
$data->listeners = 0;
$data->cur_song = 'n/a';
}
echo '{listeners: ', $data->listeners, ', title: "', str_replace('"', '\'\'', $data->cur_song), '"}';
Вот только мой прежний метод эксперементов не помог, прошу вашей помощи.