Timeline - a responsive, mobile first theme

Skinning and designing Serendipity (CSS, HTML, Smarty)
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Timeline - a responsive, mobile first theme

Post by Don Chambers »

Cleanblog assigns entry header images using this:

Code: Select all

    {if $view=="entry"}
        {if $entry.properties.entry_specific_header_image}
            <style type="text/css">.intro-header {ldelim}background-image: url('{$entry.properties.entry_specific_header_image}');{rdelim}</style>         
        {else}
            <style type="text/css">.intro-header {ldelim}background-image: url('{if $template_option.entry_default_header_image}{$template_option.entry_default_header_image}{else}{serendipity_getFile file="img/post-bg.jpg"}{/if}');{rdelim}</style> 
        {/if}
It says to use a defined image for that entry if it exists...
... otherwise use a defined default image for all posts....
... otherwise use the theme's default image for an entry/post.

Lets say you had a series of images in the folder /img/ named background1.jpg, background2.jpg, background3.jpb, background4.jpg, and background5.jpg.

instead of using the default background image from the theme, I THINK you could do this (untested):

Code: Select all

    {if $view=="entry"}
        {if $entry.properties.entry_specific_header_image}
            <style type="text/css">.intro-header {ldelim}background-image: url('{$entry.properties.entry_specific_header_image}');{rdelim}</style>         
        {elseif $template_option.entry_default_header_image}
            <style type="text/css">.intro-header {ldelim}background-image: url('{$template_option.entry_default_header_image};{rdelim}</style>
        {else}
            {assign var=random_id value=1|mt_rand:5}
            <style type="text/css">.intro-header {ldelim}background-image: url({serendipity_getFile file="img/background{$random_id}.jpg"}');{rdelim}</style>
        {/if}
And there could be a cleaner way to do it, but this is the first thing that came to mind.
=Don=
thh
Regular
Posts: 419
Joined: Thu Oct 26, 2006 2:38 pm
Location: Stuttgart, Germany
Contact:

Re: Timeline - a responsive, mobile first theme

Post by thh »

sternchen wrote: Thu Oct 04, 2018 12:10 am My blog is mostly about photography and I'm linking to a SFPG (singe file php gallery) anyway, maybe flickr and instagram following.
Perhaps you may want to have a look at the Photo theme?

viewtopic.php?f=5&t=20044
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Timeline - a responsive, mobile first theme

Post by Don Chambers »

Not sure the method above will work for retrieving the image... maybe this will:

Code: Select all

        {else}
            {assign var=random_id value=1|mt_rand:5}
            <style type="text/css">.intro-header {ldelim}background-image: url('{$serendipityHTTPPath}templates/{$template}/img/background{$random_id}.jpg');{rdelim}</style>
        {/if}
=Don=
sternchen
Regular
Posts: 23
Joined: Tue Nov 04, 2014 9:19 am

Re: Timeline - a responsive, mobile first theme

Post by sternchen »

Hi Don,
thank you very much for that snippet of code. I've tried to include it last weekend but couldn't get it to run. Until now my skills are limited to css based changes like colors and fonts so I will have another try. Unfortunately I'm just able to work on my computer weekends so I will try again and with your second snippet next weekend.
Cheers, sternchen

@thh: I already had a look at the Photo theme but for some reason I don't like the style and I'm about to get confortable with Clean Blog.
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Timeline - a responsive, mobile first theme

Post by Don Chambers »

If your preference is the Timeline theme, but you want this banner behavior from Cleanblog, it should be possible. Otherwise it is just a matter of trial and error to get it to work. PM me if you need additional assistance.
=Don=
Huhu
Regular
Posts: 157
Joined: Tue Oct 04, 2011 3:22 pm

Re: Timeline - a responsive, mobile first theme

Post by Huhu »

I run into trouble with the categories. While they work smoothly in another timeline installation, somehow categories are not rendered / addressed in a new installation of timeline, and I have no idea why that is so. Checked quite a bit ... can't imagine that this is a timeline-exclusive error, though.

viewtopic.php?f=3&t=24090
Post-apocalyptic Jugger sports: What is Jugger? Video I Free ebook on the sport
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Timeline - a responsive, mobile first theme

Post by Don Chambers »

Your category problem does not appear to be related to the Timeline theme, but you can verify that by switching themes to 2k11 to see if the problem continues or is solved.
=Don=
Huhu
Regular
Posts: 157
Joined: Tue Oct 04, 2011 3:22 pm

Re: Timeline - a responsive, mobile first theme

Post by Huhu »

Thanks. Indeed the problem persists also with other themes, so no relation to the theme there as it seems. Don't know why I didn't do that simple check before ...
Post-apocalyptic Jugger sports: What is Jugger? Video I Free ebook on the sport
Post Reply