製造2(詳細画面)

Pocket

詳細画面を製造します。

詳細画面は一覧画面からのリクエストを受けて表示される画面です。
一覧画面からはASINがパラメータとして渡されます。
同パラメータを使ってItemSearchを行います。

detail.php

<!-- 詳細画面 -->




 setLocale( LOCAL );

	// 取得オプション設定
	$options = array();
	// 返却情報設定
	$options['ResponseGroup'] = RESPONSE_GROUP;

	// 結果の格納
	$xml= $amazon -&gt; ItemLookup( $asin, $options );
	if( PEAR::isError( $xml ) )
	{
		// エラーメッセージ
		echo "Amazonの個別商品ページでお使いください。";
	}
	else
	{
		// 商品詳細情報作成
		$data = $xml['Item'][0];

		$html = "";
		$html .= create_item_detail_info( $data, false );

		$url = $data['DetailPageURL'];
		$img = $data['MediumImage']['URL'];
		$url_img_kari = substr( $img, 0, strrpos( $img, "/" ) + 1 );

		// イメージIDの取得
		$img_id = strrchr( $img, "/");
		$cut_s = strpos( $img_id, "/" ) + 1;
		$cut_e = strpos( $img_id, "." ) - 1;
		$img_id =substr( $img_id, $cut_s, $cut_e );

		$url_img = $url_img_kari. $img_id. "._SS". $max_px ."_.jpg";

		$tag = "";

		// 画像用のタグ
		$tag .= '<a href="'. $url .'" rel="nofollow">';
		$tag .= '<img src="'. $url_img .'" style="border: none" alt="'. $data&#91;'ItemAttributes'&#93;&#91;'Title'&#93; .'" />';
		$tag .= '</a>';
		$tag .= '<br />';

		// テキスト用のタグ
		$tag .= '<a href="'. $url .'" rel="nofollow">';
		$tag .= $data['ItemAttributes']['Title'];
		$tag .= '</a>';
	}

?&gt;
<!-- 本体 -->

	<h2>商品詳細</h2>
	
	<br />
	<h2>作成イメージ</h2>
	
	<br />
	<h2>貼りつけ用コード</h2>
	<textarea rows="20" cols="40" name="text1" /></textarea>
	<br />

	<!-- form start -->
	<form name="form" method="post" action="detail.php">
		<!-- hidden -->
		&lt;input type=&quot;hidden&quot; name=&quot;asin&quot; value=&quot;" /&gt;

		<!-- 入力項目 -->
		<span>アソシエイトID</span><br />
		&lt;input type=&quot;text&quot; name=&quot;aso_id&quot; size=&quot;10&quot; value=&quot;" /&gt;
		<span>画像サイズ</span><br />
		&lt;input type=&quot;text&quot; name=&quot;max_px&quot; size=&quot;3&quot; value=&quot;" /&gt; px
		<br />
		
		<br />
	</form>



タイトルとURLをコピーしました