Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-02-13 21:07:59

travholt
Member
From: Oslo, Norway
Registered: 2004-08-04
Posts: 14
Website

Side notes in Textpattern?

Hello!

I’d like to create “snippets” of text to display as side notes in articles. For example, I’d like boxes with explanations and links to more information, and I’d like to reuse those boxes and having them all update when I change the original copy of it.

So I thought I might write them as articles, and then it would be perfect if I could use ≤txp:article_custom id=”#” form=“sidenote” /> inside my other articles to fetch it. But I guess Textpattern won’t process txp tags inside articles …?

Is there a way to make it do that, or another way to solve this? Ideally, I’d like to include as many side notes as I need, and just insert them where I need them in the text.

Offline

#2 2007-02-13 21:24:20

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Side notes in Textpattern?

travholt

You could try writing the “Sidebars” as forms of type misc and then simply including them wherever you need them: in other forms, pages or even articles.


Steve

Offline

#3 2007-02-13 22:35:54

travholt
Member
From: Oslo, Norway
Registered: 2004-08-04
Posts: 14
Website

Re: Side notes in Textpattern?

Ah, right. Well, I was hoping to avoid crowding my forms list, but that’s one way to do it. Although I would like to do it another way. Ideally the misc form would take an optional article ID as an attribute, whereupon one could get access to the article’s title, body etc. in the form, just as one can with article_custom …

(Consider this a request for such a plugin! :-) )

Offline

#4 2007-02-14 19:07:38

anoke
Archived Plugin Author
Registered: 2006-04-15
Posts: 152

Re: Side notes in Textpattern?

Hmm.. Override form under (article edit’s) Advanced Options? You might do several forms for different side notes. Though every new ‘sidenote’ means a new form.

Or you might do something like following in the article form

<txp:if_custom_field name="sidenotes" val="1">
  <txp:article_custom id="1"/>
</txp:if_custom_field>

I didn’t try out either of those.. If the second idea works it might take wings with the wondertag.


- When chickens are cold, they roost in trees; when ducks are cold, they plunge into water -

Offline

#5 2007-02-14 21:03:33

travholt
Member
From: Oslo, Norway
Registered: 2004-08-04
Posts: 14
Website

Re: Side notes in Textpattern?

Not a bad idea, that, anoke — but it would limit the number of side notes to one per article, and also restricts its placement. But for me it might actually work out okay, at least for the kind of side note I’m thinking of: More info on the subject of the article; a quick explanation/definition, and maybe a few links.

Offline

#6 2007-02-14 22:41:30

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Side notes in Textpattern?

Just a wild idea…

In your article you can use <txp:output_form />. You can use that to call a form in which you have an article_custom tag. If you use a custom field (or more) for the id(s) of the sidenote article(s), you could use asy_wondertag to do something like this: <txp:article_custom id="<txp:custom_field name="sidenote" />" />.

Not sure if this will work, but maybe it’s worth a try?

Offline

#7 2007-02-14 22:50:27

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: Side notes in Textpattern?

travholt wrote:

I’d like to create “snippets” of text to display as side notes in articles. For example, I’d like boxes with explanations and links to more information, and I’d like to reuse those boxes and having them all update when I change the original copy of it.

I think there’s a very attractive example of what you’d like to achieve in this thread , the Gozo Report in particular.

However these green boxes are created as custom html for any given article, so there’s no way of globally updating them. I’d sure like to know of a way though to do that.

Cheers Martin

Offline

#8 2007-02-15 19:17:52

anoke
Archived Plugin Author
Registered: 2006-04-15
Posts: 152

Re: Side notes in Textpattern?

Hmm.. So these ‘snippets’ are for one article only? If you create three snippets for article #4 you aren’t going to reuse any of these for article #5? Article #5 gets its own snippets?

Kind of “metadata articles”?


- When chickens are cold, they roost in trees; when ducks are cold, they plunge into water -

Offline

#9 2007-02-15 20:13:08

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: Side notes in Textpattern?

anoke wrote:

Hmm.. So these ‘snippets’ are for one article only? If you create three snippets for article #4 you aren’t going to reuse any of these for article #5? Article #5 gets its own snippets?

Yes, that’s how I understood it. Like I mentioned in the thread, it would be great if one could create those snippets as separate articles that could be pulled into any article just like an include. However this wouldn’t give you any form of customised output in the snippets based on what article they’re being placed in.

Offline

#10 2007-02-15 20:18:24

travholt
Member
From: Oslo, Norway
Registered: 2004-08-04
Posts: 14
Website

Re: Side notes in Textpattern?

Nope, on the contrary: They’re definitely for reuse. Let’s say I write many different posts about “Getting Things Done” (which, incidentally, I do). Not everyone knows what GTD is all about, and I’d like to say a few words about it and link to a few other places, as a service to new readers that haven’t read all the previous posts about it. I’d also like to update this side note, or it could be called a “fact box”, in one place and have it change across the board.

I’ve done this now with output_form and a special form, but I don’t like it much, because the side note is definitely content, not a form. The forms should be reserved for presentation, and content should stay under the “Content” part of Textpattern.

So, ideally, I’d be able to do something like this in my article:

<txp:output_form form="sidenote" id="10" />

The form could then use the various fields of an article, like <txp:body />.

Edit: Just clarified the first paragraph a little.

Last edited by travholt (2007-02-15 20:23:31)

Offline

#11 2007-02-15 20:45:14

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: Side notes in Textpattern?

Thanks for posting that travholt – what a great tip! :-)

Regarding the…
<txp:output_form form="sidenote" id="10" />

I agree, it would be terrific if txp:output_form was context-aware – definitely one for the feature request list!

Offline

#12 2007-02-15 21:44:30

anoke
Archived Plugin Author
Registered: 2006-04-15
Posts: 152

Re: Side notes in Textpattern?

So why not (sticky) articles? <txp:article_custom id="10" form="only_body" /> etc and you’ll get all article goodies.

But, as with forms, an article with three snippets would require three txp-tags.. IIRC there was a plugin that let you do <really_custom_article id="10,42,47" />. But even without it there might be way to use custom fields and keywords to make a list of “linked articles”.

Hmm, “context-aware txp:output_form”? I don’t get it – sounds interesting though.. (GTD is next on my reading list btw :)


- When chickens are cold, they roost in trees; when ducks are cold, they plunge into water -

Offline

Board footer

Powered by FluxBB