Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-02-09 05:37:40

WebKat
Member
Registered: 2007-01-16
Posts: 301

if_section question

I am having trouble doing what I need to do with if_section.

I have two sections which require special formatting when viewed as a category list (normal when viewed as individual articles though).

Right now I have

<txp:if_section name="Phrases">
<txp:article form="Phrases" limit="20" />
<txp:else />
<txp:article form="default" listform="excerpt" limit="20" />
</txp:if_section>
<txp:if_individual_article>
		<p><txp:link_to_prev><txp:prev_title /></txp:link_to_prev> 
			<txp:link_to_next><txp:next_title /></txp:link_to_next></p>
<txp:else />
		<p><txp:older><txp:text item="older" /></txp:older> 
			<txp:newer><txp:text item="newer" /></txp:newer></p>
</txp:if_individual_article>

I need to add conditional stuff for section “Events” which will show a list of events using form “excerpt-events”. I’ve tried various things but nothing I’ve tried has any effect whatsoever, so I’m obviously doing it wrong. Help?



WebKat

Offline

#2 2007-02-09 06:43:40

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

Re: if_section question

You can either create a different page for your section to use or make use of override forms.

Offline

#3 2007-02-09 06:47:53

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: if_section question

OpalCat wrote:

I am having trouble doing what I need to do with if_section.

I have two sections which require special formatting when viewed as a category list (normal when viewed as individual articles though).

Try

<txp:if_category name="cat1,cat2,etc">
<txp:article listform="yourform"  limit="10" />
<txp:else />
<txp:article limit="10" />
</txp:if_category>

As you want the category list to appear differently maybe you should try formatting the relevant tag…

Last edited by colak (2007-02-09 06:48:12)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2007-02-09 08:42:22

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: if_section question

colak, as far as my understanding goes, your suggestion would lead to Phrases and Events having the same formatting, and everything else having the default formatting. That isn’t what I want.

I have formatted the relevant tag… that’s the point.

I don’t want ALL category lists to appear in the same (different) way. Phrases needs to be formatted X way (which I’ve created a form for) and Events needs to be formatted Y way (which I’ve created a form for). Everything else in list form just uses my “excerpt” form. I really wanted to try to stay away from creating multiple pages, as it means that every time I want to make some sort of layout change, I have to make it across several pages, and that just sucks.

To be more specific, generally speaking, I want lists to show the permalink/title, an excerpt of the article, the date posted, and a link to read the rest of the article. Phrases, on the other hand, are just tiny little things telling how to say various things in Gaelic, and it would be silly to have to navigate to each one individually, so for the Phrases section, I want each one displayed as its title, the full content of the article, no posting date (irrelevant) and no link to read the rest, because the rest is already there. Events I want to show the permalink/title and an excerpt and “read more” link, however I don’t want the posting date shown because it makes it look like that’s the date of the event and it’s confusing. I have forms for the general excerpt format, for the Phrases format, and for the Events format. I just want to have one page that figures out what is showing and uses the appropriate form. Is this not possible?



WebKat

Offline

#5 2007-02-09 08:44:30

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: if_section question

Mary wrote:

You can either create a different page for your section to use or make use of override forms.

I was under the impression that override forms were for formatting individual articles. What I need to format is the list of articles, the format of which varies depending on what section is being listed. Can this be done with overrides? Seems like a pain in the butt, but might be less of a pain than having to create and maintain a separate page.



WebKat

Offline

#6 2007-02-09 13:51:04

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

Re: if_section question

OpalCat wrote:

I have two sections which require special formatting when viewed as a category list (normal when viewed as individual articles though).

I’m not sure I understand you: are Phrases and Events sections or categories? What is the url of this category list?

Offline

#7 2007-02-09 13:58:17

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: if_section question

OpalCat wrote:

colak, as far as my understanding goes, your suggestion would lead to Phrases and Events having the same formatting, and everything else having the default formatting. That isn’t what I want.

I have formatted the relevant tag… that’s the point.

I don’t want ALL category lists to appear in the same (different) way. Phrases needs to be formatted X way (which I’ve created a form for) and Events needs to be formatted Y way (which I’ve created a form for). Everything else in list form just uses my “excerpt” form. I really wanted to try to stay away from creating multiple pages, as it means that every time I want to make some sort of layout change, I have to make it across several pages, and that just sucks.

To be more specific, generally speaking, I want lists to show the permalink/title, an excerpt of the article, the date posted, and a link to read the rest of the article. Phrases, on the other hand, are just tiny little things telling how to say various things in Gaelic, and it would be silly to have to navigate to each one individually, so for the Phrases section, I want each one displayed as its title, the full content of the article, no posting date (irrelevant) and no link to read the rest, because the rest is already there. Events I want to show the permalink/title and an excerpt and “read more” link, however I don’t want the posting date shown because it makes it look like that’s the date of the event and it’s confusing. I have forms for the general excerpt format, for the Phrases format, and for the Events format. I just want to have one page that figures out what is showing and uses the appropriate form. Is this not possible?

Bare with me here. I had a similar problem with imca.neme.org/main where I had certain categories which I wanted to have them appear differently from the normal “excerpts” page.
You can see those 2 categories here and here whereas here is the excerpts page. As you can see from the first 2 examples the category pages are totally different from each other and also they are different from the excerpts page.
I understand that images are not what you are after, but the method of achieving what you are looking for is more or less the same. That is unless you want the Gaelic ‘titles’ not to appear in the excerpts at all.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#8 2007-02-09 14:01:28

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: if_section question

One way may be to give the Gaelic posts their own form which only has

<txp:if_article_list>
<txp:permlink><txp:title /></txp:permlink>
<txp:else />
<txp:body />
</txp:if_article_list>

This form can be chosen in the “write tab” every time you post a Gaelic article or be using the if_category listform attribute as suggested above.

Last edited by colak (2007-02-09 14:06:39)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#9 2007-02-09 14:24:21

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: if_section question

Els wrote:

OpalCat wrote:

I have two sections which require special formatting when viewed as a category list (normal when viewed as individual articles though).

I’m not sure I understand you: are Phrases and Events sections or categories? What is the url of this category list?

They’re both, actually.

I haven’t done the layout of the front page of the site yet, so you can ignore how that looks. Here is a “normal” section, which uses my “excerpt” form: http://test.tucsonirishcommunity.com/index.php?s=News

Here is the Phrases section: http://test.tucsonirishcommunity.com/index.php?s=Phrases

Here is the currently-not-formatted-correctly Events section: http://test.tucsonirishcommunity.com/index.php?s=Events As you can see it is currently formatted like the News section is, and when looking at it I think most people would assume that the date that is listed is the date of the event, so I want to remove the date (keep it the same other than that).

I have a custom form for the Phrases section which is working fine and dandy with the if_section tag I am currently using. My issue is with trying to get the custom form I have for the Events section to work as well, without making a separate page.



WebKat

Offline

#10 2007-02-09 14:25:33

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: if_section question

Since each of the sections (Events, Phrases, etc) is also a category (it’s just easier for me to arrange it that way) would a combination of if_section and if_category maybe work? like, nested?



WebKat

Offline

#11 2007-02-09 14:32:39

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: if_section question

Aha! That worked! I nested my current if_section tag inside an if_category tag. I had to rename my Events section to Event, to make wow_menu not link to it as a section in the nav bar at the top of the page (wow_menu has that feature where if the section and category name is the same, it will link to the section instead… which is very useful in this site, but had me pulling out my hair for my personal site until I figured out what it was doing and turned it off!)



WebKat

Offline

#12 2007-02-09 17:23:11

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

Re: if_section question

OpalCat wrote:

Since each of the sections (Events, Phrases, etc) is also a category (it’s just easier for me to arrange it that way) would a combination of if_section and if_category maybe work? like, nested?

Yes, that was what I was thinking about. But I’m glad you figured it out yourself :)

Offline

Board footer

Powered by FluxBB