我第一次工作,jQuery.inArray()它有点奇怪.
如果对象在数组中,它将返回0,但在Javascript中0为false.所以以下将输出:"不在数组中"
var myarray = [];
myarray.push("test");
if(jQuery.inArray("test", myarray)) {
console.log("is in array");
} else {
console.log("is NOT in array");
}
Run Code Online (Sandbox Code Playgroud)
我将不得不将if语句更改为:
if(jQuery.inArray("test", myarray)==0)
Run Code Online (Sandbox Code Playgroud)
但这使得代码难以理解.特别是对于不了解这个功能的人.当"test"在数组中时,他们会期望jQuery.inArray("test",myarray)给出true.
所以我的问题是,为什么这样做?我真的不喜欢这个.但必须有一个很好的理由这样做.
我使用的是TYPO3 7.6.11和indexed_search 7.6.0.
我为indexed_search使用extbase插件,在输出中它转义HTML-Tags以标记搜索词.例如,当我搜索"搜索"时,我得到这个输出:
Test text with<strong class="tx-indexedsearch-redMarkup">search</strong> pattern.
Run Code Online (Sandbox Code Playgroud)
我发现这个问题的错误修正:https://forge.typo3.org/issues/77901
但是文件PageBrowsingResultsViewHelper.php看起来并不完全一样,即使我添加变量protected $escapeOutput = false;也不会改变任何东西.
知道这是从哪里来的,我可以在哪里禁用转义?
我找不到有关 Shopify 缓存系统的足够信息。
我知道如果模板被修改,缓存就会被清除,下一次调用将构建一个新的缓存。section但我想知道,如果只是 1或更改中的代码snipped,这会清空整个缓存,还是只是剪掉此部分的缓存or?
更重要的是,如果我们更新产品信息或库存数量会发生什么?这也会清空缓存吗?(更新通过 Shopify 应用程序运行,可能使用 Shopify API 来更新库存数量)
我的问题的原因是,如果该商店未缓存,则 TTFB(第一个字节的时间)会很高。而且很多时候商店确实是未缓存的,无需对模板进行任何手动修改。现在我试图找出这家商店经常没有缓存的原因。
当我jQuery.data用来更改值时,DOM中的属性不会更改.但我喜欢当DOM中的属性发生变化时,它更容易调试.
那么可以$().attr("data-value")用来改变数据属性吗?
只是一点点小提示,表明混合$().attr并$().data不能很好地协同工作:
有没有好的方法来测试 PHP 项目是否可以在新版本的 PHP 上正常运行?假设我们有一个在 PHP 5.0 下开发的项目,并且希望现在使用 PHP 5.4 运行它。该项目没有单元测试或类似的东西。
就用PHP 5.4运行一下,看看有没有错误,是不是保存不够。
我想在后端设置一个复选框默认选中。
showinpreview就我而言,它是文件中的字段/typo3conf/ext/news/Configuration/TCA/tx_news_domain_model_media.php。
我把值改成default了1,但是没有效果:
'showinpreview' => [
'exclude' => 1,
'label' => $ll . 'tx_news_domain_model_media.showinpreview',
'config' => [
'type' => 'check',
'default' => 1
]
],
Run Code Online (Sandbox Code Playgroud)
当我检查 tt_content 的 TCA 文件中是否有选中的复选框时,它看起来像这样:
'sectionIndex' => [
'exclude' => 1,
'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:sectionIndex',
'config' => [
'type' => 'check',
'default' => 1,
'items' => [
'1' => [
'0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled'
]
]
]
],
Run Code Online (Sandbox Code Playgroud)
我看到的唯一区别是items. 但我不太明白这个 item-value 的作用。
在我的TCA配置中,我有以下代码:
'image' => array(
'exclude' => 0,
'label' => 'LLL:EXT:myext/Resources/Private/Language/locallang_db.xml:tx_myext_domain_model_modelname.image',
'config' => array(
'type' => 'group',
'internal_type' => 'file',
'uploadfolder' => 'uploads/tx_myext',
'show_thumbs' => 1,
'size' => 5,
'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
'disallowed' => '',
'eval' => 'required'
),
),
Run Code Online (Sandbox Code Playgroud)
我添加了'eval' => 'required'(最后一行),但图像仍然不是必需的.
在文本'eval' => 'required'作品等其他元素上:
'homepage' => array(
'exclude' => 0,
'label' => 'LLL:EXT:myext/Resources/Private/Language/locallang_db.xml:tx_myext_domain_model_modelname.homepage',
'config' => array(
'type' => 'input',
'size' => 30,
'eval' => 'trim,required'
),
),
Run Code Online (Sandbox Code Playgroud)
最后一个问题:如何制作图像?
我尝试创建一个没有Text的typolink.结果应该是:
<a href="/index.php?id=123">?</a>
Run Code Online (Sandbox Code Playgroud)
到目前为止我有2个工作:
添加非打印字符:
lib.mylink = TEXT
lib.mylink .value = ‌
lib.mylink .typolink.parameter.field = field_link
Run Code Online (Sandbox Code Playgroud)
结果:
<a href="/index.php?id=123">?‌</a>
Run Code Online (Sandbox Code Playgroud)
添加评论:
lib.mylink = TEXT
lib.mylink .value = <!-- empty -->
lib.mylink .typolink.parameter.field = field_link
Run Code Online (Sandbox Code Playgroud)
结果:
<a href="/index.php?id=123">?<!-- empty --></a>
Run Code Online (Sandbox Code Playgroud)
是否有可能<a href="/index.php?id=123">?</a>没有解决方法?
我有一个问题,当JPG调整大小时,JPG太暗。PNG很好。
我从其他安装中知道imagemagick的色彩空间必须是sRGB,我对此进行了更改:
-set colorspace sRGB +profile ‚*‘
Run Code Online (Sandbox Code Playgroud)
但是JPG仍然太暗,我找不到其他配置会导致这种情况。
有任何想法吗?
typo3 ×5
extbase ×2
javascript ×2
jquery ×2
typo3-7.6.x ×2
caching ×1
fluid ×1
html5 ×1
html5-data ×1
imagemagick ×1
jpeg ×1
php ×1
shopify ×1
tx-news ×1
typoscript ×1