Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-09-02 21:25:35

coleh
Member
From: Edinburgh, UK
Registered: 2007-08-16
Posts: 28
Website

[SOLVED] Sticky article image

Hi

Really basic question am sure but how best do I display an image or images defined in the Article Image field for a sticky article?
I have tried using both the core article_image tag and the fantastic hak_article_image plugin but to no avail. Am assuming that a sticky article is taken out of context – in other words the section is pulling in the article. If so, is there a way round this issue or would images have to be hand coded into the relevant page or form, or placed in the content of the article itself (rather than associated with it)?

Cheers

Cole

Last edited by coleh (2009-09-02 23:35:44)


Jack of all trades, Doctor of one

Offline

#2 2009-09-02 21:49:20

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [SOLVED] Sticky article image

Where are you using the image tag? To display a sticky article you need an article or article_custom tag with a status="sticky" attribute.

Offline

#3 2009-09-02 21:52:14

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [SOLVED] Sticky article image

Regarding on how to associate a image to an sticky article or a live article, there are no difference.

I assume you can see the sticky article (on your site) but not the image associated to it, right?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2009-09-02 22:07:13

coleh
Member
From: Edinburgh, UK
Registered: 2007-08-16
Posts: 28
Website

Re: [SOLVED] Sticky article image

Thanks for responses

The article is showing fine. I am pulling in a sticky article using an ol’ fashioned <txp:article status=“sticky” /> but any attempt to bring in the associated image is failing :(

In terms of the context of use I have a default page template which pulls in a form called meta_footer.
This useful chap brings in the usual page end gubbins (javascript calls, html close, etc) as well as a side column that brings in any files or images associated with an article. Alas neither are brought through on a sticky article page with an article_image returning the following error:

Tag error: <txp:article_image /> -> Textpattern Notice: Article tags cannot be used outside an article context on line 2075

Any suggestions? Think am probably just misinterpreting how sticky articles work.
Textpattern version is 4.0.8

Cole


Jack of all trades, Doctor of one

Offline

#5 2009-09-02 22:32:54

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [SOLVED] Sticky article image

coleh wrote:

as well as a side column that brings in any files or images associated with an article. Alas neither are brought through on a sticky article page with an article_image returning the following error:

Tag error: <txp:article_image /> -> Textpattern Notice: Article tags cannot be used outside an article context on line 2075

Then my guess is that you are not using an article tag in the meta_footer form? Can you post the code you have in that form?

Offline

#6 2009-09-02 22:36:30

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [SOLVED] Sticky article image

So, you are looking at sticky on its permlink, right?
Like: /section/my-sticky-article-title/.

And as I understand, all your article tags on page template and meta_footer form are working fine (meta_footer returns files/images associated) for live articles (/section/my-live-article-title), but not for sticky articles.

In that case, this report may be considered somehow a bug (imho), because when you are on an individual article context, you are definitely looking at an article, and so, other article_ (article_image, etc) tags on that page (even if they are not directly wrapped or embed on an article form) should be rendered. TXP shoukd “know” that it’s displaying an individual article, without caring if it’s sticky or live.

I’ve reported this before. I’ll bump that thread.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#7 2009-09-02 22:42:21

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [SOLVED] Sticky article image

Ah, I remember your post Julián. Now it’s starting to make sense to me ;) Still, I’d like to see the tags used in the footer form.

Offline

#8 2009-09-02 23:35:29

coleh
Member
From: Edinburgh, UK
Registered: 2007-08-16
Posts: 28
Website

Re: [SOLVED] Sticky article image

SOLVED

@maniqui:

So, you are looking at sticky on its permlink, right?
Like: /section/my-sticky-article-title/.

Thus exposing my ignorance.
I was not accessing the article via its permalink as I thought the sticky article was intended to be used outwith an article context (if that makes sense), for example pulled in to summarise or introduce or support a section. In this instance I was using the sticky article ‘About Us’ in the ‘About’ section which was accessed via /about/ rather than /about/about-us

As I mentioned, the article is displayed fine in this context but any associated context is not.
I can see now why this is the case. Custom fields are only accessed via the article id/title parsed to textpattern, whether via a URL or through a sticky article call. The relevant call that I was making to any associated images/files was outwith this context and therefore not returning any results.

Realising the error of my ways I instead tried using txp:article as a container rather than as a single tag, nesting the requisite image/file tags within, eg:

<txp:article status="sticky">
<h1><txp:title /></h1>
<txp:body />
</div>
<div id="sub_content" class="grid_3">
<txp:hak_article_image wraptag="ul" break="li" class="article_image" form="article_image" />
<txp:upm_article_file_list form="files" class="supporting" label="Downloads" labeltag="h3" wraptag="ul" break="li" />
</txp:article>

All now works like a charm :D

Cheers for reply – sometimes you need a second pair of eyes to help see what’s right in front of you ;)

Cole


Jack of all trades, Doctor of one

Offline

#9 2009-09-02 23:37:59

coleh
Member
From: Edinburgh, UK
Registered: 2007-08-16
Posts: 28
Website

Re: [SOLVED] Sticky article image

Els wrote:

Then my guess is that you are not using an article tag in the meta_footer form? Can you post the code you have in that form?

Absolutely correct – see previous post for solution.
Thanks for response

Cole


Jack of all trades, Doctor of one

Offline

Board footer

Powered by FluxBB