Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2016-08-28 17:04:59

thomasemery
New Member
Registered: 2008-05-18
Posts: 4

Suggested Structure

Hi

I’m about to relaunch an old website, moving away from a custom CMS to TXP.

The site is currently structured as follows:

- Region 1
- Region 2
— Location 1
— Location 2
—- Accommodation 1
—- Accommodation 2
—- Attraction 1
—- Attraction 2
— Location 3
— Location 4
—- Accommodation 1
—- Attraction 1
- Region 3

There are also a few static pages.

Please could you suggest how best to structure this within text pattern?

Thanks
Tom.

Offline

#2 2016-08-28 22:36:31

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

Re: Suggested Structure

This looks like a perfect candidate for using the plugin adi_menu.

You can easily create sub-sections like you are after and add to them later, reorder them, etc. The documentation is excellent.

It could be part of the basic txp install.

Offline

#3 2016-08-29 10:17:32

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,595
Website

Re: Suggested Structure

I’m not familiar with adi_menu, so this may not be compatible with that suggestion.

One fairly obvious organisational scheme (of probably several possible alternatives) would be to:

  • Create a section for each region.
  • Create a category for each location. First make a category that matches the region (the section name and the category name should be identical but the descriptive titles can be how you like), then make categories for each location and assign them to the respective “parent category”.
  • Create a parent category for your article types, and then make categories for accommodation, attraction, activity, etc. and assign them to the parent category.
  • Create an article for each accommodation, attraction, activity, event, etc. and:
    • Assign them to the respective region section
    • Assign category1 to the respective location category
    • Assign category2 to the respective article type.
  • Use sticky articles (set status to sticky) for the intro articles for the regions (assign just to section) and locations (assign to section and location category).

In your template for the general page, e.g. your homepage, you can use the following to list the different regions:

<txp:section_list exclude="static-section-one,static-section-two, static-section-three" wraptag="ul" break="li" class="region-list">
  <txp:section title="1" link="1" />
</txp:section_list>

That will produce a list all sections that are not other static sections, assuming that all the remaining sections are regions, with links to the relevant sections.

Then for your page template for the region sections:

<txp:if_article_list>

  <!-- this is a list / landing page -->

  <txp:if_category>

    <!-- is section + category = location landing page -->

    <!-- intro sticky article for location -->
    <txp:article status="sticky" limit="1" />

    <!-- show list of articles in location -->
    <txp:article status="live" break="" sort="category2 asc, Posted desc">
    <txp:if_different>
      <h2><txp:category2 title="1" /></h2>
    </txp:if_different>
      <article>
        <txp:article_image />
        <h3><txp:permlink><txp:title /></txp:permlink></h3>
        <txp:excerpt />
      </article>
    </txp:article>

  <txp:else />

    <!-- is just section = region landing page -->

    <!-- intro sticky article for location -->
    <txp:article status="sticky" limit="1" />

    <!-- show list of locations -->
    <txp:category_list parent='<txp:section />' exclude '<txp:section />' children="1" wraptag="ul" break="li">
      <txp:category title="1" link="1" this_section="1" />
    </txp:category_list>

  </txp:if_category>

</txp:if_article_list>
<txp:if_individual_article>

  <!-- this is an individual article page -->

  <txp:article>
    <h3><txp:category2 title="1" /></h3>
    <h2><txp:title /></h2>
    <h4> Location: <txp:category1 title="1" /></h4>
    <txp:article_image />
    <txp:body />
  </txp:article>

</txp:if_individual_article>

If I’ve done that correctly that should do:

  • If I am on a section landing page, show me the (sticky) article about the region and then list all sub-categories of the parent category that matches this region (section).
  • If I am on a section and category landing page, show me the (sticky) article about the location and then list all article previews (title with link, article image if specified and article excerpt if specified) beneath that grouped by article type (accommodation, activity, attraction) with a heading above each group.
  • If I am on an individual article, show me the full article, including the type and the location it is in.

Check the (newer) docs for information on what the tags do and how to expand on that.

txp:article responds to the context it is used in, e.g. it sets filter by section and by category depending on what the url is. If you find that you are getting the location sticky article for the region page, make the date of the region sticky article newer (i.e. more recent).

txp:article_custom by contrast allows you to override whatever the page context is and list articles according to specific criteria. So if you want to list all the accommodation articles, you could place this in one of your templates, e.g. on your homepage template sidebar:

<txp:article_custom category="accommodation" limit="6" wraptag="ul" break="li" "label="Accommodation" labeltag="h2" sort="rand()">
  <article class="teaser">
    <txp:article_image thumbnail="1" />
    <h3><txp:permlink><txp:title /></txp:permlink></h3>
    <ul class="meta">
      <li class="region"><txp:section title="1" link="1" /></li>
      <li class="location"><txp:category1 title="1" link="1" this_section="1" /></li>
    </ul>
  </article>
</txp:article_custom>

That should show you 6 randomly selected teasers of available accommodation across all regions and locations comprising a link to the accommodation article + thumbnail image and a linked titles of the region and location it is in.

You can expand on these principles endlessly.

The most difficult aspect is when you want to filter by both categories at once. If your site is not huge and the list of articles grouped by type (as described above) is sufficient, then textpattern will stand you well.


TXP Builders – finely-crafted code, design and txp

Offline

#4 2016-08-29 20:47:02

thomasemery
New Member
Registered: 2008-05-18
Posts: 4

Re: Suggested Structure

Hi Both

Thanks for the feedback. I think I may go without the regions to make life a little easier.

The plugin looks useful.

Tom.

Offline

#5 2016-08-29 22:01:21

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

Re: Suggested Structure

Tom

I use adi_menu on a 780+ page website with multiple sections and sub-sections. I don’t use the sub-sub-sections feature but they are possible.

I wouldn’t necessarily chuck the regions idea.

The joy of it is the ease with which you can add and reorder these sections, etc. It’s all just js drag and drop with the re-ordering. There’s a whole lot of other bits which are sometimes useful, re-directing sections, etc.

It is certainly made that website where I add sub-sections all the time as I write additional stuff.

It avoids having to use categories as pseudo subsections, which is really just a work around. The categories can be used for what they were intended.

And I have to say Adi went way above the call of duty when he helped out on my particular needs. (Thanks mate, and sorry about the rugby humiliation. Then again aren’t you a Pom anyway?)

Graeme

Added later: just in case you wanted to see the site I was referring to it is here.

The inadequacies of the CSS and menu are entirely my fault, it’s on my list of Things To Do, but the website is a hobby really and I have other things to keep me busy.

Last edited by detail (2016-08-31 06:38:12)

Offline

#6 2016-08-29 22:26:11

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Suggested Structure

As my grandmother-in-law used to say – “I support England … and anyone playing Australia.”

Offline

#7 2016-08-29 22:33:22

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

Re: Suggested Structure

Bring on the Lions!!

Less than a year . . .

Offline

Board footer

Powered by FluxBB