Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-02-21 21:41:39

King Rat
Member
Registered: 2004-11-11
Posts: 20

table of contents on /section/

What I’d like to do is have <code>mysite.com/section/id/title</code> display the full article, but <code>mysite.com/section/</code> display a list of all articles under that section.

Is this possible? Right now I can’t find a way of doing a TOC without using a special section for it.

Last edited by King Rat (2005-02-21 21:42:15)

Offline

#2 2005-02-21 21:51:49

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: table of contents on /section/

It should. Right now with RC3 default install, /section/ display all articles under that section (with full bodies, but than can be adressed with the appropriate form).

What will be tricky, is to have the same with /section/category/ when there are nested subcatégories and you want them in that page, but not always in the flow of the others.

Last edited by Jeremie (2005-02-21 21:52:52)

Offline

#3 2005-02-21 22:04:37

King Rat
Member
Registered: 2004-11-11
Posts: 20

Re: table of contents on /section/

Eh, I see I didn’t fully describe my problem. My mistake.

I need the <code>/section/</code> to display a different form tnam <code>/section/id/title</code>. I have a listform that shows only title, author and date that I want for the TOC. And then I want the full article to display for the single article page. If I set the section to use the listform, then the individual article also uses it. If I set the article to override the form, it overrides the listform as well. Which isn’t optimal for me ;(

I’m not so concerned about the <cpde>/section/category/</code>. I’m not using categories in the URLs, although if my problem is solved, it souldn’t be too hard to generalize the solution to include categories in URLs.

Offline

#4 2005-02-21 22:09:33

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: table of contents on /section/

What you need is two forms. One when there is only one article displayed, and the other when there are multiples articles on the webpage viewed.

Look at “Custom Article Ouput” in pages and the manual.

Offline

#5 2005-02-22 04:25:20

iammattthomas
Member
From: Closing in on the capital
Registered: 2004-03-19
Posts: 12
Website

Re: table of contents on /section/

It’s simple. Have one form for the list (i.e. “article_list”) and one for the full article (i.e. “article”), and use conditional tags to tell Textpattern the difference.

So, if section “journal” called page “journal” as my site does, on that page you’d have a little magic like this inside your <body> tags:

/* Tell Textpattern what to do if we're displaying a list of articles */
<txp:if_article_list>
<txp:article listform="article_list" />
</txp:if_article_list><br />
/* Now tell Textpattern what to do when displaying a single article */
<txp:if_individual_article>
<txp:article form="article" limit="1" />
</txp:if_individual_article>

For an example, see my journal and an article in that journal. One section, using one page, using two forms, depending on the context.

I use the same technique for my reviews, but with even more conditional tags since different styles are needed depending on what’s being shown.

Last edited by iammattthomas (2005-02-22 04:37:53)

Offline

#6 2005-02-22 05:22:07

King Rat
Member
Registered: 2004-11-11
Posts: 20

Re: table of contents on /section/

Ah, those conditionals are exactly what I needed. They seem to be less well documented than the other txp tags. Or maybe my search-fu is frazzled from long pc use today ;P

Offline

#7 2005-02-22 05:26:41

iammattthomas
Member
From: Closing in on the capital
Registered: 2004-03-19
Posts: 12
Website

Re: table of contents on /section/

I found them on Textpattern Tags, which is a great site if you’re not aware of it yet. It doesn’t have a huge amount of info on conditionals, but you can get the jist enough to figure out the rest. Feel free to be in touch if you need any help with it.

Offline

#8 2005-10-01 15:51:42

Anton
Plugin Author
From: Alingsås, Sweden
Registered: 2004-11-16
Posts: 138
Website

Re: table of contents on /section/

> If I set the article to override the form, it overrides the listform as well. Which isn’t optimal for me ;(

Me too. And I don’t see how Jeremy’s suggestion would solve it, am I missing something here? Looks identical to <code><txp:article form=“article” listform=“article_list” /></code>, or isn’t it? That code would give med a “fullsize” version of an article, if it’s using (via override) the form “article”, even inside article lists, AFAIK.

Offline

#9 2005-10-01 23:27:45

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: table of contents on /section/

If I set the article to override the form, it overrides the listform as well.

Override Form always overrides the form when you use the <txp:article /> tag. It never overrides the form when you use <txp:article_custom />.


Alex

Offline

Board footer

Powered by FluxBB