<?php
$template = <<<END
<style>
/*固定画像で使う場合*/
.home header .no-slide {
	background: url(user_data/{val item/bg_image_file}) no-repeat center center/cover;	/*背景画像の読み込み*/
}
</style>
<!--hairsalon1_slide:スライドショー-->
<aside class="hairsalon1_slide">
<div class="no-slide">no-slide</div>
<div class="dot">dot</div>
</aside>
<div id="thumb-photo">
<!--{each item/list}-->
<img src="user_data/{val item/list/image}" alt="">
<!--{/each}-->
</div>
END;

$hairsalon1_slide = array(						// ブロック
		"title" => "hairsalon1 スライドショー",	// ブロックの名称
		"name" => "hairsalon1_slide",			// 名称、重複すると正しく動作しません
		"template" => $template,		// ブロックのテンプレート
		"input" => array(				// ブロックの入力定義
		"help" => array(
			"title" => "使い方",
			"type" => "comment",
			"link" => DOCUMENT1 . "/?act=hairsalon1_slide",
			"class" => "notice",
		),
			"notice1" => array(
				"title" => "このブロックはトップページにしか使えません",
				"type" => "comment",
				"class"=> "notice",
			),
			"bg_image" => array(
				"title" => "背景画像",
				"type" => "image",
			),
			"image1" => array(
				"title" => "画像1",
				"type" => "image",
			),
			"image2" => array(
				"title" => "画像2",
				"type" => "image",
			),
			"image3" => array(
				"title" => "画像3",
				"type" => "image",
			),
			"image4" => array(
				"title" => "画像4",
				"type" => "image",
			),
			"image5" => array(
				"title" => "画像5",
				"type" => "image",
			),
			"image6" => array(
				"title" => "画像6",
				"type" => "image",
			),
			"image7" => array(
				"title" => "画像7",
				"type" => "image",
			),
			"image8" => array(
				"title" => "画像8",
				"type" => "image",
			),
		),
		"repeat" => array("image"),
		"func" => "func_hairsalon1_slide",		// 処理プログラム（指定がない物は標準処理）
		"output" => "slide",		// 出力位置
	);

block_add($hairsalon1_slide);

// スライドの設定
function func_hairsalon1_slide($def, $info)
{
	$slide = array();
	for ($i = 1; $i <= 10; $i++) {
		if ($info["image" . $i]) {
			unset($item);
			$item["image"] = $info["image" . $i . "_file"];
			$slide[] = $item;
		}
	}
	$info["slide"] = $slide;
	return $info;
}
