1
Zap_English
Publisher Default Image

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

2
Bleekk
Re: Publisher Default Image
  • 2017/1/31 22:03

  • Bleekk

  • Theme Designer

  • Posts: 941

  • Since: 2002/12/14


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.

3
Zap_English
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 (http://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

4
Bleekk
Re: Publisher Default Image
  • 2017/2/1 12:13

  • Bleekk

  • Theme Designer

  • Posts: 941

  • Since: 2002/12/14


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

5
Zap_English
Re: Publisher Default Image

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

6
Bleekk
Re: Publisher Default Image
  • 2017/2/3 21:32

  • Bleekk

  • Theme Designer

  • Posts: 941

  • Since: 2002/12/14


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

7
Zap_English
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

8
geekwright
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.

9
Zap_English
Re: Publisher Default Image

What about "smartclone", would that work?

10
Bleekk
Re: Publisher Default Image
  • 2017/2/4 13:10

  • Bleekk

  • Theme Designer

  • Posts: 941

  • Since: 2002/12/14


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

Login

Who's Online

320 user(s) are online (186 user(s) are browsing Support Forums)


Members: 0


Guests: 320


more...

Donat-O-Meter

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

Latest GitHub Commits