есть файлы file1.php и file2.php. как при загрузке первого файла передать ajax-ом значение переменной второму файлу и в теле первого файла разместить результат исполнения второго файла?
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<script>
function collapsElement(id) {
if ( document.getElementById(id).style.display != "none" ) {
document.getElementById(id).style.display = 'none';
} else {
document.getElementById(id).style.display = '';
}
}
function changeArrows(id) {
if ( document.getElementById(id).className != "arrow_down" ) {
document.getElementById(id).className = 'arrow_down';
} else {
document.getElementById(id).className = 'arrow_up';
}
}
</script>
<style type="text/css">
.arrow_up{
background-position: right;
background-image: url('/bitrix/templates/darshan/img/arrow-up.png');
background-repeat: no-repeat;
background-size: 16px;
}
.arrow_down{
background-position: right;
background-image: url('/bitrix/templates/darshan/img/arrow-down.png');
background-repeat: no-repeat;
background-size: 16px;
}
</style>
<?$divIdCount = 1;?>
<div class="news-list">
<?foreach($arResult["ITEMS"] as $arItem){?>
<article class="row post type-post status-publish format-standard entry category-article">
<div class="large-9 medium-8 small-9 columns">
<div id="element<?=$divIdCount?>" style="display: none; margin-left: 25px;">
<section class="entry">
<p><?=$arItem["PREVIEW_TEXT"];?></p>
<?
$props = array();
$obj = CIBlockElement::GetList(
array("SORT" => "ASC"),
array("IBLOCK_ID" => $arResult["ID"], "SECTION_ID" => $arParams["PARENT_SECTION"], "ID" => $arItem["ID"]),
array("ID", "IBLOCK_ID", "NAME", "PROPERTY_FILE_PATH")
);
while ($value = $obj->GetNext()) {
$props[] = $value;
}
if (strlen($props[0]["PROPERTY_FILE_PATH_VALUE"]) > 0) {
$APPLICATION->IncludeComponent("bitrix:player","",Array(
"PLAYER_TYPE" => "auto",
"USE_PLAYLIST" => "Y",
"PATH" => $props[0]["PROPERTY_FILE_PATH_VALUE"],
"PLAYLIST_DIALOG" => "",
"PROVIDER" => "video",
"STREAMER" => "",
"WIDTH" => "640",
"HEIGHT" => "360",
"PREVIEW" => "",
"SKIN_PATH" => "/bitrix/components/bitrix/player/mediaplayer/skins",
"SKIN" => "bitrix.swf",
"CONTROLBAR" => "bottom",
"WMODE" => "transparent",
"LOGO" => "/logo.png",
"LOGO_LINK" => "http://ваш_сайт.com/",
"LOGO_POSITION" => "bottom-left",
"ADDITIONAL_FLASHVARS" => "",
"WMODE_WMV" => "window",
"SHOW_CONTROLS" => "Y",
"AUTOSTART" => "N",
"REPEAT" => "list",
"VOLUME" => "90",
"MUTE" => "N",
)
);
}
?>
</section><!-- /.entry -->
</div>
<header>
<h2 class="title entry-title">
<div id="arrows<?=$divIdCount?>" class="arrow_down" onClick="changeArrows('arrows<?=$divIdCount?>')">
<a href="javascript:collapsElement('element<?=$divIdCount?>')" rel="nofollow"> <b><?=$arItem["NAME"]?></b> </a>
</div>
</h2>
</header>
<?if ($arItem['IBLOCK_SECTION_ID'] != 14):?>
<div class="post-meta">
<abbr class="date time published updated" title="<?echo $arItem["DISPLAY_ACTIVE_FROM"]?>"><?echo $arItem["DISPLAY_ACTIVE_FROM"]?></abbr>
</div>
<?endif;?>
</div>
<div class="large-3 medium-4 small-3 columns">
<?if($arParams["DISPLAY_PICTURE"]!="N" && is_array($arItem["PREVIEW_PICTURE"])):?>
<a href="<?=$arItem["DETAIL_PAGE_URL"]?>">
<img class="thumbnail" src="<?=$arItem["PREVIEW_PICTURE"]["SRC"]?>" alt="<?=$arItem["PREVIEW_PICTURE"]["ALT"]?>" />
</a>
<?endif?>
</div>
</article>
<?$divIdCount++?>
<?}?>
<?if($arParams["DISPLAY_BOTTOM_PAGER"]):?>
<br /><?=$arResult["NAV_STRING"]?>
<?endif;?>
</div>
это код всей страницы. в отдельный файл нужно вынести вот этот участок
<?
$APPLICATION->IncludeComponent("bitrix:player","",Array(
"PLAYER_TYPE" => "auto",
"USE_PLAYLIST" => "Y",
"PATH" => $props[0]["PROPERTY_FILE_PATH_VALUE"],
"PLAYLIST_DIALOG" => "",
"PROVIDER" => "video",
"STREAMER" => "",
"WIDTH" => "640",
"HEIGHT" => "360",
"PREVIEW" => "",
"SKIN_PATH" => "/bitrix/components/bitrix/player/mediaplayer/skins",
"SKIN" => "bitrix.swf",
"CONTROLBAR" => "bottom",
"WMODE" => "transparent",
"LOGO" => "/logo.png",
"LOGO_LINK" => "http://ваш_сайт.com/",
"LOGO_POSITION" => "bottom-left",
"ADDITIONAL_FLASHVARS" => "",
"WMODE_WMV" => "window",
"SHOW_CONTROLS" => "Y",
"AUTOSTART" => "N",
"REPEAT" => "list",
"VOLUME" => "90",
"MUTE" => "N",
)
);
}
?>
и в элемент массива с ключом "PATH" нужно передать значение из $props[0]["PROPERTY_FILE_PATH_VALUE"]
require_once
илиerquire
? :)