pre-filled extries

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Eike

pre-filled extries

Post by Eike »

Hi,

I would like to always have some standard HTML contructs in my new entries, when I create them. To be more specific: When I select to create a new entry I want it's main text field (which I use as a brief overview) to be prefilled with a sceleton like this:

Code: Select all

<table style="WIDTH: 80%" cellspacing="1" cellpadding="1" border="0"><tbody><tr><td>pic</td><td>txt</td></tr></tbody></table>
It will be a little smaller than the advanced entry (80%) then and I always insert a small picture on the left.

Is there a plugin allowing me to use such a new entry template / skeleton?
Or what else can be done to reach the desired behavoir?


Thanks for your help!

Eike
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: pre-filled extries

Post by garvinhicking »

At first: You don't want to use that HTML. Using that table construct sucks. I instead would use something like:

Code: Select all

<div class="default">
<img src="PIC" class="pic" /><p>TXT</p>
</div>
That is much cleaner and leaner. In your CSS you would then have this:

Code: Select all

div.default {
    width: 80%;
    clear: both;
}

div.default img {
    float: left;
}

div.default p {
    margin: 1em;
}
And yes, you would use a plugin for that. Actually, you can use an existing plugin for that.

Install the serendipity_event_includeentry plugin ("Markup: Include entry data/templates/blocks") via spartacus or download it here: http://cvs.sourceforge.net/viewcvs.py/p ... cludeentry).

The plugin can do much more than you might probably want, but you can configure it so that it doesn'T apply all the other goodies it has.

You then click on the "Static block" new menu item after having it installed. There you can create entry templates. You fill in your HTML code you want to have as default text for your new entry. Then you can start a new entry from this page if you choose the corresponding template.

That's more flexible and versatile, because you can use different templates to use depending on the article you want to write.

You could build your own plugin if you look at the code (if you know some PHP) which inserts your text hard-coded, if you still want to, though. :)

Have fun,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Eike

THANKS!

Post by Eike »

Hi Garvin,

thanks for your help! Your solution just works fine!

Eike
Post Reply