Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-04-23 19:13:20

osugodfan
Member
Registered: 2008-03-16
Posts: 16

How do I change the image of every article?

I’ve got a site that basically has The following code in the page template:

<div id=“header” class=”<txp:section />”>
<h2><txp:section /></h2>
</div><!— End Header —>
<div id=“main”>
<txp:if_section name=“comma,separated,name,list”>
<txp:article limit=“1” />
</txp:if_section>
</div><!— End Main —>

and using this method, I can set my css to load a particular background image into the header div for each section. Works like a charm on all the different sections, but now my boss wants me to change the image for each different article. I’ve got image url’s in their respective article_image fields, but I can’t put article tags like <txp:article_image /> in the Page Template. I feel like I’m just on the cusp of being able to make this work, but hoping that I could get some assistance on structuring this properly. Thanks!

Last edited by osugodfan (2010-04-23 19:24:16)

Offline

#2 2010-04-23 19:26:57

kevinpotts
Member
From: Ghost Coast
Registered: 2004-12-07
Posts: 370

Re: How do I change the image of every article?

You could try something like this:

<div id=“header” class=”<txp:section />”>
<h2><txp:section /></h2>
</div><!— End Header —>
<div id=“main”>
<txp:if_section name=“comma,separated,name,list”>
<txp:article limit=“1” />
<txp:article limit=“1”><txp:article_image /></txp:article> <!-- can place anywhere in the template you'd like -->
</txp:if_section>
</div><!— End Main —>

Kevin
(graphicpush)

Offline

#3 2010-04-23 19:44:16

osugodfan
Member
Registered: 2008-03-16
Posts: 16

Re: How do I change the image of every article?

Perfect! I’m glad to see it was that easy.

Offline

Board footer

Powered by FluxBB