: 17.11.2013 15:27:47 | : 13.11.2016 14:25:09 | : 6697

«», , , . , , - . . . , , . . , , , .

, , . , , . / (bitrix:iblock.element.add.form). . . , , (bitrix:news.list). . .

, . . .

1.jpg

, : : guest_book, , .

2.jpg

. - .

3.jpg

. , . - , , TOWN. - E-mail ( ), , MAIL. - , , TEXT. ..., . ( ) 10 100. . - , HTML/, ANSWER.

4.jpg

. , , .

5.jpg

. : : , : , : , : , : .

6.jpg

. .

. , / (bitrix:iblock.element.add.form). , : , : . : , CAPTCHA, : !.

7.jpg

7-1.jpg

, , , : , E-mail, , * *. , : * * . , , / ( ). : .

8.jpg

- . * * .

9.jpg

. . . . , . : guest_form, - main (). . .

, , , . FTP- (_/bitrix/templates/main/components/bitrix/iblock.element.add.form/guest_form/). template.php. :

<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
?>

<?if (count($arResult["ERRORS"])):?>
	<?=ShowError(implode("<br />", $arResult["ERRORS"]))?>
<?endif?>
<?if (strlen($arResult["MESSAGE"]) > 0):?>
	<?=ShowNote($arResult["MESSAGE"])?>
<?endif?>
<form name="iblock_add" action="<?=POST_FORM_ACTION_URI?>" method="post" enctype="multipart/form-data">
	<?=bitrix_sessid_post()?>
	<div class="form_settings">
	<?if (is_array($arResult["PROPERTY_LIST"]) && !empty($arResult["PROPERTY_LIST"])):?>
		<?foreach ($arResult["PROPERTY_LIST"] as $propertyID):?>
		<?
		if (intval($propertyID) > 0)
		{
			if (
				(
					$arResult["PROPERTY_LIST_FULL"][$propertyID]["PROPERTY_TYPE"] == "S"
				)
				&&
				$arResult["PROPERTY_LIST_FULL"][$propertyID]["ROW_COUNT"] > "1"
			)
				$arResult["PROPERTY_LIST_FULL"][$propertyID]["PROPERTY_TYPE"] = "T";
		}
		?>
		<?$inputNum = 1;?>
		<p><span><?if (intval($propertyID) > 0):?><?=$arResult["PROPERTY_LIST_FULL"][$propertyID]["NAME"]?><?else:?><?=!empty($arParams["CUSTOM_TITLE_".$propertyID]) ? $arParams["CUSTOM_TITLE_".$propertyID] : GetMessage("IBLOCK_FIELD_".$propertyID)?><?endif?><?if(in_array($propertyID, $arResult["PROPERTY_REQUIRED"])):?>*<?endif?>:</span>
		<?
		$INPUT_TYPE = $arResult["PROPERTY_LIST_FULL"][$propertyID]["PROPERTY_TYPE"];
		?>
		<?switch ($INPUT_TYPE):?><?
			case "S":
				for ($i = 0; $i<$inputNum; $i++)
				{
					if ($arParams["ID"] > 0 || count($arResult["ERRORS"]) > 0)
					{
						$value = intval($propertyID) > 0 ? $arResult["ELEMENT_PROPERTIES"][$propertyID][$i]["VALUE"] : $arResult["ELEMENT"][$propertyID];
					}
					elseif ($i == 0)
					{
						$value = intval($propertyID) <= 0 ? "" : $arResult["PROPERTY_LIST_FULL"][$propertyID]["DEFAULT_VALUE"];

					}
					else
					{
						$value = "";
					}
				?>
				<input type="text" name="PROPERTY[<?=$propertyID?>][<?=$i?>]" size="25" value="<?=$value?>" /><?
				}
			break;
			case "T":
			for ($i = 0; $i<$inputNum; $i++)
			{

				if ($arParams["ID"] > 0 || count($arResult["ERRORS"]) > 0)
				{
					$value = intval($propertyID) > 0 ? $arResult["ELEMENT_PROPERTIES"][$propertyID][$i]["VALUE"] : $arResult["ELEMENT"][$propertyID];
				}
				elseif ($i == 0)
				{
					$value = intval($propertyID) > 0 ? "" : $arResult["PROPERTY_LIST_FULL"][$propertyID]["DEFAULT_VALUE"];
				}
				else
				{
					$value = "";
				}
				?>
			<textarea cols="<?=$arResult["PROPERTY_LIST_FULL"][$propertyID]["COL_COUNT"]?>" rows="<?=$arResult["PROPERTY_LIST_FULL"][$propertyID]["ROW_COUNT"]?>" name="PROPERTY[<?=$propertyID?>][<?=$i?>]"><?=$value?></textarea>
				<?
			}
			break;
			?>
		<?endswitch;?>
		</p>
		<?endforeach;?>
		<?if($arParams["USE_CAPTCHA"] == "Y" && $arParams["ID"] <= 0):?>
			<!--   -->
			<p><span>   *:</span>
			<input type="hidden" name="captcha_sid" value="<?=$arResult["CAPTCHA_CODE"]?>" />
			<img src="/bitrix/tools/captcha.php?captcha_sid=<?=$arResult["CAPTCHA_CODE"]?>" width="180" height="40" alt="CAPTCHA" /></p>
			<p><span>&nbsp;</span><input type="text" name="captcha_word" maxlength="50" value=""></p>
		<?endif?>	
	<?endif?>
	<p style="padding-top: 15px"><span>&nbsp;</span><input style="font-size:16px;" class="submit" type="submit" name="iblock_submit" value="" /></p>
	</div>

</form>

. , html- CSS3_photo_two.

. , (bitrix:news.list). , . . - , : . : , : (), : , E-mail ( ), .

10.jpg

11.jpg

- . . . . . , . . , . , , .

, , , . . guest_notes. template.php. :

<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>

<?if($arParams["DISPLAY_TOP_PAGER"]):?>
	<?=$arResult["NAV_STRING"]?><br />
<?endif;?>
<br />
<?foreach($arResult["ITEMS"] as $arItem):?>
	<?
		$this->AddEditAction($arItem['ID'], $arItem['EDIT_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_EDIT"));
		$this->AddDeleteAction($arItem['ID'], $arItem['DELETE_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_DELETE"), array("CONFIRM" => GetMessage('CT_BNL_ELEMENT_DELETE_CONFIRM')));
	?>
	<div style="padding-bottom: 10px;" id="<?=$this->GetEditAreaId($arItem['ID']);?>">
	<div>
		<h4>
		<?
		if($arItem["CREATED_USER_NAME"])
			{
			echo "<span style='color: green;'>".preg_replace("/^\([^\)]+\)\s(.*)/i", "$1", $arItem["CREATED_USER_NAME"])." ()</span>";
			}
		else
			{
			echo $arItem["NAME"];
			}
		?>
		</h4><h5>
		<?if($arItem["DATE_CREATE"]):?>
		<?=" : ".$arItem["DATE_CREATE"]?>
		<?endif;?>
		<br />
		<?if($arItem["PROPERTIES"]["TOWN"]["VALUE"]):?>
		<?=": ".$arItem["PROPERTIES"]["TOWN"]["VALUE"]?>
		<?endif;?>
		</h5>
	</div>
	<div>
		<?
		if($arItem["PROPERTIES"]["TEXT"]["VALUE"])
		{
			if ($arItem["CREATED_USER_NAME"]) echo $arItem["PROPERTIES"]["TEXT"]["~VALUE"];
			else echo $arItem["PROPERTIES"]["TEXT"]["VALUE"];
		}
		?>
		<br />
		<?if($arItem["PROPERTIES"]["ANSWER"]["~VALUE"]["TEXT"]):?>
		<?="<br /><h4><span style='color: green;'> : </h4></span>".$arItem["PROPERTIES"]["ANSWER"]["~VALUE"]["TEXT"].""?>
		<?endif;?>
		<div style="clear:both"></div>
	</div>
	<br />
	<hr noshade color="lightgrey" size="1" />
	</div>
<?endforeach;?>
<?if($arParams["DISPLAY_BOTTOM_PAGER"]):?>
	<br /><?=$arResult["NAV_STRING"]?>
<?endif;?>

, . - .

, . . , - , , . , . .