this is the full code of all my module files :
please help me to get where is my fault ?
the xml file : mod_yendifvideoshare_videos.xml
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="4.0" method="upgrade" client="site">
<name>mod_yendifvideoshare_videos</name>
<creationDate>January 2025</creationDate>
<copyright>Copyright (c) 2012 - 2025 PluginsWare Interactive Pvt. Ltd. All Rights Reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<author>PluginsWare Interactive Pvt. Ltd</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://yendifplayer.com/</authorUrl>
<version>2.1.4</version>
<description>MOD_YENDIFVIDEOSHARE_VIDEOS_XML_DESCRIPTION</description>
<namespace path="src">PluginsWare\Module\YendifVideoShareVideos</namespace>
<files>
<folder module="mod_yendifvideoshare_videos">services</folder>
<folder>src</folder>
<folder>tmpl</folder>
<folder>language</folder>
</files>
<scriptfile>script.php</scriptfile>
<media destination="mod_yendifvideoshare_videos" folder="media">
<filename>joomla.asset.json</filename>
<folder>js</folder>
</media>
<config>
<fields name="params"> ....
this is my helper code : YendifVideoShareVideosHelper.php
Code: Select all
<?php
/**
* @version 2.1.1
* @package Com_YendifVideoShare
* @subpackage Mod_YendifVideoShare_Videos
* @author PluginsWare Interactive Pvt. Ltd <[email protected]>
* @copyright Copyright (c) 2012 - 2023 PluginsWare Interactive Pvt. Ltd. All Rights Reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace PluginsWare\Module\YendifVideoShareVideos\Site\Helper;
\defined( '_JEXEC' ) or die;
use Joomla\CMS\Factory;
use Joomla\Registry\Registry;
use Joomla\Database\DatabaseInterface;
use Joomla\Module\Logged\Administrator\Helper\LoggedHelper;
use Joomla\CMS\Language\Text;
/**
* Helper for mod_yendifvideoshare_videos
*
* @since 2.0.0
*/
Class YendifVideoShareVideosHelper {
/**
* Retrieve videos
*
* @param Joomla\Registry\Registry &$params Module parameters
*
* @return array The videos list.
*
* @since 2.0.0
*/
public static function getItemsAjax( &$params ) {
$app = Factory::getApplication();
$db = Factory::getDbo();
$query = 'SELECT * FROM #__yendifvideoshare_videos WHERE state = 1';
if ( $catid = $params->get( 'catid' ) ) {
if ( is_array( $catid ) ) {
$catids = array_map( 'intval', $catid );
$catids = array_filter( $catids );
if ( ! empty( $catids ) ) {
$query .= ' AND catid IN (' . implode( ',', $catids ) . ')';
}
} else {
$query .= ' AND catid = ' . (int) $catid;
}
}
if ( $app->input->get( 'option' ) == 'com_yendifvideoshare' && $app->input->get( 'view' ) == 'video' && $id = $app->input->getInt( 'id' ) ) {
$query .= ' AND id != ' . $id;
}
if ( $params->get( 'filterby' ) == 'featured' ) {
$query .= ' AND featured = 1';
}
if ( $params->get( 'schedule_video_publishing' ) ) {
$nullDate = $db->getNullDate();
$nowDate = Factory::getDate()->toSql();
$query .= ' AND (published_up IS NULL OR published_up = ' . $db->quote( $nullDate ) . ' OR published_up <= ' . $db->quote( $nowDate ) . ')';
$query .= ' AND (published_down IS NULL OR published_down = ' . $db->quote( $nullDate ) . ' OR published_down >= ' . $db->quote( $nowDate ) . ')';
}
switch ( $params->get( 'orderby' ) ) {
case 'latest':
$query .= ' ORDER BY id DESC';
break;
case 'date_added':
$query .= ' ORDER BY created_date DESC';
break;
case 'most_viewed':
$query .= ' ORDER BY views DESC';
break;
case 'most_rated':
$query .= ' ORDER BY rating DESC';
break;
case 'a_z':
$query .= ' ORDER BY title ASC';
break;
case 'z_a':
$query .= ' ORDER BY title DESC';
break;
case 'random':
$query .= ' ORDER BY RAND()';
break;
default:
$query .= ' ORDER BY ordering ASC';
}
$limit = (int) $params->get( 'no_of_rows', 3 ) * (int) $params->get( 'no_of_cols', 3 );
$db->setQuery( $query, 0, $limit );
$items = $db->loadObjectList();
return $items;
}
}
this is my dispatcher code dispatcher.php
Code: Select all
<?php
namespace PluginsWare\Module\YendifVideoShareVideos\Site\Dispatcher;
\defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
use Joomla\CMS\Helper\HelperFactoryAwareInterface;
use Joomla\CMS\Helper\HelperFactoryInterface;
use Joomla\CMS\Helper\HelperFactoryAwareTrait;
use Joomla\CMS\Language\Text;
use PluginsWare\Module\YendifVideoShareVideos\Site\Helper\YendifVideoShareVideosHelper;
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
{
use HelperFactoryAwareTrait;
}
this is my provider.php code
Code: Select all
<?php
/**
* @package WT Yandex Map items
*
* @copyright (C) 2022 Sergey Tolkachyov
* @link https://web-tolk.ru
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Extension\Service\Provider\HelperFactory;
use Joomla\CMS\Extension\Service\Provider\Module;
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
/**
* The WT Yandex map items module service provider.
*
* @since 1.0.0
*/
return new class implements ServiceProviderInterface
{
public function register(Container $container)
{
// Module namespace
$container->registerServiceProvider(new ModuleDispatcherFactory('\\PluginsWare\\Module\\YendifVideoShareVideos'));
// Module HELPER Namespace
$container->registerServiceProvider(new HelperFactory('\\PluginsWare\\Module\\YendifVideoShareVideos\\Site\\Helper'));
$container->registerServiceProvider(new Module);
}
};
this is my joomla.asset json code :
Code: Select all
{
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
"name": "mod_yendifvideoshare_videos",
"version": "1.0.0",
"description": "videos module to show videos on the site",
"license": "GPL-2.0-or-later",
"assets": [
{
"name": "mod_yendifvideoshare_videos.add-suffix",
"type": "script",
"uri": "mod_yendifvideoshare_videos/add-suffix.js",
"dependencies": [
"jquery", "core", "messages"
],
"version": "1.1.0"
}
]
}
this is my js code add-suffix.js :
Code: Select all
function loadmore_videos() {
let loadvideos = document.querySelector('.sof-videos-row');
Joomla.request({
url: 'index.php?option=com_ajax&module=yendifvideoshare_videos&method=getItems&format=json',
method: 'POST',
onSuccess(data) {
const response = JSON.parse(data);
if (response.success) {
loadvideos.innerHTML = response.data;
} else {
const messages = {"error": [response.message]};
Joomla.renderMessages(messages);
}
},
onError(xhr) {
Joomla.renderMessages(Joomla.ajaxErrorsMessages(xhr));
const response = JSON.parse(xhr.response);
Joomla.renderMessages({"error": [response.message]}, undefined, true);
}
});
}
this is my code in default.php (not all the file code):
Code: Select all
<?php
defined( '_JEXEC' ) or die;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Date\Date;
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
use PluginsWare\Component\YendifVideoShare\Site\Helper\YendifVideoShareHelper;
use PluginsWare\Component\YendifVideoShare\Site\Helper\YendifVideoSharePlayer;
use PluginsWare\Component\YendifVideoShare\Site\Helper\YendifVideoShareRoute;
use PluginsWare\Module\YendifVideoShareVideos\Site\Helper\YendifVideoShareVideosHelper;
$document = $app->getDocument();
$wa = $document->getWebAssetManager();
$wr = $wa->getRegistry();
$wr->addRegistryFile('media/mod_yendifvideoshare_videos/joomla.asset.json');
$wa->useScript('mod_yendifvideoshare_videos.add-suffix');
// Pass the suffix to add down to js
$document->addScriptOptions('vars', array('suffix' => "!"));
$app = Factory::getApplication();
<div class="yendif-row sof-videos-row"></div>
<div onClick="loadmore_videos()" class="sof-loadmore-button" >see more videos</div>
my issue is :
Code: Select all
The file at mod_yendifvideoshare_videos/helper.php does not exist.
how to address the com-ajax to define the function getItemsAjax in YendifVideoShareVideosHelper.php ?
i hope some one can help me to fix my issue