Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • goldorakiller Friend
    #154539

    Why JA typo button doesn’t appear in frontend K2 edit window ?

    Sherlock Friend
    #356470

    <em>@goldorakiller 195102 wrote:</em><blockquote>Why JA typo button doesn’t appear in frontend K2 edit window ?</blockquote>

    Dear goldorakiller,

    By default the JaTypo plugin did not support this feature,you can try as follow to get it

    Go to the plugin/system/jatypo.php file,look for these codes
    [PHP]
    function onAfterInitialise()
    {
    global $mainframe;

    $doc =& JFactory::getDocument();

    $base_url = JURI::base();
    global $mainframe;
    if($mainframe->isAdmin()) {
    $base_url = dirname ($base_url);
    JHTML::_(‘behavior.mootools’);
    $doc->addScript($base_url.’/plugins/system/jatypo/assets/script.js’);
    $doc->addStylesheet($base_url.’/plugins/system/jatypo/assets/style.css’);
    }
    $doc->addStylesheet($base_url.”/plugins/system/jatypo/typo/typo.css”);
    }

    function onAfterRender () {
    global $mainframe;

    $jatypo = JRequest::getCmd (‘jatypo’);
    if (!$mainframe->isAdmin() && !$jatypo) return;

    $tmpl = dirname (__FILE__).DS.’jatypo’.DS.’tmpl’.DS.’default.php’;
    $html = $this->loadTemplate ($tmpl);
    //$html = file_get_contents ($tmpl);
    //if (preg_match (‘/<body[^>]*>(.*)</body>/s’, $html, $matches)) $html = $matches[1];

    $buffer = JResponse::getBody();
    if($mainframe->isAdmin()) {
    if (preg_match (‘/id=”editor-xtd-buttons”/’, $buffer)) {
    //exist editor
    //$html = “<div id=”jatypo-wrap”>$html</div>”;
    $buffer = preg_replace (‘/</body>/’, “n$htmln</body>”, $buffer);
    JResponse::setBody ($buffer);
    }
    return;
    }

    //replace body by the sample
    $buffer = preg_replace (‘/<body([^>]*)>.*</body>/s’, “<body\1>$html</body>”, $buffer);
    JResponse::setBody ($buffer);
    }
    [/PHP]

    Change it to
    [PHP]
    function onAfterRoute()
    {
    global $mainframe;

    $doc =& JFactory::getDocument();
    $view = JRequest::getCmd (‘view’);
    $task = JRequest::getCmd (‘task’);

    $base_url = JURI::base();

    global $mainframe;
    if($mainframe->isAdmin() || (($view == ‘item’ || $view == ‘article’) && $task == ‘edit’)) {
    if($mainframe->isAdmin()) {
    $base_url = dirname ($base_url);
    }
    //$base_url = dirname ($base_url);
    JHTML::_(‘behavior.mootools’);
    $doc->addScript($base_url.’/plugins/system/jatypo/assets/script.js’);
    $doc->addStylesheet($base_url.’/plugins/system/jatypo/assets/style.css’);
    }
    $doc->addStylesheet($base_url.”/plugins/system/jatypo/typo/typo.css”);
    }
    onAfterRender
    function onAfterRender() {
    global $mainframe;
    $view = JRequest::getCmd (‘view’);

    $task = JRequest::getCmd (‘task’);
    $jatypo = JRequest::getCmd (‘jatypo’);
    if (!($mainframe->isAdmin() || (($view == ‘item’ || $view == ‘article’) && $task == ‘edit’)) && !$jatypo) return;

    $tmpl = dirname (__FILE__).DS.’jatypo’.DS.’tmpl’.DS.’default.php’;
    $html = $this->loadTemplate ($tmpl);
    //$html = file_get_contents ($tmpl);
    //if (preg_match (‘/<body[^>]*>(.*)</body>/s’, $html, $matches)) $html = $matches[1];

    $buffer = JResponse::getBody();
    if($mainframe->isAdmin() || (($view == ‘item’ || $view == ‘article’) && $task == ‘edit’)) {
    if (preg_match (‘/id=”editor-xtd-buttons”/’, $buffer)) {
    //exist editor
    //$html = “<div id=”jatypo-wrap”>$html</div>”;
    $buffer = preg_replace (‘/</body>/’, “n$htmln</body>”, $buffer);
    JResponse::setBody ($buffer);
    }
    return;
    }

    //replace body by the sample
    $buffer = preg_replace (‘/<body([^>]*)>.*</body>/s’, “<body\1>$html</body>”, $buffer);
    JResponse::setBody ($buffer);
    }
    [/PHP]

    I do hope that will help !

    goldorakiller Friend
    #356472

    Ok i try this and tell you.

    I think this should be added in next ja typo version 🙂

    EDIT :
    That’s not work as I want .
    Your code add typo example but not the ja typo button like in backend !
    I’d like that K2 frontend works like backend

    EDIT 2 :
    Ok now it’s work !
    Thx dathq

Viewing 3 posts - 1 through 3 (of 3 total)

This topic contains 3 replies, has 2 voices, and was last updated by  goldorakiller 14 years, 2 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum