Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2016-11-28 21:07:34

etc
Developer
Registered: 2010-11-11
Posts: 5,689
Website GitHub

Re: Valueless attributes - ELI5 and further reading?

michaelkpate wrote #303057:

I’ve posted this on the forums before.

Haha, yes, it’s way smarter!

Offline

#17 2016-11-28 21:25:39

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,795
GitHub

Re: Valueless attributes - ELI5 and further reading?

etc wrote #303056:

Hehe, I’ll loose all the aura if I explain, that’s holy easy. Suppose, you want to output this (which I won’t explain, ask Pete):

etc, you’ll always be enigmatic in my book. Never fear.

Part of the reason for the extensive number of checks in the example code was to cover all pages states across all sections. It’s possible to have search/category/author pages in the root as well as subsections, and I’m finally getting around to boilerplate-ing my setup for future Textpattern theme work.

The most sensible thing I can do (I think) is have one tag soup recipe to determine the page state, and store the result it as a variable, rather then chewing through it over and over for titles, content, asides, footers and so forth.

Nothing to do with valueless attributes, after all.

When I’ve cleared a few millstone work projects and have a fresh set of eyes, I’ll take a look at your walkthrough above. Thank you for your advice and explanations.

Offline

#18 2016-11-28 22:07:59

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Valueless attributes - ELI5 and further reading?

etc wrote #303067:

Haha, yes, it’s way smarter!

Not really – just a different approach. :)

I have a bad habit of forgetting what some block of code is supposed to do when I don’t look at it for awhile so I try to keep things as simple for me as possible so I can figure it out later.

Offline

#19 2016-11-28 22:50:39

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,499
Website GitHub

Re: Valueless attributes - ELI5 and further reading?

gaekwad wrote #303068:

The most sensible thing I can do (I think) is have one tag soup recipe to determine the page state, and store the result it as a variable, rather then chewing through it over and over for titles, content, asides, footers and so forth.

FWIW, this is the approach I took with TXP Mag. I had a colossal form called “context” or something which was called at the top of every page. Its job was to ascertain from the URL what the user was looking at: a bio page; an individual issue page; articles by author; the current issue landing page; an archived issue landing page from another year/quarter; and so forth.

It extracted the relevant items such as issue number/date/section/category/author from the (often gbp_permanent_links-style) URL and made <txp:variables> out of everything pertinent, which could be tested further down the page to display different sidebar contents, blocks, adverts, bio info, articles, etc.

If I had etc-fu, I’d have made it uber-terse to keep the amateurs out. But since I’m not that clever, I settled for doing it longhand, with copious <txp:hide> comment blocks so when I came back to it six months later I (or someone else) didn’t have to learn it all again to figure out why something wasn’t working.


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#20 2016-11-29 10:22:33

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: Valueless attributes - ELI5 and further reading?

I’m sure it’s possible to do something with <txp:page_url /> tag.

With this tag, I wanted to create an “ouput_form” that returns a variable “context”.
Or a <txp:context /> tag with smd_macros plugin.
But I never took the time to experiment :(.

Offline

Board footer

Powered by FluxBB