Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-12-07 17:53:29

JonahC
Member
From: Toronto
Registered: 2007-09-23
Posts: 39
Website

Automatically insert something in the body area of the write tab

Hi-

I’ve looked for a plugin and searched the forums for this and can’t find the answer. Just to make sure there is no solution out there that I haven’t found…

Is there a way to automatically pre-populate the body text area in the write tab with some code or text like shown below:

<div class=“gallery”>
Place where I later insert images in.
</div>
<txp:output_form form=“title-regular” />
<txp:output_form form=“form2” />

Currently I always have to type this code block every time I write a new article. Is there a way to have it there automatically which I can then delete / modify / add to? Thanks.

Last edited by JonahC (2007-12-07 17:57:19)


Jonah Calinawan
www.foodportraits.com

Offline

#2 2007-12-07 18:00:21

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Automatically insert something in the body area of the write tab

if you use that in all articles, put it in a template/form.

Offline

#3 2007-12-07 18:04:16

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: Automatically insert something in the body area of the write tab

before rushing for a plugin wouldn’t it just be simpler to add that to your article form??
if you’re still using textpattern like that then you’re definitely not harnessing its potential.

if i understand you correctly you can just make a form like:

<div class="gallery">
<txp:body />
</div>
<txp:output_form form="title-regular" />
<txp:output_form form="form2" />

Offline

#4 2007-12-07 18:08:17

JonahC
Member
From: Toronto
Registered: 2007-09-23
Posts: 39
Website

Re: Automatically insert something in the body area of the write tab

Hi ruud:

that’s the thing… each article is different…. the class (gallery, gallery2, gallery3), the name of the forms (title-regular, title-nopadding, form2, form3, etc) may be different for each article depending on the layout that is suitable for each article. However, each article does have this structure so I wanted to save some annoyance by having the write area already have this “template” in place. Thanks for responding.

<div class=“gallery”>
Place where I later insert images in.
</div>
<txp:output_form form=“title-regular” />
<txp:output_form form=“form2” />

additional edit:

Hi iblastoff – my default form that shows the article post only has <txp:body />

I set it up this way so that I could change the layout for each article depending on the number of images, size of images, that I want. It’s sort of like the flexy template without using custom fields. maybe there’s a better way then, although I’m really liking this method that I created, because each article could really be different in layout.

here two pages using the same structure faux-3 column layout and regular-layout.

Last edited by JonahC (2007-12-07 18:26:50)


Jonah Calinawan
www.foodportraits.com

Offline

#5 2007-12-07 19:13:28

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

Re: Automatically insert something in the body area of the write tab

You could use custom fields and asy_wondertag.

<div class="<txp:custom_field name="class" />">
<txp:body />
<txp:asy_wondertag><txp:output_form form="<txp:custom_field name="form1" />" /></txp:asy_wondertag>
<txp:asy_wondertag><txp:output_form form="<txp:custom_field name="form2" />" /></txp:asy_wondertag>

Then for every article you’d only have to add the images code in the body, and the class and two form names in the custom fields.

Offline

#6 2007-12-07 19:42:47

JonahC
Member
From: Toronto
Registered: 2007-09-23
Posts: 39
Website

Re: Automatically insert something in the body area of the write tab

Thanks Els

Something I didn’t mention in my initial post (sorry guys!) is that the order maybe different in each article, I sometimes rearrange the order of these forms depending on the layout that I want so

<div class=“gallery”>
image1
image2
image3…
</div>
<txp:output_form form=“title-regular” />
text text text
<txp:output_form form=“form2” />

could be reordered to

<div class=“gallery”>
image1
<txp:output_form form=“title-regular” />
text text text
image2
image3…
</div>
<txp:output_form form=“form2” />

or to

<txp:output_form form=“title-regular” />
<div class=“gallery”>
image1
image2
image3…
<txp:output_form form=“form2” />
</div>
text text text

and it can go on forever with multiple variations which gives multiple layouts without really changing anything but the order of the forms. Now I don’t use all these variations, but it’s there when I need it. That’s why I couldn’t use an article form to generate the layout because the layout itself changes. I’ll just continue typing the stuff for now. I’ll think about it some more. Thanks to all for your ideas.

Last edited by JonahC (2007-12-07 19:56:38)


Jonah Calinawan
www.foodportraits.com

Offline

#7 2007-12-07 20:56:18

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

Re: Automatically insert something in the body area of the write tab

You can also set a default value for the ‘body’ field in the db (using phpMyAdmin).

Offline

#8 2007-12-07 21:15:59

JonahC
Member
From: Toronto
Registered: 2007-09-23
Posts: 39
Website

Re: Automatically insert something in the body area of the write tab

Els:

I think that would be great! How do I do that? As long as it doesn’t screw up the existing published articles and not screw up future upgrades to newer versions of txp, I’m all for it!

I really just need the default code block so I don’t have to keep on typing it. It’s sort of like how there is a default for the section and the comment title, etc, I need a default value for the body field. I could then rearrange it, delete it, etc into whatever configuration I want. It’s really not a big deal though so if there’s no solution to this I’m fine with it, but I’m just getting lazy…

Regards,

Last edited by JonahC (2007-12-07 21:36:37)


Jonah Calinawan
www.foodportraits.com

Offline

#9 2007-12-07 21:40:50

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

Re: Automatically insert something in the body area of the write tab

Ok I spoke too soon :(
I just tried and apparently TEXT type columns can’t have a default value. I didn’t know that, sorry for letting you think it was possible.

Offline

#10 2007-12-07 21:44:19

JonahC
Member
From: Toronto
Registered: 2007-09-23
Posts: 39
Website

Re: Automatically insert something in the body area of the write tab

thanks for trying, really appreciate it.


Jonah Calinawan
www.foodportraits.com

Offline

#11 2007-12-08 06:10:09

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

Re: Automatically insert something in the body area of the write tab

Jonah

take a look at the firefox Text Complete Plugin. It can do this for you. Just setup some text templates and expand the one you want in the body field.

Hope that helps!


Steve

Offline

#12 2007-12-08 06:36:55

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Automatically insert something in the body area of the write tab

Another way is install one of those WYSIWYG editors and then you could make there extra tab that inserts your desired code. It would be guite easy, because most of those editors are really flexible. I use it with a gaming reviews to insert detail-list to the articles body.

Cheers!

Last edited by Gocom (2007-12-08 06:37:25)

Offline

Board footer

Powered by FluxBB