Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-06-14 21:55:49

spiffin
Plugin Author
From: London, UK
Registered: 2004-06-08
Posts: 95
Website

Different background image per article

Hello

I’m trying to figure out how to set <txp:article_image /> as a background image for a div .. on a per article basis .. I’d basically like to tile a specific image in the background for each article in a section.

If anyone could suggest whether this is possible .. and point me in the right direction .. I’d be very grateful.

Thank you,

Simon

Offline

#2 2006-06-14 23:10:06

Elenita
Member
From: Falls Church, VA
Registered: 2004-05-16
Posts: 407
Website

Re: Different background image per article

Haven’t given this much thought, but perhaps put the URL of the article’s background image in a custom field, and then call to it using the <code><txp:custom_field /></code> tag?

Last edited by Elenita (2006-06-15 00:05:20)

Offline

#3 2006-06-14 23:33:37

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Different background image per article

Yep that’s one way of doing it, which I’ve used before, and it works quite well. :)

Offline

#4 2006-06-16 01:29:37

april19
Member
From: Sydney, Australia
Registered: 2006-03-15
Posts: 27
Website

Re: Different background image per article

spiffin,

you could do the above through having style=“background:<txp:custom_field />”

or to achieve true seperation of content and style

set the div with an id or class using the article id/title and code the background within the css file itself.

Offline

#5 2006-06-16 11:02:51

spiffin
Plugin Author
From: London, UK
Registered: 2004-06-08
Posts: 95
Website

Re: Different background image per article

Excellent .. thank you all for your help.

I made a custom field called ‘background’ and a form which wrapped the article in a div:

div style=“background: url(../images/<txp:custom_field name=“background” />) repeat;”

Simon

Last edited by spiffin (2006-06-16 11:03:09)

Offline

#6 2008-08-25 14:26:52

mkavici
New Member
From: Ankara Turkey
Registered: 2006-03-08
Posts: 9
Website

Re: Different background image per article

You may use
<txp:php>echo $thisarticle["article_image"];</txp:php>
if you don’t want to change your existing articles ;)


http://cssbased.com/ – designers love nature

Offline

#7 2008-08-25 14:34:27

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Different background image per article

mkavici wrote:

You may use…

Yo, this is Archive, place where old obsolete posts belong Posts that weren’t deleted, but instead archived.

Answering to these is no go, including finding something “current”, more likely you find the answer from somewhere else ;)

Last edited by Gocom (2008-08-25 14:35:41)

Offline

Board footer

Powered by FluxBB