Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-05-20 15:43:49

wolfcry911
Member
From: MA, USA
Registered: 2006-06-30
Posts: 51

Willing to help a newb? Section landings, category lists, etc.

Hello, I’m hoping someone will be willing to devote a little time to a newbie. I can’t seem to wrap my head around Textpattern’s workings. I’ve read Textpattern Solutions twice now so I have a basic understanding, but when I try to implement things I’m completely lost. I’m not looking for anyone to do the work – I’m trying to learn how to tackle different things.

Okay, what I would like to accomplish is this: I work for a company with about 45 employees. They’re broken down into 5 groups. I’ve written an article for each person and tied each to the personnel section. I’ve also given each a category1 equal to the group they belong to. What I would like is to have a landing page for the section personnel that gives an overview of the company layout and how the groups are broken down. I’d also like to list the 5 groups (categories) as links. I would then like to click on a group and have a list of the people in that category (I’d also like some special sorting of this list, but that can come later). From here, I’d like to be able to click on an individual and read up on that person.

It seems to me that Textpattern would be perfect for handling this, but for the life of me I can’t figure out where to start. Any help is greatly appreciated.

Thanks,
Chris

PS I should probably mention I’m using the gbp_permanent_links plugin

Last edited by wolfcry911 (2008-05-20 17:15:32)

Offline

#2 2008-05-20 16:06:17

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

Re: Willing to help a newb? Section landings, category lists, etc.

One way would be to have separate templates so your personel template which could be named the same as your personnel section could have something like

<txp:if_article list>
<p>The overview here in hardcoded html</p>
<txp:category_list parent="personel"/>
<txp:else />
<txp:article />
</txp:if_article list>

or if you wish not to have to go back to the templates to edit the description you can try something like

<txp:if_article list>
<txp:article_custom form="body" status="sticky" id="##" /> 
<txp:category_list parent="personel"/>
<txp:else />
<txp:article />
</txp:if_article list>

where form="body" just contains <txp:body /> and id is the id of the article where you have the description. Sticky is there so as for that text not to appear in other article lists.


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

Offline

#3 2008-05-20 16:43:13

wolfcry911
Member
From: MA, USA
Registered: 2006-06-30
Posts: 51

Re: Willing to help a newb? Section landings, category lists, etc.

colak, thanks for your help.

I’ve implemented your first set of code and already things are much further along than I was able to produce. I understand the sticky article and will switch over to your second example shortly.

So now, the first part works perfectly. I land on a landing page with intro text and a list of categories (groups). However, I get an error when clicking any of the category links: Tag error: -> Textpattern Notice: Page template personnel does not contain a txp:article tag on line 474.

I see that there’s an article under txp:else and I’ve also included an if_individual_article with an article in that as well, but no joy. Will clicking on a linked category bring up a list of articles (people) in that category?

Offline

#4 2008-05-20 16:57:28

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

Re: Willing to help a newb? Section landings, category lists, etc.

Ok you might need a plugin

<txp:glx_if_section_frontpage>
<p>The overview here in hardcoded html</p>
<txp:category_list parent="personel"/>
</txp:glx_if_section_frontpage>
<txp:else />
<txp:article limit="10"/>
</txp:if_article list>

<txp:if_individual_article>
<txp:article />
</txp:if_individual_article>

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

Offline

#5 2008-05-20 19:39:09

wolfcry911
Member
From: MA, USA
Registered: 2006-06-30
Posts: 51

Re: Willing to help a newb? Section landings, category lists, etc.

Yiannis,
From your examples I think I’ve done it! I managed without the glx_if plugin. Would you be kind enough to look this over and see if it’s acceptable? Is there anyway to reduce the code further?

  <txp:if_individual_article>
    <txp:article />
  <txp:else />
    <txp:if_category name="group1">
      <txp:article_custom form="grouplist" category="group1" />
    </txp:if_category>
    <txp:if_category name="group2">
      <txp:article_custom form="grouplist" category="group2" />
    </txp:if_category>
    <txp:if_category name="group3">
      <txp:article_custom form="grouplist" category="group3" />
    </txp:if_category>
    <txp:if_category name="group4">
      <txp:article_custom form="grouplist" category="group4" />
    </txp:if_category>
    <txp:if_category name="administration">
      <txp:article_custom form="grouplist" category="administration" />
    </txp:if_category>

    <txp:if_article_list>
      <txp:article status="sticky" /> 
      <txp:category_list parent="personnel" exclude="personnel" wraptag="ul" break="li" />
    </txp:if_article_list>
  </txp:if_individual_article>

Last edited by wolfcry911 (2008-05-20 19:40:08)

Offline

#6 2008-05-20 20:00:57

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

Re: Willing to help a newb? Section landings, category lists, etc.

I think this would do as well (on your page for section ‘personnel’):

<txp:article form="your_single_article_form" listform="grouplist" />

<txp:if_article_list>
      <txp:article status="sticky" /> 
      <txp:category_list section="personnel" parent="personnel" exclude="personnel" wraptag="ul" break="li" />
</txp:if_article_list>

<txp:article /> is context sensitive, so it will know if it is on an individual article page or on an article list page, and in which section and/or category it is.

Offline

#7 2008-05-20 20:50:35

wolfcry911
Member
From: MA, USA
Registered: 2006-06-30
Posts: 51

Re: Willing to help a newb? Section landings, category lists, etc.

Thanks Els, I definitely like how concise it is. I gave it a try however, and it worked great with one exception – the landing page lists every article (in the section) before the sticky article and category list.

Offline

#8 2008-05-20 22:26:31

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

Re: Willing to help a newb? Section landings, category lists, etc.

Oh sorry. Is this what you want?

<txp:if_article_list>
   <txp:if_category><!-- we are on a category page -->
      <txp:article listform="grouplist" />
   <txp:else /><!-- we are on the section page -->
      <txp:article status="sticky" /> 
      <txp:category_list section="personnel" parent="personnel" exclude="personnel" wraptag="ul" break="li" />
   </txp:if_category>
<txp:else /><!-- we are on an individual article page -->
   <txp:article form="your_single_article_form" />
</txp:if_article_list>

Offline

#9 2008-05-20 22:45:27

wolfcry911
Member
From: MA, USA
Registered: 2006-06-30
Posts: 51

Re: Willing to help a newb? Section landings, category lists, etc.

Yes, perfect!!

Thank you both. Not only is this working as I wished, but I have a much better understanding of how it’s done.

Now I’ll be trying to tackle my special sorting order. I’ll post back if questions arise.

Offline

Board footer

Powered by FluxBB