Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-08-16 01:28:57

phaedrus
New Member
Registered: 2012-08-16
Posts: 1

Using an altered CSS for an article bound to a single section

Hi all, first post in forum phew!

I’m planning to switch from wordpress to textpattern. I’m willing to preserve all my old URL’s (I have sensible permalinks to begin with) without using any .htaccess magic, if possible.

My problem is this:

I have a section called “Lab”. I have an article bound to this section for which I want to have a different CSS styling, something other than the Style bound to my Section. So, basically, under this section, I want some of my articles to have custom CSS bindings.

Is this possible? Or by pursuing this would I be working against the intended logic of the Textpattern system? This is my first day with txp and I’m trying to wrap my head around the concept still, but I’m loving the ride!

Thanks for any help.

Offline

#2 2012-08-16 03:13:26

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: Using an altered CSS for an article bound to a single section

Hello Phaedrus,

Whither away, and where do you come from?

Good move, I think. Textpattern provides multiple ways to achieve what you want. Depending on your specifics, I would tend to forget about ‘binding’ CSS style sheets to Sections and think more about writing a CSS file that encompasses the main and alternative styles (classes, right?) you need in a logical and semantic way.

If the different styling is relatively minor and the alternatively styled articles are a one time only production you may be able to get to where you want to be simply by calling up the appropriate CSS classes using Textile in the articles themselves.

Another approach might be to let the article form specified in your <txp:article> tag deal with styling your mainstream articles as normal but use the Override Form option under Advanced Options on the Write Tab to assign an alternative article form(or forms) that would contain the alternative CSS classes for your alternative articles.

I’m sure there are other ways to achieve this too.

Last edited by joebaich (2012-08-16 03:15:14)

Offline

#3 2012-08-16 05:56:35

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,595
Website GitHub Twitter

Re: Using an altered CSS for an article bound to a single section

you can also use

<txp:if_article_id id="#,##,etc">
<txp:css name="customcss" />
<txp:else />
<txp:css />
</txp:if_article_id>

Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB