如何在我的Ubuntu Apache服务器上启用错误日志,以便在发生任何错误时发生任何PHP语法和其他错误,服务器错误应该存储在错误日志文件中
另外我如何查看apache错误日志文件?
今天我在magento前端实现了Ajax分页.请看看它可能有助于您理解.
阻止文件...
class Namesapce_ModuleName_Block_Productlist extends Mage_Core_Block_Template
{
public function __construct()
{
$this->_setProductCollaction();
}
private function _setProductCollaction()
{
/** YOUR COLLACTION **/
$collection = Mage::getModel('catalog/product')->getCollection();
$this->setCollection($collection);
}
protected function _prepareLayout()
{
parent::_prepareLayout();
$pager = $this->getLayout()->createBlock('page/html_pager', 'custom.pager');
$pager->setAvailableLimit(array(5 => 5));
$pager->setCollection($this->getCollection());
$this->setChild('pager', $pager);
$this->getCollection()->load();
return $this;
}
public function getPagerHtml()
{
return $this->getChildHtml('pager');
}
}
Run Code Online (Sandbox Code Playgroud)
您的PHTML文件
<table class="data-table gapBottom14" id="order-table">
<colgroup>
<col width="23%" />
<col width="67%" />
<col width="10%" />
</colgroup>
<thead>
<tr class="first last">
<th rowspan="1"><span class="nobr"><?php echo $this->__('sku'); ?></span></th>
<th …
Run Code Online (Sandbox Code Playgroud) 我需要对以下Magento文件进行一些更改:
问题是; 我应该编辑这些文件吗?它们是核心文件(如果我升级Magento会被替换)吗?
如果我不应该编辑它们,如果我想更改这些文件的内容,该怎么办?
我对输入字段有以下命名约定。
course_details[0][d_Total_Score]
course_details[1][d_Total_Score]
course_details[2][d_Total_Score]
Run Code Online (Sandbox Code Playgroud)
现在我想用一些规则验证这些字段。以下是我尝试过的代码。
$validatedData = $request->validate([
'course_details.0.d_Total_Score' => 'required',
'course_details.1.d_Total_Score' => 'required',
'course_details.2.d_Total_Score' => 'required'
]);
Run Code Online (Sandbox Code Playgroud)
我从这里参考了
但这似乎不起作用。
HTML 代码:
<input placeholder="SAT score " class="form-control form-control-sm valid" id="d_Score_Sub_Category_SAT" name="course_details[0][d_Total_Score]" value="" aria-invalid="false" type="text">
Run Code Online (Sandbox Code Playgroud)
已解决:正如 d3jn 所说,验证不应覆盖任何地方。
我正在创建一个symfony2项目并使用JMS序列化程序包来序列化我的对象以进行数据库存储(我知道这不是最好的方法).
但现在我的问题是,当我更改对象的属性并反序列化Json字符串时,JMS序列化程序忽略不存在的属性而不是抛出错误,这实际上很棒.但我想记录这样的事件.
下面是一个例子来说明我的问题
我的数据库中的Json字符串:
$dataToBeDeserialized = {"title":"testing123","text":"Lorem Ipsum"}
Run Code Online (Sandbox Code Playgroud)
识别TestClass:
/**
* @Type("string")
*/
protected title;
/**
* @Type("string")
*/
protected text;
Run Code Online (Sandbox Code Playgroud)
反序列化方法:
$this->serializer = SerializerBuilder::create()->build();
$this->serializer->deserialize($dataToBeDeserialized, 'TestClass', 'json');
Run Code Online (Sandbox Code Playgroud)
这导致:
TestClass {
title: "testing123",
text: "Lorem Ipsum"}
Run Code Online (Sandbox Code Playgroud)
但是,当我更改我的Testclass并重命名(或删除)标题时,让我们说"title2",反序列化器忽略Json字符串中的"title"属性.这导致:
TestClass {
title2: "",
text: "Lorem Ipsum"}
Run Code Online (Sandbox Code Playgroud)
那没问题.数据库中的数据是错误的.但我想记录这个问题.我该怎么做?如果可能的话,我不想搞乱JMS序列化程序的代码(因为我不能再更新它).在我的TestClass中查找空属性也不是最好的方法,因为它们可以为null.
是否可以获取 BlogSpot 特定关键字的 RSS 提要?我已尝试使用以下网址,但它们似乎不起作用。
Atom 1.0: https://blogname.blogspot.com/feeds/posts/default/-/[label]
RSS 2.0: https://blogname.blogspot.com/feeds/posts/default/-/[label]?alt=rss
Run Code Online (Sandbox Code Playgroud) 目前我正在创建一个注册表单并使用Magento VarienForm方法对其进行验证.我只想知道如何判断用户是否通过了验证?如果失败那么我将停止ajax.这是我的代码:
var dataForm = new VarienForm('register-form', true);
jQuery('#register-form').submit(function(e){
jQuery.post( "<?php echo $baseUrl; ?>quickcheckout/index/register", jQuery( "#register_form_mobile" ).serialize()).done(function( data ) {
var successRegister = isNumber(data);
if(successRegister)
{
location.reload();
}
else
{
console.log(data);
}
});
})
Run Code Online (Sandbox Code Playgroud) 大家好,我有这样一个元素:
<div class="price-box">
<span class="regular-price" id="product-price-27">
<span class="price">
...
</span>
</span>
</div>
<input type="text" name="qty" id="qty" maxlength="12" value="1" title="Qty" class="input-text qty" />
Run Code Online (Sandbox Code Playgroud)
我试图用这条线获得价值
document.getElementByClassName('input-text qty').value="myvalue"
Run Code Online (Sandbox Code Playgroud)
但那没用
如何在没有jquery的情况下获取值?注意:我在项目中包含了prototype.js!
这个怎么样:
<button type="button" title="Add to Cart" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span>Add to Cart</span></span></button>
Run Code Online (Sandbox Code Playgroud)
我想用Javascript和它的类名!!!来禁用它?
我对 React 非常陌生。以下是我的第一个脚本。
但我收到以下错误。
未捕获的语法错误:意外的标记 <
我什至通过 google/SO 进行了搜索。但我无法让它工作。
<!DOCTYPE html>
<html>
<head>
<title>First React App</title>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="app">
</div>
<script>
const name = 'John doe'
const handle = '@john_doe'
function NameComponent (props){
return <h1>{props.name}</h1>;//The problem is here using JSX syntax
}
function HandleComponent(props){
return <h3>{props.handle}</h3>;
}
function App(){
return (
<div id="container">
<NameComponent name={name}/>
<HandleComponent handle={handle}/>
</div>
);
}
ReactDOM.render(<App />,document.getElementById('app'));
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) Magento 1.7中已有一个功能,目录价格范围为"网站".是否有任何解决方案使目录价格范围为"商店视图"表现为存储范围.
我用这段代码列出了子类别
$root = Mage::getModel('catalog/category')->load(3); // Put your category ID here.
$subCat = explode(',',$root->getChildren());
$collection = $root->getCollection()->addAttributeToSelect("*")->addFieldToFilter("entity_id", array("in", $subCat) );
foreach($collection as $subcategory) {
echo '<a href="'.$subcategory->getURL() .'" />» '.$subcategory->getName().'</a><br/>';
}
Run Code Online (Sandbox Code Playgroud)
我想只显示前3个子类别.我该怎么做?
magento ×5
php ×4
javascript ×3
prototypejs ×2
ajax ×1
apache ×1
blogger ×1
error-log ×1
json ×1
laravel ×1
laravel-5.5 ×1
list ×1
magento-1.7 ×1
reactjs ×1
rss ×1
symfony-2.6 ×1
ubuntu ×1