Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-08-02 02:30:58

huntrashmi
New Member
Registered: 2024-08-02
Posts: 1

First time using TextPattern. Is there a way to create groups of pages

Imagine a site that is a kind of a magazine. When the user visits the site, it sees the last number of that magazine. This “page” the user sees, shows the excerpt of N pages and contains links so the users can click and read each one. Each of those pages are articles of that magazine issue.

At the bottom of the site, the user see, “previous issues”. If click that link will show the last week magazine and so one.

Is that possible to do that with TextPattern?

Offline

#2 2024-08-02 07:31:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: First time using TextPattern. Is there a way to create groups of pages

Hello, and welcome to Textpattern.

It’s definitely possible because that’s how the now defunct TXPMag worked by grouping articles into an Issue.

It did require a little bit of glue in the form of a small plugin to help tie custom URLs such as txpmag.com/issue/4 and make it pull out the relevant article suite. The articles themselves were grouped via a single custom field called ‘issue’ that designated the issue number, and then the individual articles were displayed in either date order to give some semblance of flicking through the mag from page to page, or you could browse by category/author either within an issue (which again required plugin intervention to handle URLs) or across issues via Txp’s native /category or /author routes.

It might be easier in the imminent 4.9.0 release (beta this week) as URLs and filtering by custom field are more fully featured.

Another option I’ve not tried but might work in your case (depending on how you want your URLs to be structured) is to create your articles and group them using a custom field as mentioned above, then use Sticky articles or a dedicated Issues section to act as a sort of Issue landing page.

If those landing page articles had the same issue number in their custom field, or they were titled ‘4’ for example, then when people landed on example.com/issues/4 you could grab the article title or the issue custom field and feed it into a call such as <txp:article_custom section="articles" issue='<txp:custom_field name="issue" />' /> to grab all articles matching the same issue number.

Last edited by Bloke (2024-08-02 07:36:17)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2024-08-02 07:46:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: First time using TextPattern. Is there a way to create groups of pages

Oh, and in terms of “next/previous issue” navigation in the footer, once you know the Issue number from the custom field, you can create a shortcode via a Form to construct the URL anchor tag.

E.g. (untested)

<txp:variable name="prev_issue" add="-1" value='<txp:custom_field name="issue" />' />
<a href="/issues/<txp:variable name="prev_issue" />">Previous issue</a>

Not sure if you can set a value and decrement it in one variable tag. Might need to set it and then add minus 1 straight after (and test for the zero or negative case to stop weird URLs being generated).


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2024-08-02 11:07:46

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

Re: First time using TextPattern. Is there a way to create groups of pages

The TXPmag (archived here) was a bit more complex with columns, topics and people profiles, but at a more general level if your magazine site just concentrates on the magazine content itself, Textpattern has two major ways of grouping and controlling the output of articles:

  • sections: these effectively segregate content into parallel sections of the site, and are generally the equivalent of menu items. If your site is solely a collection of articles, with no additional complexity, you could use a section for each issue. If you need other content sections – like in TXPmag – bloke’s suggestion offers a way of assigning articles to a particular issue. Textpattern doesn’t have subsections.
  • categories: up to two categories can be assigned to each article and can be used across sections. You could use these to group together articles that belong to the same issue. Another common usage is to categorize articles by type – e.g. the “column” idea: editorial, tips, recipes, cartoon … – so that visitors can look at all the articles of a particular type across different issues. Textpattern does support sub-categories. Using categories to group by issue could therefore also work, but if you have a more complex setup, you may hit the two-categories-per-article limit.

Tags are not built into Textpattern, but bloke has a plugin smd_tags that allows you to assign a larger number of tags per article, which you can use like extended categories to very flexibly offers different ways of accessing your magazine articles, e.g. by content topics.

Textpattern’s standard “txp:article” tag will automatically detect if the url is showing a section or category and output the corresponding article automatically. smd_tags comes with its own extra tag for filtering articles by tag and listing the available tags. It also supports hierarchical parent and child tags.

The section_list and category_list tags provide a way of outputting a list of the grouping mechanism (e.g. for a menu or for the “further issues”) and have an exclude attribute which you can use to exclude the issue currently being displayed.

In short: there are multiple ways you can approach this depending on how complex or focused your magazine will be…

PS: The source code for the TXPmag site is available here if you want to inspect it, but it is in some respects more complicated than a typical setup.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB