Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

shortcode problem


Go to End


2 Posts   1190 Views

Avatar
snaip

Community Member, 181 Posts

24 February 2011 at 11:04pm

Edited: 24/02/2011 11:17pm

hi

i'm tring to make shortcode

by the tutorial http://www.ssbits.com/tutorials/2010/2-4-using-short-codes-to-embed-a-youtube-video/ and some posts in forum i made this

_config.php

ShortcodeParser::get('default')->register('ListaKategorii',array('StaticPage','ListaKategoriiShortCode'));

StaticPage.php


class StaticPage extends SiteTree {

    function ListaKategoriiShortCode() {
          return $this->renderWith('ListaKategorii');
    }

}

class StaticPage_Controller extends DB_Controller {
}

ListaKategorii.ss (in Includes folder)

some Lorem Ipsum text

now putting in tinyMCE text [listaKategorii] but it doesn't work

Avatar
snaip

Community Member, 181 Posts

24 February 2011 at 11:11pm

Edited: 24/02/2011 11:32pm

[solved]

change ListaKategoriiShortCode() function to this

    public function ListaKategoriiShortCode() {
        $template = new SSViewer('ListaKategorii');
        return $template->process();
    }