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

  • Bleekk

  • Theme Designer

  • Posts: 942

  • Since: 2002/12/14


Ok now you can use category id to call the latest article from a certain category
le="color: #000000"><?php <{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: 942

  • Since: 2002/12/14


xnews smarty works a little bit different

<{xnews_latest ret='image' topic='25'}> returns a image link
le="color: #000000"><?php <a href="path_to_article"><img src="image.jpg"/></a>


<{xnews_latest ret='title'}> returns a link
le="color: #000000"><?php <a href="path_to_article">article title</a>

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
le="color: #000000"><?php <a href="path_to_article"><img src="image.jpg"/></a>


<{xnews_latest ret='title'}> returns a link
le="color: #000000"><?php <a href="path_to_article">article title</a>

Explain more precisely?

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

This work is being done?
For example,
le="color: #000000"><?php <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: 942

  • Since: 2002/12/14


difference between publisher and xnews is following

<{publisher_latest ret='title'}> returns
le="color: #000000"><?php This is my title

<{xnews_latest ret='title'}> returns
le="color: #000000"><?php <a href="http://linkToArticle">This is my title</a>


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: 11521

  • 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: 605

  • Since: 2008/4/24


Quote:
function.xoMemberInfo.php
Not working in new Publisher module
<?php 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 = null, true); $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
le="color: #000000"><?php 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 = null, true);

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

  • Mamba

  • Moderator

  • Posts: 11521

  • Since: 2004/4/23


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

le="color: #000000"><?php $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

Who's Online

159 user(s) are online (103 user(s) are browsing Support Forums)


Members: 0


Guests: 159


more...

Donat-O-Meter

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

Latest GitHub Commits