1
heyula
Publisher SliderProblem
  • 2019/6/19 16:36

  • heyula

  • Theme Designer

  • Posts: 605

  • Since: 2008/4/24


Working on older versions of the publisher

le="color: #000000"><?php <{php}> include_once XOOPS_ROOT_PATH . '/modules/publisher/include/common.php'; $publisher =& PublisherPublisher::getInstance(); $myts =& MyTextSanitizer::getInstance(); $itemsObj = $publisher->getHandler('item')->getItems($limit = 10, $start = 0, array(_PUBLISHER_STATUS_PUBLISHED), -1, $sort = 'datesub', $order='DESC', '', true, $criteria = null, true); $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 --> <div id="slider"> <a href="#" id="prev" class="notext"></a> <a href="#" id="next" class="notext"></a> <div id="slider-content"> <ul> <{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}> <li> <div class="left-side"> <a href="<{$xoops_url}>/modules/publisher/item.php?itemid=<{$itemid}>"><img src="<{$image}>" alt="<{$title}>" width="400px" height="200px"/></a> </div> <div class="right-side" > <h1><a href="<{$xoops_url}>/modules/publisher/item.php?itemid=<{$itemid}>" title="<{$title}>"><{$title}></h1> <p><{$body|truncate:220}></p> <p class="readmore"><a style="color:#ff0000" href="<{$xoops_url}>/modules/publisher/item.php?itemid=<{$itemid}>">ÊÊãÉ &raquo;</a></p> </div> <div class="cl">&nbsp;</div> </li> <{php}> } <{/php}> </ul> </div> </div> <!-- End Slider -->


Can we run this code for the current publisher

2
goffy
Re: Publisher SliderProblem
  • 2019/6/20 11:48

  • goffy

  • Just can't stay away

  • Posts: 554

  • Since: 2010/12/27


hi

1) I do not know which file you mean? want do you want to achieve?
2) did you try the code? try and error is the best teacher I learned php also myself most with try and error but ofcourse I am always willy to help

kind regards
goffy

3
goffy
Re: Publisher SliderProblem
  • 2019/6/20 11:56

  • goffy

  • Just can't stay away

  • Posts: 554

  • Since: 2010/12/27


hi

btw you should try to split php and html code - create a tpl-file and assign with smarty vars is the better way

4
iHackCode
Re: Publisher SliderProblem

Try this.

le="color: #000000"><?php <{php}> use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; $helper = Publisher\Helper::getInstance(); $myts =& MyTextSanitizer::getInstance(); $itemsObj = $helper->getHandler('Item')->getItems($limit = 10, $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 --> <div id="slider"> <a href="#" id="prev" class="notext"></a> <a href="#" id="next" class="notext"></a> <div id="slider-content"> <ul> <{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}> <li> <div class="left-side"> <a href="<{$xoops_url}>/modules/publisher/item.php?itemid=<{$itemid}>"><img src="<{$image}>" alt="<{$title}>" width="400px" height="200px"/></a> </div> <div class="right-side" > <h1><a href="<{$xoops_url}>/modules/publisher/item.php?itemid=<{$itemid}>" title="<{$title}>"><{$title}></h1> <p><{$body|truncate:220}></p> <p class="readmore"><a style="color:#ff0000" href="<{$xoops_url}>/modules/publisher/item.php?itemid=<{$itemid}>">ÊÊãÉ &raquo;</a></p> </div> <div class="cl">&nbsp;</div> </li> <{php}> } <{/php}> </ul> </div> </div> <!-- End Slider -->

5
heyula
Re: Publisher SliderProblem
  • 2020/6/28 10:57

  • heyula

  • Theme Designer

  • Posts: 605

  • Since: 2008/4/24


Hi iHackCode

yes this code worked very thanks

6
Yurdal
Re: Publisher SliderProblem
  • 2020/6/29 19:29

  • Yurdal

  • Friend of XOOPS

  • Posts: 395

  • Since: 2005/3/27


Hi Eren, what is the filename you are altering ?
Please share with us , maybe it become handy for future use

Login

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!