使用PHPExcel,我正在使用:
$workSheet->fromArray($array);
设置我的数据.但是,需要将一列设置为字符串(前导零的数字,如果未设置为字符串,前导零将被截断).如果我没有使用该fromArray方法,我可以使用设置数据类型PHPExcel_Worksheet::setCellValueExplicit().
但是,我想使用一系列列来完成此操作.理想情况下是这样的:
$worksheet->getCell('A1:A50')->setDataType(PHPExcel_Cell_DataType::TYPE_STRING);
Run Code Online (Sandbox Code Playgroud)
但是看一下代码,getCell不会允许一个范围,只有一个单元格.我怎样才能做到这一点?
我有以下内容:
$products = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSort('id', 'RAND()')
->addAttributeToSelect('small_image')
->addCategoryFilter(Mage::getModel('catalog/category')->load($catId));
Run Code Online (Sandbox Code Playgroud)
但我需要通过id订购RAND(),我该怎么做?(代码显示我是如何尝试没有运气的)
Magento除了显示白色主页外没有显示任何内容,在error_log中给出的错误是:
client denied by server configuration: /var/www/httpdocs/app/etc/local.xml
Run Code Online (Sandbox Code Playgroud)
我可以很好地访问管理区域,有谁知道为什么会发生这种情况?
我的内容被替换为ajax但有时一个元素在两个页面上具有相同的id(即,主页上的照片在gallery页面上具有相同的id).这意味着当调用dojo.parser.parse时,尝试重新添加小部件,并抛出以下错误:
Error: Tried to register widget with id==____ but that id is already registered
Run Code Online (Sandbox Code Playgroud)
理想情况下,我想要做的是在AJAX替换的DOM节点上运行destroyRecursive.我已经尝试了以下两种方法,但都没有工作(我相信destroyRecursive是针对小部件而不是DOM?):
dojo.byId('main').destroyRecursive();
dijit.byId('main').destroyRecursive();
Run Code Online (Sandbox Code Playgroud)
有没有一种很好的方法可以做到这一点,还是我需要尝试确保我的所有ID都不同?
有人知道magento商店的管理员是否在创建新订单时收到电子邮件?如果是这样,我在哪里/如何编辑它?
我运行ZF 1.11没有问题,并按照性能指南中的说明删除require_once语句.我已经将自动加载器添加到我的索引文件中(正如他们所说的那样(我不明白为什么这不能进入boostrap),但现在我的插件找不到了.
例如,表单使用'DijitElement'装饰器,它返回错误:
Zend_Loader_PluginLoader_Exception: Plugin by name 'DijitElement' was not found in the registry; used paths: Zend_Form_Decorator_: Zend/Form/Decorator/ in C:\wamp\www\cms\library\Zend\Loader\PluginLoader.php on line 412
Run Code Online (Sandbox Code Playgroud)
在这个表单构造函数中,我添加了以下内容以尝试修复它无济于事:
$this->addPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator', 'DECORATOR');
Run Code Online (Sandbox Code Playgroud)
如果我重命名装饰器使用'Zend_Dojo_Form_Decorator_DijitElement'而不仅仅是'DijitElement',我得到:
Plugin by name 'Zend_Dojo_Form_Decorator_DijitElement' was not found in the registry; used paths: Zend_Dojo_Form_Decorator_: Zend/Dojo/Form/Decorator/ Zend_Form_Decorator_: Zend/Form/Decorator/
Run Code Online (Sandbox Code Playgroud)
在我的bootstap中,我使用插件缓存,在我删除require_once之前,我在构造函数中没有前缀路径工作正常,但删除后我尝试了有和没有工作.
protected function _initPluginCache() {
$path = '/cache/pluginLoaderCache.php';
if(file_exists($path)) include_once $path;
$loader = new Zend_Loader_PluginLoader(array(
'Zend_View_Helper'=>LIBRARY_PATH.'/Zend/View/Helper/',
'Zend_Dojo_View_Helper'=>LIBRARY_PATH.'/Zend/Dojo/View/Helper',
'Zend_Dojo_Form_Decorator'=>'Zend/Dojo/Form/Decorator',
'Zend_Dojo_Form_Element'=>LIBRARY_PATH.'/Zend/Dojo/Form/Element'
));
$loader = Zend_Loader_PluginLoader::setIncludeFileCache($path);
}
Run Code Online (Sandbox Code Playgroud)
如何告诉Zend文件的位置?我假设这与我的自动加载器有关,但指南只是说添加这将解决问题:
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
Run Code Online (Sandbox Code Playgroud)
仅供参考,指南在http://framework.zend.com/manual/en/performance.classloading.html
我无法getIdentifier使用类变量.这很奇怪,因为这有效:
public Drawable getStationIcon(Context context) {
int resId = context.getResources().getIdentifier("m1m2_16", "drawable", "com.mypackage.namehere");
Drawable drawable = context.getResources().getDrawable(resId);
return drawable;
}
Run Code Online (Sandbox Code Playgroud)
但这不是:
public Drawable getStationIcon(Context context) {
int resId = context.getResources().getIdentifier(this.stationIcon, "drawable", "com.mypackage.namehere");
Drawable drawable = context.getResources().getDrawable(resId);
return drawable;
}
Run Code Online (Sandbox Code Playgroud)
这也不是:
public Drawable getStationIcon(Context context) {
String stationI = this.stationIcon;
int resId = context.getResources().getIdentifier(stationI, "drawable", "com.mypackage.namehere");
Drawable drawable = context.getResources().getDrawable(resId);
return drawable;
}
Run Code Online (Sandbox Code Playgroud)
而且this.stationIcon绝对等同m1m2_16.我已经尝试了其他替代方案,即使用""+this.stationIcon,但当第一个参数是变量时,没有任何作用.有什么我想念的吗?
如果ENV为真或定义(如果未定义,则假定为假),我需要运行一组RewriteCond语句.我一直在尝试使用:
RewriteCond %{ENV:IS_MOBILE} ^true$
RewriteCond ...
Run Code Online (Sandbox Code Playgroud)
并且(不确定这是否有效)
RewriteCond %{ENV:IS_MOBILE} !=true
RewriteCond...
Run Code Online (Sandbox Code Playgroud)
但似乎都不起作用.我能做到这一点吗?
我有一个在我的应用程序中使用的xml文件中的经度和经度点列表.我发现自己重复这段代码以获得积分并认为必须有更好的方法吗?
String[] mTempArray = getResources().getStringArray(R.array.stations);
int len = mTempArray.length;
mStationArray = new ArrayList<Station>();
for(int i = 0; i < len; i++){
Station s = new Station();
String[] fields = mTempArray[i].split("[\t ]");
s.setValuesFromArray(fields);
Log.i("ADD STATION", ""+s);
mStationArray.add(s);
}
Run Code Online (Sandbox Code Playgroud)
XML的格式为:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="stations">
<item>
<name>Station name</name>
<longitude>1111111</longitude>
<latitude>11111</latitude>
<code>1</code>
</item>
Run Code Online (Sandbox Code Playgroud)
另一个(可能的)问题是,为了得到一个站,我必须得到所有这些并从阵列中拉出我想要的那个.这会慢得多吗?我可以在整个应用程序中使这个数组一致吗?(但保持单独的Intent方法)
从1.4升级到1.5后,快速搜索将返回所有产品.高级搜索工作得很好.我已经清除了缓存并重新索引了所有内容,但仍然没有.有什么想法吗?
搜索也不会应用管理员中设置的最小查询长度(即,我可以不输入任何内容并仍然显示所有内容).在LIKE或FULLTEXT搜索之间切换似乎什么都不做.
我已经看到这个Magento Search返回所有产品,但我的所有插件都是最新的(我没有任何搜索插件).