Modüller

Xoops bünyesindeki tüm modüller bir tıklama ile kaldırılabilir / etkinleştirilebilir / devre dışı bırakılabilir.Kolay yönetilir sistem.

Kullanıcı Yönetimi

Kullanıcıları çeşitli kriterlere göre arama, mesajlaşma sistemi aracılığıyla e-posta ve özel mesaj gönderme özelliği.

Güçlü Tema Yapısı

Güçlü bir tema sistemi ile, hem yöneticiler hem kullanıcılar, bir fare tıklamasıyla tüm web sitesinin görünümünü değiştirebilir.

TDMDownloads arrow Hack - Tips arrow New Block for Publisher Module
New Block for Publisher Module
New Block for Publisher Module

Modül Versiyonu: 1.0
  • Submission Date: 11/27/2021
  • Submitted by: Admin
  • Downloads: 65
  • Comments (0)
Platform
Download & Sosyal Ağlar

New Block for Publisher Module

With this code, you can pull content added to the publisher module wherever you want in your theme.


Add to your theme:

<{includeq file="$theme_name/random-news.tpl"}>

or

<{includeq file="$theme_name/date-news.tpl"}>

Code Content :

Random News :

<{php}>
use 
XoopsModulesPublisher;
use 
XoopsModulesPublisherConstants;

$helper PublisherHelper::getInstance();
$myts =& MyTextSanitizer::getInstance();
$itemsObj $helper->getHandler('Item')->getItems($limit 3$start 0, [Constants::PUBLISHER_STATUS_PUBLISHED], -1$sort 'RAND()'$order=''''true$criteria null);
$totalItems count($itemsObj);

global 
$items;
$items = array();
if (
$itemsObj) {
    for ( 
$i 0$i $totalItems$i++ ) {
        
$newItems['itemid']       = $itemsObj[$i]->itemid();
        
$newItems['title']        = $itemsObj[$i]->title();
        
$newItems['body']         = $itemsObj[$i]->body();
        
$newItems['votes']        = $itemsObj[$i]->votes();
        
$newItems['image']        = XOOPS_URL '/uploads/blank.gif';
        
$images $itemsObj[$i]->getImages();
        if (
is_object($images['main'])) {
            
$newItems['image'] = XOOPS_URL '/uploads/' $images['main']->getVar('image_name');
        }
    
$items[] = $newItems;
    }
}
<{/
php}>
<!-- 
Slider -->
        
        
            <{
php}>
        foreach ( 
$GLOBALS['items'] as $myrow )
        {
            
$GLOBALS['xoopsTpl']->assign('itemid'$myrow['itemid']);
            
$GLOBALS['xoopsTpl']->assign('title'$myrow['title']);
            
$GLOBALS['xoopsTpl']->assign('body'$myrow['body']);
            
$GLOBALS['xoopsTpl']->assign('votes'$myrow['votes']);
            
$GLOBALS['xoopsTpl']->assign('image'$myrow['image']);
        <{/
php}>
<
div class="col-lg-4 col-md-12 col-xl-4">
<
div class="card">
                <
div class="img-fix-height cover-image">
                <
img src="<{$image}>">
                </
div>
                <
div class="card-body p-4">
                    <
a href="<{$xoops_url}>/modules/publisher/item.php?itemid=<{$itemid}>" class="text-dark"><h4 class="font-weight-semibold text-truncate mb-3"><{$title}></h4></a>
                    <
class="fix-max-height"><{$body|truncate:230}></p>
                    <
br>
                    <
class="btn btn-primary btn-teal" href="<{$xoops_url}>/modules/publisher/item.php?itemid=<{$itemid}>">Read more</a>
                </
div>
</
div>
</
div>
        <{
php}>
        }
        <{/
php}>


Date News:

<{php}>
use 
XoopsModulesPublisher;
use 
XoopsModulesPublisherConstants;

$helper PublisherHelper::getInstance();
$myts =& MyTextSanitizer::getInstance();
$itemsObj $helper->getHandler('Item')->getItems($limit 3$start 0, [Constants::PUBLISHER_STATUS_PUBLISHED], -1$sort 'datesub'$order='DESC'''true$criteria null);
$totalItems count($itemsObj);

global 
$items;
$items = array();
if (
$itemsObj) {
    for ( 
$i 0$i $totalItems$i++ ) {
        
$newItems['itemid']       = $itemsObj[$i]->itemid();
        
$newItems['title']        = $itemsObj[$i]->title();
        
$newItems['body']         = $itemsObj[$i]->body();
        
$newItems['votes']        = $itemsObj[$i]->votes();
        
$newItems['image']        = XOOPS_URL '/uploads/blank.gif';
        
$images $itemsObj[$i]->getImages();
        if (
is_object($images['main'])) {
            
$newItems['image'] = XOOPS_URL '/uploads/' $images['main']->getVar('image_name');
        }
    
$items[] = $newItems;
    }
}
<{/
php}>
<!-- 
Slider -->
        
        
            <{
php}>
        foreach ( 
$GLOBALS['items'] as $myrow )
        {
            
$GLOBALS['xoopsTpl']->assign('itemid'$myrow['itemid']);
            
$GLOBALS['xoopsTpl']->assign('title'$myrow['title']);
            
$GLOBALS['xoopsTpl']->assign('body'$myrow['body']);
            
$GLOBALS['xoopsTpl']->assign('votes'$myrow['votes']);
            
$GLOBALS['xoopsTpl']->assign('image'$myrow['image']);
        <{/
php}>
<
div class="col-lg-4 col-md-12 col-xl-4">
<
div class="card">
                <
div class="img-fix-height cover-image">
                <
img src="<{$image}>">
                </
div>
                <
div class="card-body p-4">
                    <
a href="<{$xoops_url}>/modules/publisher/item.php?itemid=<{$itemid}>" class="text-dark"><h4 class="font-weight-semibold text-truncate mb-3"><{$title}></h4></a>
                    <
class="fix-max-height"><{$body|truncate:230}></p>
                    <
br>
                    <
class="btn btn-primary btn-teal" href="<{$xoops_url}>/modules/publisher/item.php?itemid=<{$itemid}>">Read more</a>
                </
div>
</
div>
</
div>
        <{
php}>
        }
        <{/
php}>



Definitions in Code :

7th in line of code

$limit = 3 : How many articles are published
$start = 0 : From which category (0 for all categories)


<{$title}> = Article Title
<{$itemid}> = Article ID
<{$body|truncate:230}> = Article Content
<{$xoops_url}>/modules/publisher/item.php?itemid=<{$itemid}> = Article Link
<{$image}> = Article Image
<{$votes}> = Article Votes