101
zyspec
Re: Publisher Random Item Image
  • 2017/5/4 15:07

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Afraid not... Here's the code from GitHub v1.03 RC1 for ./blocks/items_random_item.php:

getHandler('item')->getRandomItem('', array(PublisherConstants::PUBLISHER_STATUS_PUBLISHED));
    if (!
is_object($itemsObj)) {
        return 
$block;
    }
    
$block['content']       = $itemsObj->getBlockSummary(300true); //show complete summary  but truncate to 300 if only body available
    
$block['id']            = $itemsObj->itemid();
    
$block['url']           = $itemsObj->getItemUrl();
    
$block['lang_fullitem'] = _MB_PUBLISHER_FULLITEM;
    return 
$block;
}


*Edit: You can see it directly here:
https://github.com/XoopsModules25x/publisher/blob/1.03_RC1/blocks/items_random_item.php

You won't find the original code you posted in there anywhere... So you must have gotten that code from somewhere else.



102
zyspec
Re: Publisher Random Item Image
  • 2017/5/4 14:34

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Probably did crash it...

I assumed that when you said the code above came from items_random_item.php that it did, apparently not. Where did the code above come from?



103
zyspec
Re: Publisher Random Item Image
  • 2017/5/4 13:45

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


I'm not sure exactly which version you're using so I can't give you an exact line number but.... just add the following:
if (empty($mainImage['image_path'])) { 
    
$mainImage['image_path'] = <path_to_your_default_image// this should be something like "publisher/default.jpg"
}


immediately following the line:
$mainImage $itemsObj->getMainImage();


in the items_random_item.php file (from the code you posted above).



104
zyspec
Re: Publisher Random Item Image
  • 2017/5/4 13:06

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Quote:

Zap_English wrote:
ok, I found it

in items_random_item.php

$mainImage $itemsObj->getMainImage(); // check to see if GD function exist if (!function_exists('imagecreatetruecolor')) { $block['item_image'] = $mainImage['image_path']; } else { $block['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '&amp;w=' . $imgwidth; // No $imgheight for autoheight option }


template publisher_items_random_item.html

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


Now the big question... I also have coding to display a default image if an item doesn't have an assigned imagefrom this thread

So, how can I get the random item block to show the default image, if an assigned image doesn't exist.

Basically, both bits of code have to be merged


You can add a check to see if the image is empty and then substitute your default image. Something like:
$mainImage $itemsObj->getMainImage(); // check to see if GD function exist
if (empty($mainImage['image_path'])) {
    
$mainImage['image_path'] = <path_to_your_default_image// this should be something like "publisher/default.jpg"
}
if (!
function_exists('imagecreatetruecolor')) { 
    
$block['item_image'] = $mainImage['image_path']; 
} else { 
    
$block['item_image'] = PUBLISHER_URL '/thumb.php?src=' $mainImage['image_path'] . '&amp;w=' $imgwidth// No $imgheight for autoheight option
}


I believe your default image should be placed in the ./uploads /publisher directory.



105
zyspec
Re: xsitemap alternative theme
  • 2017/5/3 22:34

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


@aerograf / @Bleekk,

There was a new version of xsitemap uploaded today (v1.54 Beta) that you might want to look at before you modify anything other than templates. There were quite a few changes/improvements so it would be better to start modifying that version so we don't have to merge your new changes from an older version.



106
zyspec
Re: Blank page on new server
  • 2017/4/21 18:37

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


This may be obvious, but you did create the dB tables in the database, correct? Make sure you pay special attention to the dB_prefix because this may have changed too...

And "everything else" that goes along with the dB - created user with appropriate rights, etc?



107
zyspec
Re: Module icontent - problem
  • 2017/3/25 21:50

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


my stupid mistake - again... there's an extra closing parenthesis in the statement above... *sigh*

just remove one of the ')' at the end so it looks like:

$GLOBALS['xoopsOption']['xoops_pagetitle'] = htmlspecialchars($page->nameENT_QUOTES);



108
zyspec
Re: Module icontent - problem
  • 2017/3/24 16:01

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


No, you're right - sorry...

I just forgot the page title isn't "really" a meta tag. Try the following instead to see if this does what you want.
$GLOBALS['xoopsOption']['xoops_pagetitle'] = htmlspecialchars($page->nameENT_QUOTES));


Hopefully I did it right this time...



109
zyspec
Re: Module icontent - problem
  • 2017/3/23 15:26

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Hadesteam,

First - A warning, try this on a test server first since I haven't actually inserted this code in a working copy of icontent...

in ./index.php add the following after line 101 - which is:
include_once(XOOPS_ROOT_PATH.'/header.php');

$xoTheme->addMeta('meta''title'htmlspecialchars($page->nameENT_QUOTES));


I think this will do what you want... which, as I understand it, is to change the <title> meta keyword to the page title...



110
zyspec
Re: APCal 2.22 Beta-1 available for testing (XOOPS 2.5.8, PHP 7)
  • 2017/3/16 21:58

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Since what's on my branch seems to have improved things (and didn't make anything worse) I'll do a pull request and get it back into the XOOPS master branch on github...




TopTop
« 1 ... 8 9 10 (11) 12 13 14 ... 100 »



Login

Who's Online

206 user(s) are online (147 user(s) are browsing Support Forums)


Members: 0


Guests: 206


more...

Donat-O-Meter

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

Latest GitHub Commits