Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-12-19 15:29:47

nickoli
New Member
From: Stoke-on-Trent
Registered: 2007-07-03
Posts: 9
Website

"Article tags cannot be used outside an article" - can't find cause

I’m getting the error
Tag error: <txp:title /> -> Textpattern Notice: Article tags cannot be used outside an article context on line 2069

It only occurs when the following block is on a page:

<div id="preview">
	<h2>Latest Picture:</h2>
	<txp:article_custom allowoverride="0" form="picture_thumbnail" limit="1" pgonly="0" section="pictures" />
	<h2>From the Blog:</h2>
	<txp:article_custom allowoverride="0" excerpted="1" limit="1" pgonly="0" section="blog" form="excerpt" />
	<h2>Something Awesome:</h2>
	<txp:article_custom allowoverride="0" excerpted="1" limit="1" pgonly="0" section="awesome" sort="rand()" form="excerpt" />
</div>

The form picture_thumbnail doesn’t contain a <txp:title /> tag.
The form excerpt does, but it works properly, and removing it from the form doesn’t remove the error.
Apart from the <h2> tags, everything is in <txp:article_custom /> tags anyway, which the FAQ (http://textpattern.com/faq/271/article-tags-cannot-be-used-outside-an-article-context) says is a valid place to put them. Any idea what I’m missing?

(Edit: added bc. for better code display. -Els)

Last edited by els (2008-12-19 17:21:08)

Offline

#2 2008-12-19 17:25:43

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

Re: "Article tags cannot be used outside an article" - can't find cause

Is it possible that you have a <txp:title /> somewhere else on the page (e.g. inside the <title> tags in the head section)?

If not, can you post the tag trace of that page?

Offline

#3 2008-12-19 20:27:38

nickoli
New Member
From: Stoke-on-Trent
Registered: 2007-07-03
Posts: 9
Website

Re: "Article tags cannot be used outside an article" - can't find cause

Problem (kind of) solved.

I tried searching for “title” on the page and found no instances of <txp:title />
Also, the error only occurs when I have the section I pasted in earlier is present. I can cut it, save, and it returns with no errors.

Tag trace: http://pastebin.com/m12da6f6f

Reading through the Tag Trace I’ve found what caused the error, but still don’t really understand why the error occured. It’s this form:

<txp:permlink title=” <txp:title />”><txp:article_image thumbnail=“1” /></txp:permlink>

Presumably a <txp:title /> tag can’t be used as an attribute like that, but it is in an article form, being called by a <txp:custom_article /> tag.

Offline

#4 2008-12-19 22:14:06

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

Re: "Article tags cannot be used outside an article" - can't find cause

Presumably a <txp:title /> tag can’t be used as an attribute like that, but it is in an article form, being called by a <txp:custom_article /> tag.

If you are using 4.0.7, you need to do it like this (single quotes instead of double):

<txp:permlink title='<txp:title />'><txp:article_image thumbnail="1" /></txp:permlink> 

Before 4.0.7 you couldn’t do this without a plugin.

Textbook: Parsing Tag Attributes.

Offline

#5 2008-12-19 22:52:11

nickoli
New Member
From: Stoke-on-Trent
Registered: 2007-07-03
Posts: 9
Website

Re: "Article tags cannot be used outside an article" - can't find cause

Thank you for that: everything works as I expected it to now.

Offline

Board footer

Powered by FluxBB