Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-08-07 14:32:40

swati.miniyar
Member
Registered: 2007-08-06
Posts: 39

articles from a category

I want to display categories with their number of articles on a page.If i click on it,it should show list of articles title in it on other page.When i click on article,i should get the detailed article on another page.
How to do this?Any help please?

Last edited by swati.miniyar (2007-08-07 14:34:00)

Offline

#2 2007-08-07 16:14:53

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: articles from a category

Offline

#3 2007-08-08 04:39:34

swati.miniyar
Member
Registered: 2007-08-06
Posts: 39

Re: articles from a category

Thank u so much developer..
But i have tried this.its not giving me exactly what i want !!

What i want is…
listing of all categories with article count from my section=“archive” on a page.clicking on that category.should go to the next page,where all the article title from that category only will be displayed.And clicking on the articles it should give that article in detail but on other page.. I m getting the listing of categoties and articles..But when i click on the article it shows other articles title
also and i am getting error like this-

tag_error -> Textpattern Notice: Page template article_archive does not contain a txp:article tag on line 464

anybody please help me out to solve this..

Last edited by swati.miniyar (2007-08-08 04:42:13)

Offline

#4 2007-08-08 06:11:52

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: articles from a category

That error is easy: place <txp:article />-tag in your pagetemplate, because you don’t have it in there. Nothing big error – it isn’t even error, only shows in tagtrace and debugging.

And that archieve… It would work by those tips that Mary pointed out.

Example code:

<txp:if_section name="archive">
<txp:cbs_category_list showcount="true" wraptag="div" section="archieve" />
<txp:article limit="9999" listform="title-list" />
</txp:if_section>

Article-form named title-list:

<txp:permlink><txp:title /></txp:permlink><br />

So simple, cheers!

Last edited by Gocom (2007-08-08 06:12:43)

Offline

#5 2007-08-08 06:32:43

swati.miniyar
Member
Registered: 2007-08-06
Posts: 39

Re: articles from a category

thanks a lot 4 ur help..
but still its not solving my problem..

what i did is
created a section archive which uses page- “Article-archive”.
On default page im displaying all the categories from archive using-

<txp:cbs_category_list showcount=“true” section=“Archive” break=”,”/>

when i click on these categories..I go to the “Article-archive” page where im listing the articles from that category and section=archive.i want to show only their titles there .i have used this-

<txp:php> echo article_custom(array(‘section’=>$GLOBALS[‘pretext’][‘s’], ‘form’=>‘article_list’,‘pageby’=>‘3’,‘category’=>$GLOBALS[‘pretext’][‘c’], ));
</txp:php>

upto this i did properly..
But my problem is..
when i click on the article i should get the article in detail..i want to show it another page template called “archive” … which i m not getting..please help me out…

Last edited by swati.miniyar (2007-08-08 06:33:35)

Offline

#6 2007-08-08 07:31:54

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: articles from a category

Instead of:

<txp:php>
     echo article_custom(array('section'=>$GLOBALS['pretext']['s'],
     'form'=>'article_list','pageby'=>'3','category'=>$GLOBALS['pretext']['c'],
     ));
</txp:php>

Why not use:

<txp:article listform="article_list" pageby="3" />

Offline

#7 2007-08-08 07:50:57

swati.miniyar
Member
Registered: 2007-08-06
Posts: 39

Re: articles from a category

because i want to show articles from section=archive and category whichever i have clicked on.nyway it gives me proper results..but problem is i am not getting detailed article..Please help..
It may be very simple but i am not getting any clue…

Offline

#8 2007-08-08 08:37:16

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: articles from a category

What page/template do you use for displaying the single article and what does that page contain?

Offline

#9 2007-08-08 08:50:13

swati.miniyar
Member
Registered: 2007-08-06
Posts: 39

Re: articles from a category

to display single article i am using archive page.it contains <txp:article limit=“5” />

Offline

#10 2007-08-08 09:08:37

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: articles from a category

On the write tab, what section did you selected for the articles you want to display?
What URLs are generated for the individual article pages (an example URL would be nice).

Offline

#11 2007-08-08 09:48:20

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: articles from a category

Can you post the contents of your “article_archive” template here, because there’s still an error showing that the <txp:article /> tag is not present in that page.

Offline

#12 2007-08-08 09:53:47

swati.miniyar
Member
Registered: 2007-08-06
Posts: 39

Re: articles from a category

These are contents of article_archive..

<txp:php> echo article_custom(array(‘section’=>‘archive’, ‘form’=>‘article_list’,‘category’=>$GLOBALS[‘pretext’][‘c’], ));
</txp:php>

the same error i am getting..

Last edited by swati.miniyar (2007-08-08 09:55:49)

Offline

#13 2007-08-08 10:32:56

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: articles from a category

<txp:article_custom /> is not the same as <txp:article />, so try something like this instead:

<txp:if_article_list>
  <txp:php>
     echo article_custom(array('section'=>'archive',
     'form'=>'article_list','category'=>$GLOBALS['pretext']['c'],
     ));
  </txp:php>
<txp:else />
  <txp:article limit="5" />
</txp:if_article_list>

Offline

#14 2007-08-08 11:14:14

swati.miniyar
Member
Registered: 2007-08-06
Posts: 39

Re: articles from a category

Thank u soooooo much!!!
Its giving me results..But not exactly what i want!!!Its giving me result on article-archive…i want to show it
on archive..
The listing of article title i am getting on article archive.If i click on title its giving the detailed article on that page only..
I want to show the article in detai on other page-archive.. this section (Archive) uses page as article-archive..

My simple question is—
Can i go from one page-template to other page-template?

Last edited by swati.miniyar (2007-08-08 11:29:34)

Offline

#15 2007-08-08 13:12:25

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: articles from a category

Its giving me result on article-archive…i want to show it on archive..

Correct me if I’m wrong, but is this what you want:

  • http://www.csaserv.com/rocketsociety/Archive/ -> show list of articles using ‘article-archive’ template
  • http://www.csaserv.com/rocketsociety/Archive/id/title -> show individual article using ‘article’ template

That’s not possible… but what you can do is:

<!-- common parts at the top of both archive and article-archive here -->
<txp:if_article_list>
  <!-- specific article-archive template code here (for article list) -->
  <txp:php>
     echo article_custom(array('section'=>'archive',
     'form'=>'article_list','category'=>$GLOBALS['pretext']['c'],
     ));
  </txp:php>
<txp:else />
  <!-- specific article template code here (for individual article) -->
  <txp:article limit="5" />
</txp:if_article_list>
<!-- common parts at the bottom of both archive and article-archive here -->

And you probably can replace the whole PHP part with <txp:article listform=“article_list” />

Offline

Board footer

Powered by FluxBB