Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-08-07 09:12:34

phual
Member
From: UK
Registered: 2008-02-19
Posts: 26
Website

A more effective use of sections?

I have a functioning site that I’m perfectly happy with, but I can’t help being aware that my solution to a problem me be rather more clumsy than it needs to be.

The site is built in such a way that there are sections and sub-sections. Each section has a different colour theme which is shared by the sub-sections. The subsections also need to be presented in a pre-defined order. The website is here, and the code solution is shown below. The site makes no use of categories.

<txp:glx_hl_current_section
   section="news,
            default,
            test"
   class="green"/>
<txp:glx_hl_current_section
   section="worship,
            worship_faith,
            worship_sunday,
            worship_youth,
            worship_asianfellowship,
            worship_annual"
   class="purple" />

Of course, this means that I have to create sections and sub-sections whenever there is a need and hard-code this information into the page design. All sections utilise the same page design – the only difference is the class, which defines css used.

Is there a more elegant solution?

Stuart

Offline

#2 2010-08-08 12:07:32

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: A more effective use of sections?

What about txp:else to automatically cover all new/other sections with a default class?
I am not using txp:glx_hl_current_section. I get a along with the TXP core txp:if_section pretty well :)
Does txp:glx_hl_current_section support the use as a container tag?


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#3 2010-08-10 12:38:36

phual
Member
From: UK
Registered: 2008-02-19
Posts: 26
Website

Re: A more effective use of sections?

txp:else is all well and good but essentially creates a catch-all scheme where I am really looking for something where I create a new webpage (currently realised by creating a new section) and assign one of half-a-dosen sytles to it. I can’t recall why, but using txp:if_section presented some issues when I was making the site. It also doesn’t get round the fundermental issue of hard-coding the design.

From what I recall txp:hlx_h1_current_section does not support container tags, but I’m stretching my memory here. It does appear that the same result can be acheived with nativ tags though (as shown in forum thread).

Sorry, that wasn’t very informative. That’ll teach me to ask a question on code I wrote three years ago.

Thanks

Stuart

Offline

#4 2010-08-10 13:10:07

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: A more effective use of sections?

If you step back one step you can create all the ‘new page design’ fuzz also without sections but with categories instead and even keywords (tru_tags). Just apply some magic if/else code around your CSS calls and you are set (or wherever you want to show design changes).

But this only covers the presentation (by purpose) – where I think categories are just fine. To always create a new section only to change the color is a little bit too much in my eyes.

Btw: IMHO a txp:else as a catch-all error handling scheme is always a good choice to prevent bad site behavior in case you forgot/missed a condition somewhere :)

Somewhere in the dark corners of my head rings a little bell. The message is wasn’t there a plug-in which allowed the use of TXP tags in CSS? But I have no idea if this is a phantom , a ghost or just a bad nightmare :)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

Board footer

Powered by FluxBB