Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#13 2009-11-02 22:34:53
- fhd
- Member
- Registered: 2009-11-01
- Posts: 13
Re: How to add a "Page last updated at..." info?
Hm. I’m still having one problem.
I’ve altered the section list I use for navigation in order to include the default section:
<txp:section_list active_class="selected" break=" | " default_title="Home" include_default="1" sections="about, projects, blog" />
And I’ve created a section home whose articles I’ve marked for inclusion on the front page.
Works well so far, except that the following does apparently not iterate over articles included on the default page:
<txp:article_custom section='<txp:section />' limit="1" sort="LastMod desc">
Last updated: <txp:modified format="%Y-%m-%d"/>
</txp:article_custom>
The dates do not show up, as if there were no articles in the current section (which is kind of true, since they are merely included).
Ideas?
Offline
Re: How to add a "Page last updated at..." info?
fhd wrote:
does apparently not iterate over articles included on the default page:
Hmm yeah, since the article_custom is being limited to ‘this section’ and the default section doesn’t have a notion of ‘this section’ (it’s essentially a section-without-a-portfolio, i.e. ""
) the article custom probably won’t iterate it.
As a random stab in the dark, you could try this as your section attribute:
section=', <txp:section />'
The initial comma should grab articles from the default section too. (EDIT: you could also try section='default, <txp:section />'
)
Of course, whether this is desired behaviour on other pages remains to be seen. You may have to do an explicit check for “are we on the front page” (<txp:if_section name="">
?) and do a separate article_custom call in both branches :-( Unless someone has any better ideas.
Last edited by Bloke (2009-11-02 22:45:11)
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
#15 2009-11-03 06:23:44
- fhd
- Member
- Registered: 2009-11-01
- Posts: 13
Re: How to add a "Page last updated at..." info?
Bloke wrote:
You may have to do an explicit check for “are we on the front page” (<txp:if_section name=”“>?) and do a separate article_custom call in both branches :-( Unless someone has any better ideas.
I was starting to fear I’d need something like this. At least I’ve found a way where I do not have to duplicate the custom_article:
<txp:article_custom section='<txp:if_section name="default">home<txp:else/><txp:section/></txp:if_section>' limit="1" sort="LastMod desc" status="sticky">
Last updated: <txp:modified format="%Y-%m-%d"/>
</txp:article_custom>
I’m not totally happy with this solution since I regard it as rather non-elegant, but it pretty much does what I want. Still searching for a way to easily “include” other pages in a layout, this way I’d at least not have to copy that footer to every page layout :)
Offline
#16 2009-11-03 17:41:51
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How to add a "Page last updated at..." info?
fhd wrote:
Still searching for a way to easily “include” other pages in a layout, this way I’d at least not have to copy that footer to every page layout :)
<txp:output_form form="footer" />
Offline
#17 2009-11-03 20:13:12
- fhd
- Member
- Registered: 2009-11-01
- Posts: 13
Re: How to add a "Page last updated at..." info?
Els wrote:
<txp:output_form form="footer" />
Now that’s embarassing, I didn’t see the forest for the trees :(
But indeed, I think I can do quite a lot with forms. I’m really starting to enjoy this.
Is it advisable to put e.g. the whole HTML <head> contents into one form?
That’s admittably pretty off topic. My original problem is solved by all means.
Offline
#18 2009-11-03 20:43:46
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How to add a "Page last updated at..." info?
fhd wrote:
Is it advisable to put e.g. the whole HTML <head> contents into one form?
It’s up to you, there’s nothing against it. Everyone has his or her own preferred way of organizing pages.
Offline