21
Bleekk
Re: use smartys in theme
  • 2014/1/8 21:32

  • Bleekk

  • Theme Designer

  • Posts: 941

  • Since: 2002/12/14


Ok now you can use category id to call the latest article from a certain category
<{xnews_latest ret='title' topic='2'}>

The category id is optional

Download it HERE

22
sova
Re: use smartys in theme
  • 2014/1/9 4:28

  • sova

  • Not too shy to talk

  • Posts: 149

  • Since: 2010/4/13


does not work
I'm using this code:
<{xnews_latest ret='image' topic='25'}>
<{xnews_latest ret='title' topic='25'}>
in theme
But what it does show.

23
Bleekk
Re: use smartys in theme
  • 2014/1/9 8:27

  • Bleekk

  • Theme Designer

  • Posts: 941

  • Since: 2002/12/14


xnews smarty works a little bit different

<{xnews_latest ret='image' topic='25'}> returns a image link
<a href="path_to_article"><img src="image.jpg"/>a>


<{xnews_latest ret='title'}> returns a link
<a href="path_to_article">article titlea>

24
sova
Re: use smartys in theme
  • 2014/1/9 8:44

  • sova

  • Not too shy to talk

  • Posts: 149

  • Since: 2010/4/13


Hi
Quote:

Bleekk wrote:
xnews smarty works a little bit different

<{xnews_latest ret='image' topic='25'}> returns a image link
<a href="path_to_article"><img src="image.jpg"/>a>


<{xnews_latest ret='title'}> returns a link
<a href="path_to_article">article titlea>

Explain more precisely?

----------------------------

This work is being done?
For example,
<div id="latest-news">
<{
xnews_latest topic='2'}>
<{
xnews_latest ret='image' width='80'px height='80'px}>
<{
xnews_latest ret='title' ch='85'}>
<{
xnews_latest ret='text' ch='220'}>
div>


ch => Characters

25
Bleekk
Re: use smartys in theme
  • 2014/1/9 9:29

  • Bleekk

  • Theme Designer

  • Posts: 941

  • Since: 2002/12/14


difference between publisher and xnews is following

<{publisher_latest ret='title'}> returns
This is my title

<{xnews_latest ret='title'}> returns
<a href="http://linkToArticle">This is my titlea>


If you want it to work like publisher then you need to edit the xnews code.

I would suggest you to use publisher instead of the xnews module

26
Mamba
Re: use smartys in theme
  • 2014/1/9 9:33

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Quote:
I would suggest you to use publisher instead of the xnews module

+1
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

27
heyula
Re: use smartys in theme
  • 2021/11/27 8:48

  • heyula

  • Theme Designer

  • Posts: 596

  • Since: 2008/4/24


Quote:
function.xoMemberInfo.php
Not working in new Publisher module

function smarty_function_publisher_latest($params, &$smarty
{
    
defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined");

    include_once 
XOOPS_ROOT_PATH '/modules/publisher/include/common.php';
       
    
$publisher =& PublisherPublisher::getInstance();
    
$myts =& MyTextSanitizer::getInstance();    

    
$itemsObj $publisher->getHandler('item')->getItems($limit 1$start 0'', -1$sort 'datesub'$order='DESC'''true$criteria nulltrue);
    
$totalItems count($itemsObj); 
    
    for ( 
$i 0$i $totalItems$i++ ) {
        
$title $itemsObj[$i]->title(); 
        
$images $itemsObj[$i]->getImages(); 
        if (
is_object($images['main'])) { 
                
$image XOOPS_URL '/uploads/' $images['main']->getVar('image_name'); 
            } 
        
        switch (
$params['ret']) {
            case 
'image':
                echo 
$image;        
                break;
            
            case 
'title':
                echo 
$title;
                break;
            
            default:
                echo 
$image;
                break;
        }
        
    }
}
?>
I think there is a problem because of the following codes
defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined");

    include_once 
XOOPS_ROOT_PATH '/modules/publisher/include/common.php';
       
    
$publisher =& PublisherPublisher::getInstance();
    
$myts =& MyTextSanitizer::getInstance();    

    
$itemsObj $publisher->getHandler('item')->getItems($limit 1$start 0'', -1$sort 'datesub'$order='DESC'''true$criteria nulltrue);

28
Mamba
Re: use smartys in theme
  • 2021/11/27 9:19

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


that code will not work, because it is outdated. For example, the line:

$publisher =& PublisherPublisher::getInstance();


won't work because "PublisherPublisher" doesn't exist anymore, it has been replaced by "Helper" and namespaces.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

Login

Who's Online

270 user(s) are online (132 user(s) are browsing Support Forums)


Members: 0


Guests: 270


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Dec 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits