Page 1 of 1

[Feature request] Custom header image plug-in

Posted: Fri Sep 07, 2018 12:55 pm
by Huhu
Hej!
I am very happy with Don Chamber's Clean Blog theme.
Clean Blog addresses an issue that is quite important to me: You can assign custom images to the header section. So I can build a "static" website using Clean Blog and assign fitting header images for each topic.
But when using another theme, this option is of course not present.

Now, it shouldn't be hard to make the feature available as a plug-in for every theme. It should work like "Extended properties for entries".

While I would be glad to help and support such a plug-in, I am not enough of a coder to be able to realize it.

Anyone capable and willing?

Re: [Feature request] Custom header image plug-in

Posted: Thu Sep 20, 2018 1:23 pm
by garvinhicking
Hej!

I understand the wish, however I see a problem with this. The header area is very much dependant on the used template. I do not see a generic way to support this with a plugin, because it always depends on the used HTML layout of a template. So I think it would be better for each template to support the option instead...?!

Re: [Feature request] Custom header image plug-in

Posted: Fri Sep 21, 2018 10:01 am
by Huhu
Hej!
Ah okay, thank. I'd love to isolate DonChambers Clean Blog entry head chooser and implement it, but for now I am just too overwhelmed by all those file references/dependencies that it does seem to carry with it.

Re: [Feature request] Custom header image plug-in

Posted: Sat Sep 22, 2018 10:54 pm
by Don Chambers
Am I understanding you correctly:

You want to use the timeline theme, but display a category specific sub header on entry pages instead of the same sub header on all pages?

If so, it might be fairly easy.

In index.tpl is this:

Code: Select all

{* SUBHEADER IMAGE *}    
{if $template_option.subheader_img}
    <style type="text/css">.subheader_image {ldelim}background-image: url('{$template_option.subheader_img}');{rdelim}</style>
{/if}
You could try changing that code to this (untested):

Code: Select all

{* SUBHEADER IMAGE *}
{if $template_option.subheader_img}
    {if $entry.categories}
        {foreach from=$entry.categories item="entry_category"}
            {if $entry_category.category_icon}
                <style type="text/css">.subheader_image {ldelim}background-image: url('{$entry_category.category_icon}');{rdelim}</style>
                {break}
            {/if}
        {/foreach}
    {else}
        <style type="text/css">.subheader_image {ldelim}background-image: url('{$template_option.subheader_img}');{rdelim}</style>
    {/if}
{/if}
That SHOULD emit the image for the first category that has a category image for entry views, then use the defined sub header image for everything else.

You will need to delete the category images from line 95 of entries.tpl:

Code: Select all

{if $entry.categories}{foreach from=$entry.categories item="entry_category"}{if $entry_category.category_icon}<a href="{$entry_category.category_link}"><img class="serendipity_entryIcon" title="{$entry_category.category_name|@escape}{$entry_category.category_description|@emptyPrefix}" alt="{$entry_category.category_name|@escape}" src="{$entry_category.category_icon}"></a>{/if}{/foreach}{/if}
I have not tested this, but it should work, or get you fairly close to what you want.

Re: [Feature request] Custom header image plug-in

Posted: Mon Sep 24, 2018 9:16 am
by Huhu
Hej Don,

wow, that looks great. I'll try it out soon and report back.
Thanks a bunch and a brilliant week to both of you :)