Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-01-10 12:59:39

Katalonian
Member
From: Baku, Azerbaijan
Registered: 2010-04-18
Posts: 219
Website

show article's in category page

Hi, guys! how i can show list of articles in category page?
when i click to category link, page showing error, that i don’t have txp:article tag in this page (mysite.com/category/categoryname)
but i used in my default page tag:

<txp:if_category>

</>

i need to create section with name category ?

and!

how i can show articles only from one category, in which user clicked, without
<txp:if_category name /> ?

thanks!

Last edited by Katalonian (2011-01-10 13:00:23)


<txp:txp_me />

Offline

#2 2011-01-10 13:04:47

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: show article's in category page

Katalonian wrote:

how i can show articles only from one category, in which user clicked, without
<txp:if_category name /> ?

You don’t need to do anything special at all. Just put a regular article tag in the page template, where it will be seen. That is, if you need the if_category block, make sure it has an article tag in it (if there isn’t one elsewhere on the page).


Code is topiary

Offline

#3 2011-01-10 13:07:32

Katalonian
Member
From: Baku, Azerbaijan
Registered: 2010-04-18
Posts: 219
Website

Re: show article's in category page

but i did!! nothing happens. maybe, because i used txp:if search and txp if_individual_article in one page? and 3 <txp:else/> ?

and can i use for category pages another page\section (non-default) ?


<txp:txp_me />

Offline

#4 2011-01-10 13:58:04

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: show article's in category page

Katalonian wrote:

but i did!! nothing happens. maybe, because i used txp:if search and txp if_individual_article in one page? and 3 <txp:else/> ?

Maybe, but there’s no way we can tell unless you show us the whole template.

and can i use for category pages another page\section (non-default) ?

Page is controlled by section. I don’t recommend making a “category” section.


Code is topiary

Offline

#5 2011-01-10 14:02:18

Katalonian
Member
From: Baku, Azerbaijan
Registered: 2010-04-18
Posts: 219
Website

Re: show article's in category page


<txp:txp_me />

Offline

#6 2011-01-10 14:39:40

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: show article's in category page

Thanks. You didn’t close either of the article tags inside the if_category block.

Are you in debugging mode?


Code is topiary

Offline

#7 2011-01-10 14:58:13

Katalonian
Member
From: Baku, Azerbaijan
Registered: 2010-04-18
Posts: 219
Website

Re: show article's in category page

yes.
but, i cant see where i didn’t closed tag.


<txp:txp_me />

Offline

#8 2011-01-10 15:18:26

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: show article's in category page

Lines 21 and 26. (click “Expand” to see the line numbers.)

Edit: I ask again, is the site in debugging mode?

Last edited by jsoo (2011-01-10 15:23:52)


Code is topiary

Offline

#9 2011-01-10 15:29:24

Katalonian
Member
From: Baku, Azerbaijan
Registered: 2010-04-18
Posts: 219
Website

Re: show article's in category page

Dude, where you saw non closed tag here?) <txp:article form=“allnews” limit=“2” pgonly=“0” searchall=“1” sort=“Posted desc” status=“4”/>

Site in test mode, but now i changed to debug mode.


<txp:txp_me />

Offline

#10 2011-01-10 15:52:55

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: show article's in category page

My mistake :)

Now that you have the site in debug mode, you can look at the tag trace to figure out what’s happening.


Code is topiary

Offline

#11 2011-01-10 15:57:36

Katalonian
Member
From: Baku, Azerbaijan
Registered: 2010-04-18
Posts: 219
Website

Re: show article's in category page

Ошибка тега: -> Textpattern Notice: Шаблон main не содержит тег txp:article on line 543

textpattern/publish.php:543 trigger_error()
index.php:45 textpattern()

what in russian means page main- do not have tag _txp:article on line 543


<txp:txp_me />

Offline

#12 2011-01-10 16:00:35

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: show article's in category page

Katalonian wrote:

what in russian means page main- do not have tag _txp:article on line 543

Good strong hint, that. Means your template control structure is not accounting for the URL in question. That is, there is some case amidst your if statements you haven’t covered yet. What URL or URLs cause this message?


Code is topiary

Offline

#13 2011-01-10 16:02:18

Katalonian
Member
From: Baku, Azerbaijan
Registered: 2010-04-18
Posts: 219
Website

Re: show article's in category page

category urls

mysite.com/category/categoryname


<txp:txp_me />

Offline

#14 2011-01-10 16:12:19

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,502
Website GitHub

Re: show article's in category page

Your snippet of code works fine on its own page: I get a list of articles in the given category. But I’m assuming you must have more code somewhere else on that Page to handle display of the DTD and <head> section, etc.

As jsoo suggests, the error likely lies there — the usual cause of the ‘missing article tag’ error is an incorrectly-closed tag or a dangling <txp:else /> somewhere. Try making a copy of your page contents, strip it back to the bare elements (or clear it out completely) and build it up conditional-by-conditional to thoroughly check the logic of your page. As you paste chunks back in, you’ll usually find the error suddenly appears or something goes wrong so that helps pinpoint where the problem is.

EDIT: does the page validate? That can also sometimes flag errors.

Last edited by Bloke (2011-01-10 16:13:32)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB