我正在学习本教程:http://www.atwix.com/magento/add-category-attribute/ 一切正常,属性被添加到类别中,但没有字段下方的WYSIWYG按钮.系统>配置>内容管理中启用了所见即所得.
$this->startSetup();
$this->addAttribute('catalog_category', 'custom_att', array(
'group' => 'General',
'input' => 'textarea',
'type' => 'text',
'label' => 'My attribute',
'backend' => '',
'visible' => true,
'required' => false,
'wysiwyg_enabled' => true,
'visible_on_front' => true,
'is_html_allowed_on_front' => true,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
$this->endSetup();
Run Code Online (Sandbox Code Playgroud)
无论我尝试什么,WYSIWYG都没有启用我的属性.有人可以帮忙吗?或者可能有一个解决方法吗?
编辑:我搜索了其他帖子,但都说这段代码应该添加WYSIWYG:
'wysiwyg_enabled' => true,
Run Code Online (Sandbox Code Playgroud)
但事实并非如此.
如何向我的自定义jQuery插件添加公共方法,该插件基于jquery-boilerplate中的这种模式:https: //github.com/jquery-boilerplate/jquery-patterns/blob/master/patterns/jquery.extend-skeleton. JS
我需要使用我的插件并调用这样的公共方法:
jQuery('.element').pluginName();
//And now assuming that plugin has a public method `examplePublicMethod`,
//I want to call it like this:
var instance = jQuery('#element').data('pluginName');
instance.examplePublicMethod();
Run Code Online (Sandbox Code Playgroud)
当我从链接中使用这个模式时,它是否可能?这是这种模式的代码示例:
;(function($){
$.fn.extend({
pluginName: function( options ) {
this.defaultOptions = {};
var settings = $.extend({}, this.defaultOptions, options);
return this.each(function() {
var $this = $(this);
//And here is the main code of the plugin
//...
//And I'm not sure how to add here a public method
//that will be accessible …Run Code Online (Sandbox Code Playgroud) 如何在主题 CSS 之前更改CSS文件的顺序以加载模块的CSS?以下是一些代码示例:
主题的local.xml中添加的主题CSS文件(加载在所有页面上):
<default>
<reference name="head">
<action method="addItem">
<type>skin_css</type>
<name>css/theme.css</name>
</action>
</reference>
</default>
Run Code Online (Sandbox Code Playgroud)
扩展的CSS文件(仅在类别页面上加载)添加在模块的XML布局文件中:
<catalog_category_layered>
<reference name="head">
<action method="addItem">
<type>skin_css</type>
<name>css/extension.css</name>
</action>
</reference>
</catalog_category_layered>
Run Code Online (Sandbox Code Playgroud)
这是我在类别页面上加载的CSS文件的顺序,扩展的CSS在主题的CSS之后加载:
- /default/mytheme/css/styles.css
- /default/mytheme/css/theme.css
- / default/mytheme/css/extension.css
我想要实现的目标:扩展的CSS在主题CSS之前加载.
如何强制这个CSS文件的顺序:
- /default/mytheme/css/styles.css
- / default/mytheme/css/extension.css
- /default/mytheme/css/theme.css
我注意到如果我安装了很多扩展,一些扩展的CSS在主题的CSS之前加载,其他一些扩展的CSS在主题的CSS之后加载.我假设它与Magento中的模块顺序有关,但我不明白如何影响前端的CSS(或JavaScript)文件的顺序.
我想推迟在事件上执行一些代码.使用标准setTimeout功能和插件去抖(链接到去抖动)之间究竟有什么区别?
这是一个例子 setTimeout:
var timeout;
$(window).on("scroll", function() {
clearTimeout(timeout);
timeout = setTimeout(function() {
doSomethingFunction();
}, 500);
});
Run Code Online (Sandbox Code Playgroud)
这是debounce的一个例子:
$(window).on("scroll",
$.debounce(500, doSomethingFunction)
);
Run Code Online (Sandbox Code Playgroud)
当然,对于去抖,代码更短但是还有其他好处吗? 哪一个会更快?