Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2018-11-07 14:15:43

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,159
Website

Re: [solved] Nth year counter from given start

I admit to having got a bit lost here, but it sounds ever more intriguing the more you write. And you know I think what you have to say is interesting, so it seems a pity (to me at least) that you will eradicate past issues but I also understand your thinking…*

That said … could you not do that all a bit more simply and:

  • Use a custom field called issue to hold the issue number of the respective article. You haven’t got a ton of articles so it’s not a great effort that you have to manually set that.
  • Use a combination of sort="issue desc" and if_different to skip all later articles with a different issue number. If it doesn’t work with if_different, you should be able to set a variable with the first issue number it outputs and then use smd_if to prevent other articles from showing. There’s probably a way to do that with txp:evaluate too. Maybe Oleg will post a cleverer alternative ;-)
  • Don’t bother with the screen grab as your text is still in Textpattern, so not lost to you, just no longer publicly accessible. A PDF or epub format might be better than a screen grab as you can easily extract the text from it if you should ever need it again.

That should allow you to switch over issues as soon as you post an article with a new issue number and have as many articles as you want in that issue (if you need more than 10, you’ll need to set limit="max-number-of-articles-per-issue").

*By way of example, I had to look quite hard to find your two past articles on textpattern building blocks and semantics


TXP Builders – finely-crafted code, design and txp

Offline

#32 2018-11-07 14:20:26

etc
Developer
Registered: 2010-11-11
Posts: 2,949
Website

Re: [solved] Nth year counter from given start

Ok, I think I have misunderstood the “issue” meaning, sorry. If I get it right now, you can try

<!-- get the latest issue -->
<!-- add sort="issue DESC" to article_custom if "latest" means "issue number", not "date" -->
<txp:variable name="latest" escape="trim">
<txp:article_custom limit="1">
<txp:custom_field name="issue" />
</txp:article_custom>
</txp:variable>

<!-- retrieve the latest articles -->
<txp:article_custom issue='<txp:variable name="latest" />' form="current_issue_list" />
Destry wrote #315038:

I get one article, but not two.

Btw, when I put this variable in my dedicated variables form that outputs at the very top of the DOM (before the html tag) it doesn’t work. But if I put the variable just before where I call it. It works. Why the difference?

Anomalies they are, something is messed up.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#33 2018-11-07 14:23:36

Destry
Moderator
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,020
Website

Re: [solved] Nth year counter from given start

I just looked around for a publishing system specifically for editorial publishing (versus general website design/dev) and there is practically nothing. In fact the only thing I can find is mention of systems that media publishers created, and they are not sharing, except among themselves in some cases. Boo!

I know Bloke did no small amount of magic just to get TXP Mag operating more like a real magazing, at least on the organizational side. There is still a lot that could be done on the actual editorial/component side. And even now, just trying to figure out how to create an “issue list”. It’s not straightforward (for me).

I know, coming from the CSF work and folks for several years, that there is a lot of interest in creating real editorial workflows, and setting up magazine-like sites, even for companies/orgs that are not publishers. But most have to hack some makeshift solution together, often using WordPress, the do-it-all go to if you throw enough plugins at it.

It’s neither here nor there, but I think if I was building a CMS today, it would be specifically for editorial publishing and workflow, not website design in general (a saturated market anyway). The design seems like a layer that you can do regardless. But a system designed around editorial workflow… I would love to see and touch one of those just to know what’s going on there.

Back to your regular bat channel.


The text persuades, the *notes prove。

Offline

#34 2018-11-07 14:31:45

etc
Developer
Registered: 2010-11-11
Posts: 2,949
Website

Re: [solved] Nth year counter from given start

Or, if I have misunderstood the “issue” meaning again, and you have no issue custom field

<!-- get the latest issue date -->
<txp:variable name="latest" escape="trim">
<txp:article_custom limit="1">
<txp:posted format="%Y-%m-%d" />
</txp:article_custom>
</txp:variable>

<!-- retrieve the latest articles -->
<txp:article_custom month='<txp:variable name="latest" />' form="current_issue_list" />

etc_[ query | search | pagination | date | tree | cache ]

Offline

#35 2018-11-07 14:44:55

Destry
Moderator
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,020
Website

Re: [solved] Nth year counter from given start

jakob wrote #315039:

I admit to having got a bit lost here…

Yes, it’s confusing because there are all these terms — issue, current, latest, etc — and they can be interpreted in a dozen different ways. Hard to be clear this way.

it seems a pity (to me at least) that you will eradicate past issues but I also understand your thinking…*

The stories aren’t going anywhere. Only the concept of an ‘Issue’ (except for the current one). And there are no relationships between stories in a given issue, so accessing them individual from the archive loses no meaningful context. If I wanted to do that, have relationships between articles in a given issue (e.g. a subject theme), then I’d probably have to follow more of a TXP model of organization, and I really don’t want that complexity right now.

Use a custom field called issue to hold the issue number of the respective article.

I’m doing this already. This seems like the most fundamental part of the puzzle.

  • Use a combination of sort="issue desc" and if_different to skip all later articles with a different issue number.

I think the problem is that I need to skip all earlier issue articles. The latest issue number is the one I want to make a ‘current issue list’ out of.

If it doesn’t work with if_different, you should be able to set a variable with the first issue number it outputs and then use smd_if to prevent other articles from showing. There’s probably a way to do that with txp:evaluate too.

You just entered the area where my eyes glaze.

Maybe Oleg will post a cleverer alternative ;-)

Hopefully. Yes.

  • Don’t bother with the screen grab as your text is still in Textpattern, so not lost to you,

Yes, I probably won’t keep screen grabs. There’s really no point in having them, unless for legal reasons. I doubt it.

just no longer publicly accessible.

Again, I think you misunderstood. The stories are still there, just not the concept of an ‘issue’.

A PDF or epub format . . .

I’m actually going to be doing epubs of the bigger, researched stuff. And those annotated versions will be sold. It’s too much to explain here, but it will be clear later. ;) In short, there will be plenty to read, but I do need to buy socks too.

I had to look quite hard to find your two past articles on textpattern building blocks and semantics_

You found those? I was not planning to republish those. I read them a while ago and they just sounded really outdated against the state of play today.

I’m staring a clean slate, and none if it is really about Txp, at least not like those two before… More in side reference or whatever to other main subjects. ;)


The text persuades, the *notes prove。

Offline

#36 2018-11-07 14:56:17

Destry
Moderator
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,020
Website

Re: [solved] Nth year counter from given start

Destry wrote #315043:

The stories aren’t going anywhere. Only the concept of an ‘Issue’ (except for the current one).

I have a feeling this is going to end up being a big bugaboo for readers later. ‘Where’s issue number blah, blah, blah?!

We’ll see. I won’t be answering such email. ;)

If it even becomes a problem, I could probably make a generic ‘issues archive’ page where stories/articles are group-listed by their issue IDs. That would probably be easier than setting up TXP mag architecture just to slap past collections around.


The text persuades, the *notes prove。

Offline

#37 2018-11-07 15:07:56

Destry
Moderator
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,020
Website

Re: [solved] Nth year counter from given start

etc wrote #315040:

<!-- get the latest issue -->...

That’s the winner! 🙏

Thread marked as solved.

But one related question. I think it would be useful in my case to have a column in the Articles panel to show the CF ‘issue’ field, thus quickly see what articles have which issue numbers, or are missing any. How can I hack that easiest?


The text persuades, the *notes prove。

Offline

#38 2018-11-07 15:25:14

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,159
Website

Re: [solved] Nth year counter from given start

etc wrote #315040:

<!— get the latest issue —>
<!— add sort=“issue DESC” to article_custom if “latest” means “issue number”, not “date” —>
<txp:variable name=“latest” escape=“trim”>
<txp:article_custom limit=“1”>
<txp:custom_field name=“issue” />
</txp:article_custom>
</txp:variable>

<!— retrieve the latest articles —>
<txp:article_custom issue=’<txp:variable name=“latest” />’ form=“current_issue_list” />

Yup, that was sort of what I was thinking but you’ve done it in two steps – look up the issue, then output just that issue – which is more legible. And nice and simple. No need to save on db-queries here with so few articles.


TXP Builders – finely-crafted code, design and txp

Offline

#39 2018-11-07 15:32:55

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,159
Website

Re: [solved] Nth year counter from given start

Destry wrote #315043:

The stories aren’t going anywhere. … Again, I think you misunderstood. The stories are still there, just not the concept of an ‘issue’.

I did, sorry. Glad they’ll still be there.

You found those? I was not planning to republish those. I read them a while ago and they just sounded really outdated against the state of play today.

There’s a half-complete article in the textpattern docs and it made me think: “didn’t you already describe that all once before?” so I went in search of them (they are on the Way Back Machine but I had to google what they were called first in order to find them). You’re right, they’re no longer up to date but they did help a lot of people at the time. Lot’s of complementary comments to your article.

But one related question. I think it would be useful in my case to have a column in the Articles panel to show the CF ‘issue’ field, thus quickly see what articles have which issue numbers, or are missing any. How can I hack that easiest?

I’d like to know that, too. In the past, for a painter’s site, I wanted the article images to show in the article list and had to hack txp_list.php to achieve it.

Short of that, you could conceivably use sections for the issues instead of a custom field, especially as you’re using just a domain.com/title url scheme. Then you’d see them in the admin area and outputting the start page and the archives would be very simple.


TXP Builders – finely-crafted code, design and txp

Offline

#40 2018-11-07 15:48:24

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,458
Website

Re: [solved] Nth year counter from given start

Destry wrote #315045:

I think it would be useful in my case to have a column in the Articles panel to show the CF ‘issue’ field, thus quickly see what articles have which issue numbers, or are missing any.

Use adi_matrix for sure. Create yourself a custom Matrix to appear on the Articles panel that shows the article title, Issue custom field, Published status and any other salient fields, then view that new panel. You’ll get all articles showing up with their issue numbers in one place. And the kicker? You can change as much as you want and update all articles at once with a single click on the Save button. It’s a blindingly good plugin.


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

Board footer

Powered by FluxBB