Joomlaのテンプレートがインストールされていて、いくつかのエラーがホームページに表示されている場合、エラーはSp Page Builderコンポーネントに関連しています。SP Page Builder PHPのエラー(未定義の変数、未定義のプロパティ)
これらのエラーを修正するにはどうすればよいですか?
はここerrosと文書だ - https://drive.google.com/open?id=0B1toGflgmV7fZi1SQ051QWZxZFE
そしてsite.php
<?php
/**
* Flex 1.0 @package SP Page Builder
* Template Name - Flex
* @author Aplikko http://www.aplikko.com
* @copyright Copyright (c) 2015 Aplikko
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
*/
// no direct access
defined('_JEXEC') or die;
JLoader::register('JHtmlString', JPATH_LIBRARIES.'/joomla/html/html/string.php');
AddonParser::addAddon('sp_latest_posts','sp_latest_posts_addon');
function get_categories($parent=1) {
\t $db = JFactory::getDbo();
\t $query = $db->getQuery(true);
\t $query
\t ->select('*')
\t ->from($db->quoteName('#__categories'))
\t ->where($db->quoteName('extension') . ' = ' . $db->quote('com_content'))
\t ->where($db->quoteName('published') . ' = ' . $db->quote(1))
\t ->where($db->quoteName('parent_id') . ' = ' . $db->quote($parent))
\t ->order($db->quoteName('created_time') . ' DESC');
\t $db->setQuery($query);
\t $cats = $db->loadObjectList();
\t $categories = array($parent);
\t foreach ($cats as $key => $cat) {
\t \t $categories[] = $cat->id;
\t }
\t return $categories;
}
function sp_latest_posts_addon($atts){
\t extract(spAddonAtts(array(
\t \t "title" \t \t \t \t => '',
\t \t "heading_selector" \t \t => 'h3',
\t \t "title_fontsize" \t \t => '',
\t \t "title_text_color" \t \t => '',
\t \t "title_margin_top" \t \t => '',
\t \t "title_margin_bottom" \t => '',
\t \t "show_image" \t \t \t => '',
\t \t "show_date" \t \t \t => '',
\t \t "show_category" \t \t \t => '',
\t \t "show_intro_text" \t \t => '',
\t \t "show_author" \t \t => '',
\t \t "item_limit" \t \t \t => '',
\t \t "intro_text_limit" \t \t => '100',
\t \t "column_no" \t \t \t \t => '3',
\t \t "image_alignment" \t \t => '',
\t \t "category" \t \t \t \t => '',
\t \t "style" \t \t \t \t => '',
\t \t "class" \t \t \t \t \t => '',
\t \t), $atts));
\t \t $app = JFactory::getApplication();
\t $doc = JFactory::getDocument();
\t // Database Query
\t require_once JPATH_SITE . '/components/com_content/helpers/route.php';
\t // Access filter
\t $access = !JComponentHelper::getParams('com_content')->get('show_noauth');
\t $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
\t
\t $db = JFactory::getDbo();
\t $query = $db->getQuery(true);
\t $query
\t ->select('a.*')
\t ->from($db->quoteName('#__content', 'a'))
\t ->select($db->quoteName('b.alias', 'category_alias'))
\t ->select($db->quoteName('b.title', 'category'))
\t ->join('LEFT', $db->quoteName('#__categories', 'b') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('b.id') . ')')
\t ->where($db->quoteName('b.extension') . ' = ' . $db->quote('com_content'))
\t ->where($db->quoteName('a.state') . ' = ' . $db->quote(1))
\t ->where($db->quoteName('a.catid')." IN (" . implode(',', get_categories($category)) . ")")
\t ->where($db->quoteName('a.access')." IN (" . implode(',', $authorised) . ")") \t
\t ->order($db->quoteName('a.created') . ' DESC')
\t ->setLimit($item_limit);
\t $db->setQuery($query);
\t $items = $db->loadObjectList();
\t
\t // End Database Query
\t $style == 'flex' ? $flex_style = ' flex' : '';
\t $style == 'blog' ? $blog_style = ' blog' : '';
\t $blog_style = $output = '<div class="sppb-addon sppb-addon-latest-posts'.$flex_style.$blog_style.' sppb-row ' . $class . '">';
\t if ($title) {
\t \t $output .= '<div class="sppb-section-title">';
\t \t \t $output .= '<'.$heading_selector.' class="sppb-addon-title" style="' . $title_style . '"> ' . $title . '</' . $heading_selector . '>';
\t \t $output .= '</div>'; // END :: title
\t }
\t $output .= '<div class="sppb-addon-content">';
\t $output .= '<div class="latest-posts clearfix">';
\t foreach(array_chunk($items, $column_no) as $items) {
\t \t $output .= '<div>';
\t \t foreach ($items as $item) {
\t \t \t $item->slug = $item->id . ':' . $item->alias;
\t \t \t $item->catslug = $item->catid . ':' . $item->category_alias;
\t \t \t $item->user = JFactory::getUser($item->created_by)->name;
\t \t \t if ($access || in_array($item->access, $authorised)) {
\t \t \t \t // We know that user has the privilege to view the article
\t \t \t \t $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language));
\t \t \t \t $item->catlink = JRoute::_(ContentHelperRoute::getCategoryRoute($item->catslug, $item->catid, $item->language));
\t \t \t } else {
\t \t \t \t $item->link = JRoute::_('index.php?option=com_users&view=login');
\t \t \t \t $item->catlink = JRoute::_('index.php?option=com_users&view=login');
\t \t \t }
\t \t \t
\t \t \t $tplParams \t \t = JFactory::getApplication()->getTemplate(true)->params;
\t \t \t $params \t \t = $item->params;
\t \t \t $attribs \t \t = json_decode($item->attribs);
\t \t \t $images \t \t \t = json_decode($item->images);
\t \t \t $imgsize \t \t = $tplParams->get('blog_list_image', 'default');
\t \t \t $intro_image \t = '';
\t \t \t if(isset($attribs->spfeatured_image) && $attribs->spfeatured_image != '') {
\t \t \t
\t \t \t \t if($imgsize == 'default') {
\t \t \t \t \t $intro_image = $attribs->spfeatured_image;
\t \t \t \t } else {
\t \t \t \t \t $intro_image = $attribs->spfeatured_image;
\t \t \t \t \t $basename = basename($intro_image);
\t \t \t \t \t $list_image = JPATH_ROOT . '/' . dirname($intro_image) . '/' . JFile::stripExt($basename) . '_'. $imgsize .'.' . JFile::getExt($basename);
\t \t \t \t \t if(file_exists($list_image)) {
\t \t \t \t \t \t $intro_image = JURI::root(true) . '/' . dirname($intro_image) . '/' . JFile::stripExt($basename) . '_'. $imgsize .'.' . JFile::getExt($basename);
\t \t \t \t \t }
\t \t \t \t }
\t \t \t } elseif(isset($images->image_intro) && !empty($images->image_intro)) {
\t \t \t \t $intro_image = $images->image_intro;
\t \t \t }
\t \t
\t
\t \t if($column_no == '1') {
\t \t \t if ($show_image) {
\t \t \t $image_alignment == 'left' ? $img_column = 'sppb-col-sm-4 column-1 pull-left match-height' : $img_column = 'sppb-col-sm-4 column-1 pull-right match-height';
\t \t \t }
\t \t \t if ($show_image) {
\t \t \t \t $image_alignment == 'right' ? $content_column = 'sppb-col-sm-8 column-1 pull-left match-height' : $content_column = 'sppb-col-sm-8 column-1 pull-right match-height';
\t \t \t } else { \t \t
\t \t \t \t $image_alignment == 'right' ? $content_column = 'sppb-col-sm-12 column-1' : $content_column = 'sppb-col-sm-12 column-1';
\t \t \t }
\t \t \t $h2style = ' style="font-size:180%;line-height:1.4;"';
\t \t \t $img_wrapper_margin = ' style="margin:0;"';
\t \t \t
\t \t \t if ($image_alignment == 'left') {
\t \t \t \t $inner_padding = ' style="padding:0 0 0 30px;"';
\t \t \t } else {
\t \t \t \t $inner_padding = ' style="padding:0 30px 0 0;"';
\t \t \t }
\t \t }
\t \t
\t \t // match-height
\t \t $column_no > '1' ? $match_height = ' match-height' : '';
\t \t
\t \t // Flex Style
\t \t if($style == 'flex') {
\t \t \t $output .= '<div class="latest-post sppb-col-sm-' . round(12/$column_no) . ' columns-'.$column_no.'">';
\t \t \t $output .= '<div class="latest-post-item">';
\t \t
\t \t \t if($column_no == '1') {
\t \t \t \t $output .= '<div class="row-fluid">';
\t \t \t }
\t \t \t
\t \t \t if(!empty($intro_image) || (isset($images->image_intro) && !empty($images->image_intro))) {
\t \t \t \t if ($show_image) {
\t \t \t \t \t
\t \t \t \t \t if($column_no == '1') {
\t \t \t \t \t \t $output .= '<div style="padding:0" class="'.$img_column.'">';
\t \t \t \t \t }
\t \t \t \t \t $output .= '<div class="img-wrapper">';
\t \t \t \t \t $output .= '<a href="' . $item->link . '"><img class="post-img" src="' . $intro_image . '" alt="' . $item->title . '" /><div class="caption-content">' . $item->title . '<em class="caption-category"><span class="posted-in">'. JText::_('COM_SPPAGEBUILDER_ADDON_POSTED_IN') .'</span>'. $item->category . '</em></div></a>';
\t \t \t \t \t $output .= '</div>';
\t \t \t \t \t
\t \t \t \t \t if($column_no == '1') {
\t \t \t \t \t \t $output .= '</div>';
\t \t \t \t \t }
\t \t \t \t }
\t \t \t }
\t \t \t \t if($column_no == '1') {
\t \t \t \t \t $output .= '<div'.$inner_padding.' class="'.$content_column.'">';
\t \t \t \t }
\t \t \t \t $output .= '<div class="latest-post-inner match-height">';
\t \t \t \t
\t \t \t \t if (($show_date || $show_intro_text || $show_author) != 1) {
\t \t \t \t $output .= '<h2 style="margin:0" class="entry-title"><a href="' . $item->link . '">' . $item->title . '</a></h2>';
\t \t \t \t } else {
\t \t \t \t $output .= '<h2'.$h2style.' class="entry-title"><a href="' . $item->link . '">' . $item->title . '</a></h2>';
\t \t \t \t }
\t \t \t \t if ($show_date) {
\t \t \t \t \t $output .= '<div class="entry-meta"><span class="entry-date">' . JHtml::_('date', $item->created, 'DATE_FORMAT_LC1') . '</span></div>';
\t \t \t \t }
\t \t \t \t if ($show_intro_text) {
\t \t \t \t \t $output .= '<p class="intro-text" >' . JHtml::_('string.truncate', strip_tags($item->introtext), $intro_text_limit) . '</p>';
\t \t \t \t }
\t \t \t \t
\t \t \t \t $show_author || $show_category ? $output .= '<hr />' : '';
\t \t \t \t if ($show_author) { \t
\t \t \t \t \t $output .= '<span class="post-author"><span class="entry-author">' . JText::_('COM_SPPAGEBUILDER_ADDON_POSTED_BY'). '</span> ' . $item->user . '</span>';
\t \t \t \t }
\t \t \t \t if ($show_category) { \t
\t \t \t \t $show_author ? $posted_in_category = ' cat-inline' : '';
\t \t \t \t \t $output .= '<span class="category'.$posted_in_category.'"><span class="posted-in">'. JText::_('COM_SPPAGEBUILDER_ADDON_CATEGORY') .'</span><a href="' . $item->catlink . '">'. $item->category . '</a></span>';
\t \t \t \t }
\t \t \t \t
\t \t \t \t if($column_no == '1') {
\t \t \t \t \t $output .= '</div>';
\t \t \t \t \t $output .= '</div>';
\t \t \t \t }
\t \t \t \t
\t \t \t $output .= '</div>';
\t \t \t if($column_no == '1') {
\t \t \t \t $output .= '<div class="post-divider"></div>';
\t \t \t }
\t \t \t $output .= '</div>';
\t \t
\t \t // Default & Blog styles \t
\t \t } else {
\t \t \t \t
\t \t \t $output .= '<div class="latest-post sppb-col-sm-' . round(12/$column_no) . ' columns-'.$column_no.'">';
\t \t \t $output .= '<div class="latest-post-inner' . $match_height . '">';
\t \t \t \t
\t \t \t if($column_no == '1') {
\t \t \t \t $output .= '<div class="row-fluid">';
\t \t \t }
\t \t \t \t if ($show_image) {
\t \t \t \t \t if($column_no == '1') {
\t \t \t \t \t \t $output .= '<div class="'.$img_column.'">';
\t \t \t \t \t }
\t \t \t \t \t $output .= '<div'.$img_wrapper_margin.' class="img-wrapper">';
\t \t \t \t \t $output .= '<a href="' . $item->link . '"><img class="post-img" src="' . $intro_image . '" alt="' . $item->title . '" /></a>';
\t \t \t \t \t $output .= '</div>';
\t \t \t \t \t
\t \t \t \t \t if($column_no == '1') {
\t \t \t \t \t \t $output .= '</div>';
\t \t \t \t \t }
\t \t \t \t }
\t \t \t \t
\t \t \t if($column_no == '1') {
\t \t \t \t $output .= '<div class="'.$content_column.'">';
\t \t \t }
\t \t \t \t if ($show_date) {
\t \t \t \t \t $output .= '<div class="entry-meta"><span class="entry-date"> ' . JHtml::_('date', $item->created, 'DATE_FORMAT_LC1') . '</span></div>';
\t \t \t \t }
\t \t \t \t $output .= '<h2'.$h2style.' class="entry-title"><a href="' . $item->link . '">' . $item->title . '</a></h2>';
\t \t \t \t if ($show_intro_text) {
\t \t \t \t \t $output .= '<p class="intro-text" >' . JHtml::_('string.truncate', strip_tags($item->introtext), $intro_text_limit) . '</p>';
\t \t \t \t }
\t \t \t \t $show_author || $show_category ? $output .= '<hr />' : '';
\t \t \t \t if ($show_author) { \t
\t \t \t \t \t $output .= '<span class="post-author"><span class="entry-author">' . JText::_('COM_SPPAGEBUILDER_ADDON_POSTED_BY'). ' ' . $item->user . '</span></span>';
\t \t \t \t }
\t \t \t \t if ($show_category) { \t
\t \t \t \t $show_author ? $posted_in_category = ' cat-inline' : '';
\t \t \t \t \t $output .= '<span class="category'.$posted_in_category.'"><span class="posted-in">'. JText::_('COM_SPPAGEBUILDER_ADDON_CATEGORY') .'</span><a href="' . $item->catlink . '">'. $item->category . '</a></span>';
\t \t \t \t }
\t \t \t \t if($column_no == '1') {
\t \t \t \t \t $output .= '</div>';
\t \t \t \t \t $output .= '</div>';
\t \t \t \t }
\t \t \t \t $output .= '</div>'; \t
\t \t \t }
\t
\t \t \t $output .= '</div>';
\t \t }
\t \t $output .= '</div>';
\t }
\t $output .= '</div>';
\t $output .= '</div>';
\t $output .= '</div>';
\t
\t
\t $column_no == '1' ? $column_no_1 = '.column-1 {margin:10px auto;padding:0!important;}' : '';
\t
\t // Add styles @media rulepost-img
\t if($style == 'flex') {
\t \t $custom_style = ''
\t \t \t \t . '@media screen and (max-width: 768px) {'
\t \t \t \t . $column_no_1
\t \t \t \t . '.img-wrapper a {font-size:150%;line-height:1.5;}'
\t \t \t \t . '}';
\t \t $doc->addStyleDeclaration($custom_style);
\t }
\t
\t if ($column_no>='3') {
\t $custom_style_3 = ''
\t \t \t . '@media screen and (min-width: 992px) and (max-width: 1199px){'
\t \t \t . '.columns-'.$column_no.'{width:33.3333%;}'
\t \t \t . '}'
\t \t \t . '@media screen and (min-width: 768px) and (max-width: 991px){'
\t \t \t . '.columns-'.$column_no.'{width:50%}'
\t \t \t . '}';
\t $doc->addStyleDeclaration($custom_style_3);
\t }
\t if($column_no=='5') {
\t $custom_style_5 = ''
\t \t \t . '.columns-'.$column_no.' {width:20%}'
\t \t \t . '@media screen and (min-width: 992px) and (max-width: 1199px){'
\t \t \t . '.columns-'.$column_no.'{width:33.3333%;}'
\t \t \t . '}'
\t \t \t . '@media screen and (min-width: 768px) and (max-width: 991px){'
\t \t \t . '.columns-'.$column_no.'{width:50%}'
\t \t \t . '}'
\t \t \t . '@media screen and (max-width: 767px){'
\t \t \t . '.columns-'.$column_no.'{width:100%}'
\t \t \t . '}';
\t $doc->addStyleDeclaration($custom_style_5);
\t
\t }
\t return $output;
\t
}
ありがとう!
標準コード – RiggsFolly
が完全なエラーを共有し、関連コードのみを公開している開発者に苦情を申し立てます – C2486
[PHP: "通知:未定義変数"と "通知:未定義インデックス"](http: /stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index) –