@ArtemVlasovv

Как исправить синтаксическую ошибку в Битрикс?

Добрый день.
Правил текст на сайте, код не трогал, после сохранения вылетает ошибка
Parse error: syntax error, unexpected 'data' (T_STRING), expecting ']' in **/index.php on line 29

Своих знаний не хватает, чтобы исправить, помогите пожалуйста.
Подозреваю, что что-то не так с кавычками, потому что в блоке кода теги HTML подсвечиваются синим:

<a href="<?=$arSection[">" data-bx-app-ex-href="<?=$arSection["SECTION_PAGE_UR"];?>
			" class="section"&gt;
			<div class="section__picture">
				 <?
                            $picture = SITE_TEMPLATE_PATH.'/img/no_photo.png';
                            if ($arSection["PICTURE"] != ""){
                                $picture = CFile::ResizeImageGet($arSection["PICTURE"], Array("height" => 175))["src"];
                            }
                            ?>
				<div style="background-image:url('<span id=" title="Код PHP: &lt;?=$picture;?&gt;" class="bxhtmled-surrogate">
					<span class="bxhtmled-surrogate-inner"><span class="bxhtmled-right-side-item-icon"></span><span class="bxhtmled-comp-lable" unselectable="on" spellcheck="false">Код PHP</span></span>')"&gt;
				</div>
				<div class="section__icon">
 <i class="far fa-sign-in"></i>
				</div>
			</div>
			<div class="section__main">
				 <?=$arSection["NAME"];?>
			</div>
 </a>
		</div>
		 <?
                if ($s > 5)
                    break;
                $s++;?> <?endforeach;?>
	</div>
	 <?if (count($arSections) > 6):?>
	<div class="button-line">
 <a href="/katalog/" class="button button_black wstyle wstyle_white">Посмотреть все категории</a>
	</div>
	 <?endif;?>
</div>
 <?endif;?> <?
$iblock_id = 4;
$arServices = Array();
$arFilterE = Array("IBLOCK_ID" => $iblock_id, "ACTIVE" => "Y");
$arSelectE = Array("IBLOCK_ID", "ID", "NAME", "PREVIEW_PICTURE");
$rsElement = CIBlockElement::GetList(
    Array("SORT"=>"ASC"),
    $arFilterE,
    false,
    false,
    $arSelectE
);
while($arElement = $rsElement->GetNextElement()){
    $arFieldsE = $arElement->GetFields();
    $arServices[] = $arFieldsE;
}
?> <?if (count($arServices) > 0):?>
<div class="block block_border">
	<div class="title title_center">
		Популярные услуги
	</div>
	<div class="row">
		 <?$s = 1;?> <?foreach ($arServices as $arService):?>
		<div class="col-lg-4">
 <a href="<?=$arService[">" data-bx-app-ex-href="<?=$arService["DETAIL_PAGE_URL"];?>
			" class="section section_wtitle"&gt;
			<div class="section__picture">
				 <?
                            $picture = SITE_TEMPLATE_PATH.'/img/no_photo.png';
                            if ($arService["PREVIEW_PICTURE"] != ""){
                                $picture = CFile::ResizeImageGet($arService["PREVIEW_PICTURE"], Array("height" => 200))["src"];
                            }
                            ?>
				<div style="background-image:url('<span id=" title="Код PHP: &lt;?=$picture;?&gt;" class="bxhtmled-surrogate">
					<span class="bxhtmled-surrogate-inner"><span class="bxhtmled-right-side-item-icon"></span><span class="bxhtmled-comp-lable" unselectable="on" spellcheck="false">Код PHP</span></span>')"&gt;
				</div>
				<div class="section__title">
					 <?=$arService["NAME"];?>
				</div>
			</div>
 </a>


Заранее спасибо!
  • Вопрос задан
  • 98 просмотров
Решения вопроса 1
vhood
@vhood
Не забывайте отмечать решения
Можно засунуть код в редактор, который подсвечивает синтаксис, и исправить там.

Ошибок много, какие-то символы )"&gt; после span идут, href не назначен (переменная вызывается, в которой массив, а ключ массива отсутствует и php не закрывается).

Вот, немного поправил именно тот участок, что предоставлен:
<a href="<?=$arSection["SECTION_PAGE_UR"]?>" data-bx-app-ex-href="<?=$arSection["SECTION_PAGE_UR"]?>" class="section">
			<div class="section__picture">
				 <?
                            $picture = SITE_TEMPLATE_PATH.'/img/no_photo.png';
                            if ($arSection["PICTURE"] != ""){
                                $picture = CFile::ResizeImageGet($arSection["PICTURE"], Array("height" => 175))["src"];
                            }
                            ?>
				<div style="background-image:url('<span id=" title="Код PHP: &lt;?=$picture;?&gt;" class="bxhtmled-surrogate">
					<span class="bxhtmled-surrogate-inner"><span class="bxhtmled-right-side-item-icon"></span><span class="bxhtmled-comp-lable" unselectable="on" spellcheck="false">Код PHP</span></span>
				</div>
				<div class="section__icon">
 <i class="far fa-sign-in"></i>
				</div>
			</div>
			<div class="section__main">
				 <?=$arSection["NAME"];?>
			</div>
 </a>
		</div>
		 <?
                if ($s > 5)
                    break;
                $s++;?> <?endforeach;?>
	</div>
	 <?if (count($arSections) > 6):?>
	<div class="button-line">
 <a href="/katalog/" class="button button_black wstyle wstyle_white">Посмотреть все категории</a>
	</div>
	 <?endif;?>
</div>
 <?endif;?> <?
$iblock_id = 4;
$arServices = Array();
$arFilterE = Array("IBLOCK_ID" => $iblock_id, "ACTIVE" => "Y");
$arSelectE = Array("IBLOCK_ID", "ID", "NAME", "PREVIEW_PICTURE");
$rsElement = CIBlockElement::GetList(
    Array("SORT"=>"ASC"),
    $arFilterE,
    false,
    false,
    $arSelectE
);
while($arElement = $rsElement->GetNextElement()){
    $arFieldsE = $arElement->GetFields();
    $arServices[] = $arFieldsE;
}
?> <?if (count($arServices) > 0):?>
<div class="block block_border">
	<div class="title title_center">
		Популярные услуги
	</div>
	<div class="row">
		 <?$s = 1;?> <?foreach ($arServices as $arService):?>
		<div class="col-lg-4">
 <a href="<?=$arService["DETAIL_PAGE_URL"]?>" data-bx-app-ex-href="<?=$arService["DETAIL_PAGE_URL"];?>" class="section section_wtitle">
			<div class="section__picture">
				 <?
                            $picture = SITE_TEMPLATE_PATH.'/img/no_photo.png';
                            if ($arService["PREVIEW_PICTURE"] != ""){
                                $picture = CFile::ResizeImageGet($arService["PREVIEW_PICTURE"], Array("height" => 200))["src"];
                            }
                            ?>
				<div style="background-image:url('<span id=" title="Код PHP: &lt;?=$picture;?&gt;" class="bxhtmled-surrogate">
					<span class="bxhtmled-surrogate-inner"><span class="bxhtmled-right-side-item-icon"></span><span class="bxhtmled-comp-lable" unselectable="on" spellcheck="false">Код PHP</span></span>
				</div>
				<div class="section__title">
					 <?=$arService["NAME"];?>
				</div>
			</div>
 </a>
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы