xoops forums

heyula

Theme Designer
Posted on: 6/19 16:36
heyula
heyula (Show more)
Theme Designer
Posts: 467
Since: 2008/4/24
#1

Publisher SliderProblem

Working on older versions of the publisher

<{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 nulltrue);
$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>
                        
                        <
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

goffy

Quite a regular
Posted on: 6/20 11:48
goffy
goffy (Show more)
Quite a regular
Posts: 369
Since: 2010/12/27
#2

Re: Publisher SliderProblem

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

goffy

Quite a regular
Posted on: 6/20 11:56
goffy
goffy (Show more)
Quite a regular
Posts: 369
Since: 2010/12/27
#3

Re: Publisher SliderProblem

hi

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