xoops forums

Zap_English

Quite a regular
Posted on: 2017/1/31 18:10
Zap_English
Zap_English (Show more)
Quite a regular
Posts: 384
Since: 2016/5/24
#1

Publisher Default Image

Is there a way for a Publisher article to default to a specific image if another image is not available?

Bleekk

Theme Designer
Posted on: 2017/1/31 22:03
Bleekk
Bleekk (Show more)
Theme Designer
Posts: 935
Since: 2002/12/14
#2

Re: Publisher Default Image

Yes, in the Article template there is a check if a article Image exists. All you need to do is to link your Image if a article Image does not exist.

Zap_English

Quite a regular
Posted on: 2017/2/1 9:39
Zap_English
Zap_English (Show more)
Quite a regular
Posts: 384
Since: 2016/5/24
#3

Re: Publisher Default Image

XOOPS Version XOOPS 2.5.8.1
PHP Version 5.6.28
mySQL Version 5.5.5-10.1.19-MariaDB

Publisher
Version : 1.03 RC 1
Author : Trabis (www.Xuups.com)
Credits : w4z004, hsalazar, Mithrandir, fx2024, Ackbarr, Mariuss, Marco, Michiel, phppp, outch, Xvitry, Catzwolf, Shine, McDonald, trabis, Mowaffak, Bandit-x, Shiva
Licence : GNU GPL 2.0 or later
Publishing Solution for your XOOPS Site

There is nothing in the preferences about default images

Bleekk

Theme Designer
Posted on: 2017/2/1 12:13
Bleekk
Bleekk (Show more)
Theme Designer
Posts: 935
Since: 2002/12/14
#4

Re: Publisher Default Image

No there is no option you need to change the template. For example: Open publisher/templates/publisher_item.tpl Find this (line 23)
<{if $item.image_path}>
    <
li>
        <
a href="<{$item.image_path}>">
            <
img src="<{$item.image_thumb}>" alt="<{$item.image_name}>"/>
        </
a>
        </
li>
<{/if}>
So here you can add a ELSE and display your image if there is no article image
<{if $item.image_path}>
    <
li>
        <
a href="<{$item.image_path}>">
            <
img src="<{$item.image_thumb}>" alt="<{$item.image_name}>"/>
        </
a>
        </
li>
<{else}>
    <
li>
        <
a href="<{$item.image_path}>">
            <
img src="YOUR_IMAGE_URL" alt="<{$item.image_name}>"/>
        </
a>
        </
li>
<{/if}>
where YOUR_IMAGE_URL is the url where your image is on the server

Zap_English

Quite a regular
Posted on: 2017/2/3 19:43
Zap_English
Zap_English (Show more)
Quite a regular
Posts: 384
Since: 2016/5/24
#5

Re: Publisher Default Image

I tried your fix but unfortunately it doesn't do anything

Bleekk

Theme Designer
Posted on: 2017/2/3 21:32
Bleekk
Bleekk (Show more)
Theme Designer
Posts: 935
Since: 2002/12/14
#6

Re: Publisher Default Image

do you use the xboorstrap theme? if so then go to themes/xbootstrap/modules/publisher/publisher_item.tpl find this
<{if $item.image_path || $item.images}>
        <
figure>
            <{if 
$item.images}>
                <
div id="articleslider" style="margin-bottom:10px;">
                    <
div class="item">
                        <
img class="img-responsive" src="<{$item.image_path}>"/>
                    </
div>
                    <{foreach 
item=image from=$item.images}>
                        <
div class="item">
                            <
img class="img-responsive" src="<{$image.path}>" alt="<{$image.name}>"/>
                        </
div>
                    <{/foreach}>
                </
div>
            <{elseif 
$item.image_path}>
                <
img style="margin-bottom:15px;" class="img-responsive" src="<{$item.image_path}>" alt="<{$item.image_name}>"/>
            <{/if}>
        </
figure>
    <{/if}>
and replace with
<{if $item.image_path || $item.images}>
        <
figure>
            <{if 
$item.images}>
                <
div id="articleslider" style="margin-bottom:10px;">
                    <
div class="item">
                        <
img class="img-responsive" src="<{$item.image_path}>"/>
                    </
div>
                    <{foreach 
item=image from=$item.images}>
                        <
div class="item">
                            <
img class="img-responsive" src="<{$image.path}>" alt="<{$image.name}>"/>
                        </
div>
                    <{/foreach}>
                </
div>
            <{elseif 
$item.image_path}>
                <
img style="margin-bottom:15px;" class="img-responsive" src="<{$item.image_path}>" alt="<{$item.image_name}>"/>
            <{/if}>
        </
figure>
    <{else}>
          <
img class="img-responsive" src="YOUR_IMAGE_URL">
    <{/if}>
again YOUR_IMAGE_URL is the path to your image

Zap_English

Quite a regular
Posted on: 2017/2/3 23:13
Zap_English
Zap_English (Show more)
Quite a regular
Posts: 384
Since: 2016/5/24
#7

Re: Publisher Default Image

Still doesn't work

And I'm using clones of Publisher, which xBootstrap doesn't handle.

I've tried both codes and neither show the image

geekwright

Quite a regular
Posted on: 2017/2/4 4:28
geekwright
geekwright (Show more)
Quite a regular
Posts: 302
Since: 2010/10/15
#8

Re: Publisher Default Image

Quote:

Zap_English wrote:
...
And I'm using clones of Publisher, which xBootstrap doesn't handle.
...


xBootstrap's look comes from override templates in the theme. The theme's templates need to be cloned, too. The publisher clone process does NOT do that.

When you clone publisher, it creates clones of all of its templates under the new name. You would have to manually make a copy of the xbootstrap/modules/publisher folder and templates to match the new cloned name.

For example, if you clone "publisher" to "pubclone" then you need to copy xbootstrap/modules/publisher to xbootstrap/modules/pubclone and then rename all the templates from publisher_*.tpl to pubclone_*.tpl. Also, there are things in most of the templates which will need to be adjusted, too - variables like $publisher_url, included templates like db:publisher_header.tpl, css class names publisher-*, and constants _MB_PUBLISHER_* would all need to be changed too.

The clone function makes a lot of little changes to the files. It would probably be possible to make a "clone publisher templates in a theme" function based on the existing cloning code, but it could get messy.

Crazy idea that should work. You could copy the xbootstrap/modules/publisher templates directly into the publisher/templates directory and then clone it. That way the cloning process would make all the needed changes. The only downside would be that any clones would be locked into xbootstrap -- not really a problem if that is what you are using. Might be worth trying.

Zap_English

Quite a regular
Posted on: 2017/2/4 10:22
Zap_English
Zap_English (Show more)
Quite a regular
Posts: 384
Since: 2016/5/24
#9

Re: Publisher Default Image

What about "smartclone", would that work?

Bleekk

Theme Designer
Posted on: 2017/2/4 13:10
Bleekk
Bleekk (Show more)
Theme Designer
Posts: 935
Since: 2002/12/14
#10

Re: Publisher Default Image

as geekwright described copy
themes/xbootstrap/modules/publisher
to
themes/xbootstrap/modules/your_clone
and change the name of the templates

you can then make the changes in the cloned folder