Pages: After creation

Contents

    After a page is created Bludit calls the hook afterPageCreate. This hooks is also called for the pages created by the scheduler.

    This feature is implemented since Bludit v3.13

    Example: Append string to the title

    The following plugin append a string at the beginning of the page after the page is created.

    <?php
    
    class TitleAppender extends Plugin {
    
        public function afterPageCreate($key)
        {
            $page = new Page($key);
            $currentTitle = $page->title();
            $newTitle = 'Summer: '.$currentTitle;
    
            global $pages;
            $pages->edit(array(
                    'key'=>$key,
                    'title'=>$newTitle
            ));
        }
    
    }
    
    ?>

    You can download the full example plugin from here: