这是我的第一篇帖子...... 我有一个修改的php文件的问题,但不是来自我。 在菜单项中,我发现此错误: 1054未知列'数组'在' where子句' SQL = SELECT * FROM #__content WHERE Array =' 4' 在另一个菜单项中我发现了这个: 警告:在第113行的/ home / templates / rt_nuance / html / com_tags / tag / default.php中为foreach()提供的参数无效
这是我的.php文件:
<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Note that there are certain parts of this layout used only when there is exactly one tag.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$isSingleTag = (count($this->item) == 1);
?>
<div class="tag-category<?php echo $this->pageclass_sfx; ?>">
<?php if ($this->params->get('show_page_heading')) : ?>
<h1>
<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if ($this->params->get('show_tag_title', 1)) : ?>
<h2>
<?php echo JHtml::_('content.prepare', $this->tags_title, '', 'com_tag.tag'); ?>
</h2>
<?php endif; ?>
<?php // We only show a tag description if there is a single tag. ?>
<?php if (count($this->item) == 1 && (($this->params->get('tag_list_show_tag_image', 1)) || $this->params->get('tag_list_show_tag_description', 1))) : ?>
<div class="category-desc">
<?php $images = json_decode($this->item[0]->images); ?>
<?php if ($this->params->get('tag_list_show_tag_image', 1) == 1 && !empty($images->image_fulltext)) : ?>
<img src="<?php echo htmlspecialchars($images->image_fulltext); ?>">
<?php endif; ?>
<?php if ($this->params->get('tag_list_show_tag_description') == 1 && $this->item[0]->description) : ?>
<?php echo JHtml::_('content.prepare', $this->item[0]->description, '', 'com_tags.tag'); ?>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php // If there are multiple tags and a description or image has been supplied use that. ?>
<?php if ($this->params->get('tag_list_show_tag_description', 1) || $this->params->get('show_description_image', 1)): ?>
<?php if ($this->params->get('show_description_image', 1) == 1 && $this->params->get('tag_list_image')) : ?>
<img src="<?php echo $this->params->get('tag_list_image'); ?>">
<?php endif; ?>
<?php if ($this->params->get('tag_list_description', '') > '') : ?>
<?php echo JHtml::_('content.prepare', $this->params->get('tag_list_description'), '', 'com_tags.tag'); ?>
<?php endif; ?>
<?php endif; ?>
<?php echo $this->loadTemplate('items'); ?>
<?php if (($this->params->def('show_pagination', 1) == 1 || ($this->params->get('show_pagination') == 2)) && ($this->pagination->get('pages.total') > 1)) : ?>
<div class="pagination">
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter pull-right"> <?php echo $this->pagination->getPagesCounter(); ?> </p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
<?php
jimport('joomla.application.component.controller');
$app = JFactory::getApplication();
//j3 compatibility
if(!defined('DS')){
define('DS',DIRECTORY_SEPARATOR);
}
JLoader::register('J2StoreController', JPATH_COMPONENT.'/controllers/controller.php');
JLoader::register('J2StoreModel', JPATH_ADMINISTRATOR.'/components/com_j2store/models/model.php');
JLoader::register('J2StoreView', JPATH_ADMINISTRATOR.'/components/com_j2store/views/view.php');
require_once (JPATH_ADMINISTRATOR.'/components/com_j2store/library/base.php');
require_once (JPATH_SITE.'/components/com_j2store/helpers/utilities.php');
require_once (JPATH_ADMINISTRATOR.'/components/com_j2store/library/prices.php');
require_once (JPATH_ADMINISTRATOR.'/components/com_j2store/helpers/strapper.php');
require_once (JPATH_ADMINISTRATOR.'/components/com_j2store/version.php');
require_once (JPATH_SITE.'/components/com_j2store/models/products.php');
J2StoreStrapper::addJS();
J2StoreStrapper::addCSS();
$tes_prod = new J2StoreModelProducts();
$tes_prod->setId('118');
$test_item = $tes_prod->getItem();
$test_data = J2StoreHelperCart::getItemInfo('118');;
?>
<h1 style="color#f00">TAG</h1>
<link href="<?php echo JURI::base().'media/j2store/css/j2store-product.css' ?>" rel="stylesheet" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.1.8/imagesloaded.pkgd.js"></script>
<style>
.sm-row-fluid :nth-child(3n+4){margin-left:0; clear: both; }
.sm-row-fluid + table{display:none;}
.j2store-item-title-link {display:block;}
</style>
<div class="row-fluid sm-row-fluid">
<?php foreach( $this->items as $value):
$this_prod_obj = new J2StoreModelProducts();
$this_prod_obj->setId($value->content_item_id);
$item = $this_prod_obj->getItem();
$product = array(
'id' => $value->content_item_id,
'name' => $item->product_name,
'main_image' => $item->main_image ,
'price' => number_format ( $item->item_price, 2 ),
'special_price' => number_format ( $item->special_price, 2 ),
'discount' => number_format ( 100-($item->special_price*100/$item->item_price), 0 ),
'url' => JURI::base().'outfit/view/'.$value->content_item_id.'-'.$item->product_name
);
?>
<div class="span4 sm-product-box" >
<div class="j2store-product-single j2store-product-single-113 column-1" itemscope="" itemtype="http://schema.org/Product">
<!-- on Before display product -->
<div class="j2store-before-display-product">
</div>
<!-- Form action starts here -->
<form action="/carrello" method="post" name="j2storeProductForm" id="j2store-product-list" class="j2storeProductForm">
<!-- Before displaying product Images -->
<div class="j2store-before-display-productimages">
</div>
<a itemprop="url" class="j2store-item-title-link" href="<?php echo $product['url'] ?>">
<img class="j2store-item-productlist-thumbimage" itemprop="image" src="<?php echo $product['main_image'] ?>" alt="<?php echo $product['name'] ;?>">
</a>
<!-- Title -->
<h3 class="j2store-item-title" itemprop="name">
<a itemprop="url" class="j2store-item-title-link" href="<?php echo $product['url'] ?>">
<?php echo $product['name']; ?>
</a>
</h3>
<div class="sm-product-hoover" style="position: absolute; top:0; left: 0; bottom: 0; right: 0; width: 100%; height:100%; display: none;">
<!-- Title -->
<h1 class="j2store-item-title" itemprop="name">
<a itemprop="url" class="j2store-item-title-link" href="<?php echo $product['url'] ?>">
<?php echo $product['name']; ?>
</a>
</h1>
<div class="j2store-product-prices">
<span class="j2store-product-item-label">Prezzo</span>
<?php if($product['special_price'] > 0) echo '<strike>';?>
<span itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span itemprop="price" class="text" id="product_price_113"><?php echo $product['price'].' €'; ?></span>
</span>
<?php if($product['special_price'] > 0): echo '</strike>';?>
<span class="product-discount-offer" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<?php echo 'Sconto:'. $product['discount'].' %'; ?>
</span>
<span itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span itemprop="price" id="product_special_price_113" class="product-special-price"><?php echo $product['special_price'].' €'; ?></span>
</span>
<?php endif; ?>
</div>
<a id="addtoCartBtn" href="<?php echo $product['url'] ?>" type="submit" class="j2store-item-cart-button button " value="Aggiungi al carrello">Aggiungi al carrello</a>
</div>
</form>
</div><!-- end item -->
</div>
<?php endforeach; ?>
</div>
</div>
&#13;
感谢所有人......
答案 0 :(得分:0)
您将返回一个数组,其中需要在查询中为字符串
具体来说,那里应该有一个列名,你得到一个PHP数组。因此,PHP将该数组转换为表示&#34; Array&#34;在发送给MySQL之前。