Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-02-20 15:20:33
- pketh
- Member
- Registered: 2005-05-30
- Posts: 24
styling each post on a page seperately
Hey all,
This is sorta in response to my previous post, where I wanted to make the headers on my main page collapsible. Well I’ve found a great solution in moo.fx that I really want to use. Check it out here.
The main problem now is that I learned that I have to make 7 different declarations for each of the 7 different posts on a page and apply them to each.
So I have declaration ‘1’ and I need that to apply only to the first post on the page. Declaration ‘2’ for the second post only, and so on up to 7 posts per page.
So i’m wondering, how can I do this.
How to code it so I can apply these unique things to my 7 most recent posts?
I suppose it’s kinda a weird question – but any reply would be awesome – thanks!
personal site:
www.pketh.com
Offline
Re: styling each post on a page seperately
not 100% sure if this would work with the moo.fx accordeon effect but i’m pretty sure you can use the article’s ID for such a thing.
something like
<h2 id="<txp:article_id />"><txp:title /></h2>
Last edited by sthmtc (2007-02-20 15:26:18)
Offline
#3 2007-02-20 15:28:08
- pketh
- Member
- Registered: 2005-05-30
- Posts: 24
Re: styling each post on a page seperately
Is the article Id a static thing that is assigned to each post , or a relative number (like the first post, the 2nd post etc.)?
If it’s static, and each article has it’s own id, then I wouldn’t be able to use it right? Because I’d need to keep adding new declarations for each unique id I think
thanks for your quick response, progress is being made :D
personal site:
www.pketh.com
Offline
Re: styling each post on a page seperately
of course the article id is static an unique. are you sure it hast to be ascending, starting from “1” ?
Offline
Re: styling each post on a page seperately
for a quick and dirty fix you could use multiple article forms.
<txp:article limit="1" form="article-1" />
<txp:article limit="1" offset="1" form="article-2" />
etc
again, this might not be very elegant but it would work if you only display a small number of articles per page :)
Offline
#6 2007-02-20 15:37:57
- pketh
- Member
- Registered: 2005-05-30
- Posts: 24
Re: styling each post on a page seperately
I’m not really familiar with javascript which is what the moo.fx uses. But I read (and page source codes reinforce) that you can only use a java declaration once per page. I could be wrong about this though – I know next to nothing about javascript
So if i had 7 articles on my front page, I’d need 7 declarations. And of course, as the page gets updated with new posts the 7 declarations must apply to the 7 on the front page at the time.
this is hard
personal site:
www.pketh.com
Offline
Re: styling each post on a page seperately
i don’t think this is so hard at all to accomplish. see my above post for a quick and dirty, easy fix.
edit: on a second thought it’s even easier. you don’t need IDs or anything! all you need is this in your article form:
<a onclick="containerHeight.toggle();"><h2><txp:title /></h2></a>
<div id="container">
<txp:body />....
</div>
Last edited by sthmtc (2007-02-20 15:47:50)
Offline
#8 2007-02-20 15:45:01
- pketh
- Member
- Registered: 2005-05-30
- Posts: 24
Re: styling each post on a page seperately
Ohh, I get it. Yeah that’s a good idea . So if I have 7 pages to display I make 7 forms. And if say, I’ve already used all 7, the 8th post will go back to using form 1 right? and so on.
It’s a weird system to be sure, but I could live with it I guess.
I do wish there was something more sophisticated, or a way to do this automatically, but in lieu of all that this’ll do .
thanks sthmtc !
personal site:
www.pketh.com
Offline
Re: styling each post on a page seperately
see edited post ^^
Offline
#10 2007-02-20 17:10:58
- pketh
- Member
- Registered: 2005-05-30
- Posts: 24
Re: styling each post on a page seperately
ooh, this sounds totally ideal
reading it back, it looks like I can use the same coding in the head as used in the tutorial here?
this looks absolutely perfect! I’m really psyched now :D thanks dude
personal site:
www.pketh.com
Offline