Recent Topics

Creating Post templates for recurring use

Started by on Jan 20, 2010 – Contents updated: Jan 20, 2010

Jan 20, 2010 01:44    

My b2evolution Version: Not Entered


I am trying to determine if b2e will allow me to do the following

Create templates for posts so when wanting to publush a new post in a specific category of the blog I can search existing post templates, edit them, and publish quickly.

Ex. template 1 might be
Hi my name is <name> Here is some <info> about this <thing>
Sincerely, <name>

One would easily edit the few specific bracketed items and publish. These templates would be used repeatedly for different events.

I have not been able to determine how/if I can do this in the admin panel and user documentation. Any assistance is appreciated to point me in the right direction.

Jan 20, 2010 05:46

Welcome to the forums!

There's no such option in default installation. Although you can do this with a very simple plugin.

I'll help you create a plugin if you want to.

Jan 20, 2010 16:12

Thank you for your responding!

I would very much appreciate help with the plugin yes, I will start reading through this area of the documentation in the meantime but any tips and guidance is welcome :)

Jan 20, 2010 20:06

You can get some ideas about how plugins work reading comments in plugins/test_plugin/
And you can start creating your own playing with plugins/skeleton.plugin.php

Basically your future plugin should include at least these 2 events


// This event will call the next one by creating a dummy "content" request
function AdminAfterMenuInit()
    global $ctrl$action;
    if( $ctrl == 'items' && $action == 'new' )
    {    // Dummy content, don't remove
        $GLOBALS['content'] = ' ';
function FilterItemContents( & $params )
    global $Blog;
    // Get the main category
    $main_category param'post_category''integer'$Blog->get_default_cat_ID() );
    $template ''// Default template, overwritten below
    if( empty($main_category) )
    {    // No category selected, use a common template
        $template 'No category selected';
    {    // A category is selected,
        // let's get a template for specific category ID
        switch( $main_category )
            case 4// Category #4
                $template 'You selected category #4';
            case 22:
                $template 'Category #22, not a bad choice';
            default: // Some other category selected
                $template 'Some other category selected';
    // Set our template
    $params['content'] = $template;
    return true;

Form is loading...

CMS engine – This forum is powered by b2evolution CMS, a complete engine for your website.