Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-12-06 16:05:22
- fowler
- Member
- Registered: 2007-02-12
- Posts: 79
Add a class to a div specific to an article..
I swear TXP allowed you to do this before 4.3.0. I’m trying to add a class to a div in the Form area that would look like this..
<div class="article_<txp:article_id />"><txp:body /></div>
would output this:
<div class="article_24">This is a post!</div>
but I’m now getting this warning..
Tag error: <txp:article_id /> -> Textpattern Notice: Article tags cannot be used outside an article context on line 2291
hopefully that makes sense.
Last edited by fowler (2010-12-06 16:05:57)
Offline
#2 2010-12-06 16:16:42
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: Add a class to a div specific to an article..
<div class="article_'<txp:article_id />'"><txp:body /></div>
Offline
#3 2010-12-06 16:17:45
- fowler
- Member
- Registered: 2007-02-12
- Posts: 79
Re: Add a class to a div specific to an article..
thank you.
am i crazy, or did that just change?
edit, didn’t work.
Last edited by fowler (2010-12-06 16:19:46)
Offline
#4 2010-12-06 16:24:04
- fowler
- Member
- Registered: 2007-02-12
- Posts: 79
Re: Add a class to a div specific to an article..
I figured it out, sorta.
I was stuffing the code inside a <txp:permalink />
tag (forgot to mention that part)
I changed the code to this and it worked fine:
<a href="/<txp:section />/<txp:article_url_title />" class="<txp:article_url_title />">Title</a>
Last edited by fowler (2010-12-06 16:24:23)
Offline
#5 2010-12-06 16:24:28
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: Add a class to a div specific to an article..
My previous answer does not make sense. Sorry.
Is the article shown as a individual article or within as a article list?
Offline
#6 2010-12-06 17:55:08
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Add a class to a div specific to an article..
fowler wrote:
Tag error: <txp:article_id /> -> Textpattern Notice: Article tags cannot be used outside an article context on line 2291
Just what it says… ;) In your case wrapping it in <txp:if_individual_article>
tags should help. Either that or use it in an article form or inside <txp:article>
or <txp:article_custom>
tags.
Offline