Доброго вечера всем кто читает. Поговорим про Couch, поделимся наболевшим и т.д.
Самое главное - адекватный русский перевод админки
Самое главное - адекватный русский перевод админки
// А вот так работает для всех мастер-страниц
$cfg['tpls'] = $_GET['o'];
// Button
$cfg['btn_text'] = 'Copy to New';
$cfg['btn_desc'] = 'Copies the current page into a new page';
// Перевод кнопки
if ( 'RU' === K_ADMIN_LANG ){
$cfg['btn_text'] = 'Дублировать';
$cfg['btn_desc'] = 'Клонирует текущую запись в новую';
};
<cms:func 'Viktor'>
<cms:put var=k_func value='[]' is_json='1' scope='global'/><!-- "construct" global object -->
<cms:get k_func into='this' scope='global' into_scope='local'/><!-- work locally -->
<cms:set this.Name = k_func />
<cms:set this.events = '[]' is_json='1' />
<cms:func _into='this.is_object' obj='' _scope='parent'><cms:ignore>use call_ex to trim()!!</cms:ignore>
<cms:if "<cms:is_array obj />" && obj.Name ne ''>1<cms:else />0</cms:if>
</cms:func>
<cms:func _into='this.is_callable' obj='' _scope='parent'><cms:ignore>use call_ex to trim()!!</cms:ignore>
<cms:if "<cms:is_array obj />" && "<cms:is_array obj.code />"&& "<cms:is_array obj.params />">1<cms:else />0</cms:if>
</cms:func>
<cms:func _into='this.instance_of' obj='' handle='' _scope='parent'><cms:ignore>use call_ex to trim()!!</cms:ignore>
<cms:if "<cms:is_array obj />" && "<cms:is_array obj.events />" && obj.Name eq handle>1<cms:else />0</cms:if>
</cms:func>
<cms:func _into='this.set' name='' value='' handle=this.Name _scope='parent'>
<cms:ignore><!-- Метод "set" упрощает запись свойств, успешно обновляет глобальный и родительский объекты --></cms:ignore>
<cms:get 'this' into='_parent_this_' into_scope='local'/>
<cms:get handle into='this' scope='global' into_scope='parent'/>
<cms:if "<cms:call_ex this.instance_of _parent_this_ handle />"><cms:set this=_parent_this_ scope='parent' /></cms:if>
<cms:put var="this.<cms:show name case='title' />" value=value scope='parent'/>
<cms:if this.Debug>
<cms:set this.events. = "<cms:concat this.Name '::set' "(<cms:show k_named_args as_json='1'/>)"/>" scope='parent'/>
</cms:if>
<cms:put var=handle value=this scope='parent' /><cms:ignore>при внешнем вызове пишем в глобалку</cms:ignore>
<cms:put var='this' value=this scope='parent' /><cms:ignore>при внутреннем вызове пишем в предыдущий "this"</cms:ignore>
</cms:func>
<cms:func _into='this.do_something' self='' handle=this.Name _scope='parent'>
<cms:get handle into='this' scope='global' into_scope='parent'/>
<cms:if "<cms:call_ex this.instance_of self handle />"><cms:set this=self scope='parent' /></cms:if>
<cms:if this.Debug>
<cms:set _named_args = '[]' is_json='1' scope='local'/>
<cms:each k_named_args><cms:if key ne 'self'><cms:set _named_args=item scope='parent'/></cms:if></cms:each>
<cms:set this.events. = "<cms:concat this.Name '::do_something' "(<cms:show _named_args as_json='1'/>)"/>" scope='parent'/>
</cms:if>
<cms:if k_named_args.money gt '0'>
<cms:call this.set name='spent' value=k_named_args.money /><cms:ignore>внуренний вызов успешно обновляет указатель "this"</cms:ignore>
<cms:call this.set name='has' value='0' />
</cms:if>
<cms:put handle value=this scope='parent' />
</cms:func>
<cms:put this.Name value=this scope='global'/><cms:ignore><!-- Помещает массив в глобальную область видимости --></cms:ignore>
<cms:hide>
</cms:hide>
</cms:func>
<cms:test ignore='0'>
<cms:call 'Viktor'/>
<cms:call Viktor.set name='debug' value='1' />
<cms:call Viktor.do_something />
<cms:call Viktor.do_something money='20' />
<cms:call Viktor.do_something self='играть!' ili='не играть!' />
<cms:call 'broc' Viktor />
</cms:test>
<cms:config_form_view>
<cms:field 'newpage_infodoc' order='-1' label=' ' >
<cms:if k_cur_form_mode eq 'create'>
<cms:set heading_ru = 'Информация' />
<cms:set pagename_ru = 'newpage_infodoc_ru' />
<cms:show_info heading="<cms:get "heading_<cms:show k__admin_lang />" default='Infodoc'/>">
<cms:embed "<cms:show k__template_name_dashes />/_infodocs/<cms:get "pagename_<cms:show k__admin_lang />" default='newpage_infodoc'/>.html"/>
</cms:show_info>
</cms:if>
</cms:field>
</cms:config_form_view>
// 26.
// If the admin-panel uses a custom theme, set the following to the folder-name of the theme.
// Theme folder is expected to be within the 'couch/theme' folder. No leading or trailing slashes please.
//define( 'K_ADMIN_THEME', 'sample' );
define( 'K_ADMIN_THEME', 'ryazania' );
define( 'K_THEME_NAME', trim( K_ADMIN_THEME, " /\\" ) );
define( 'K_THEME_DIR', dirname(K_COUCH_DIR) . '/' . K_ADMIN_THEME . '/' );
if( !defined('K_SITE_URL') ) die( 'Please define your website\'s URL in config.php' );
define( 'K_THEME_URL', K_SITE_URL . K_ADMIN_THEME . '/' );
label="<cms:localize 'Select one group of parameters' />"
label='I`m testing localization of labels'
<cms:localize k_field_label />
Note: It is no problem for a string to become very large. PHP imposes no boundary on the size of a string; the only limit is the available memory of the computer on which PHP is running.