Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
9 - 7 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     

Re: Publisher Random Item Image
by Zap_English on 2017/5/7 8:29:04

That fixed it

YOU DA MAN, BLEEKK!
Re: Publisher Random Item Image
by Bleekk on 2017/5/7 8:19:23

Add this line to the Block function
le="color: #000000"><?php $block['title'] = $itemsObj->title();
Re: Publisher Random Item Image
by Zap_English on 2017/5/7 7:59:21

OK, that worked, HOORAY!

But it caused another problem. Not sure why

The first line of the tpl file I had inserted <center><h4><{$block.title}></h4></center> so that it would display the title of the item.

the next line is your block image, modified as

<img src="<{$block.item_image}>" alt="" width="100" height="100" align="left" style="padding:5px;"/>

So now it displays the image correctly, and the beginning text of the article, but it stopped showing the Title. Now sure why that's happening
Re: Publisher Random Item Image
by Bleekk on 2017/5/6 18:31:28

items_random_item.php change the publisher_items_random_item_show function
le="color: #000000"><?php function publisher_items_random_item_show($options) { $block = array(); $publisher = PublisherPublisher::getInstance(); // creating the ITEM object $itemsObj = $publisher->getHandler('item')->getRandomItem('', array(PublisherConstants::PUBLISHER_STATUS_PUBLISHED)); if (!is_object($itemsObj)) { return $block; } $block['content'] = $itemsObj->getBlockSummary(300, true); //show complete summary but truncate to 300 if only body available $block['id'] = $itemsObj->itemid(); $block['url'] = $itemsObj->getItemUrl(); $image = $itemsObj->getMainImage(); $block['image'] = $image['image_path']; if(!$block['image']){ $block['image'] = "path_to_your_default_image"; } $block['lang_fullitem'] = _MB_PUBLISHER_FULLITEM; return $block; }
in template add this
le="color: #000000"><?php <img src="<{$block.image}>"/>
Re: Publisher Random Item Image
by Zap_English on 2017/5/6 17:52:56

Quote:

trabis wrote:
$mainImage = $itemsObj ->getMainImage();

in #2 use this
le="color: #000000"><?php $mainImage = $itemsObj - >getMainImage(); if(!$mainImage['image_path'] ){ $mainImage['image_path']='urltoyourdefaultimage'; }

Not tested, sent by phone.

Who's Online

185 user(s) are online (154 user(s) are browsing Support Forums)


Members: 0


Guests: 185


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