ホットペッパーAPI(リクルートWebサービス)お店の特徴ラベル表示スニペット

この記事は約11分で読めます。
記事内に広告が含まれています。

ホットペッパースニペット

今月10/13(土)に開催したイベント × 位置情報 マッシュアップワークショップ supported by イベントATNDに参加いただいた皆様、ありがとうございました。
だいぶ日が経ちましたが、当日公開していなかったものについて一部公開します。

当日、お店の特徴を表すラベルについて、すべてラベル状で表示していました。

例えば「Wifiあり」と「Wifiなし」、両方とも表示していましたが、「Wifiあり」のみ表示するようにすれば、それを印にして、WiFiありの店とそうでないところの差別化がしやすくなります。

それをなんとかif文で判別するスニペットを公開します(ただ、この後、考え方によってはもう少し手を入れることも考えられます)。

[php]

<?php if (!h($hit->party_capacity) == "") { ?>
<span class="label label-info">最大宴会収容人数<?php echo h($hit->party_capacity); ?></span>
<?php } ?>

<?php if (!(h($hit->wifi) == "" or h($hit->wifi) == "未確認" or h($hit->wifi) == "なし")) { ?>
<span class="label label-important">WiFi<?php echo h($hit->wifi); ?></span>
<?php } ?>

<?php if (!h($hit->wedding) == "") { ?>
<span class="label label-warning">ウェディング・二次会<?php echo h($hit->wedding); ?></span>
<?php } ?>

<?php if (!(h($hit->course) == "" or h($hit->course) == "なし")) { ?>
<span class="label label-warning">コース<?php echo h($hit->course); ?></span>
<?php } ?>

<?php if (!(h($hit->free_drink) == "" or h($hit->free_drink) == "なし")) { ?>
<span class="label label-warning">飲み放題<?php echo h($hit->free_drink); ?></span>
<?php } ?>

<?php if (!(h($hit->free_food) == "" or h($hit->free_food) == "なし")) { ?>
<span class="label label-warning">食べ放題<?php echo h($hit->free_food); ?></span>
<?php } ?>

<?php if (!(h($hit->private_room) == "" or h($hit->private_room) == "なし")) { ?>
<span class="label label-success">個室<?php echo h($hit->private_room); ?></span>
<?php } ?>

<?php if (!(h($hit->horigotatsu) == "" or h($hit->horigotatsu) == "なし")) { ?>
<span class="label label-success">掘りごたつ<?php echo h($hit->horigotatsu); ?></span>
<?php } ?>

<?php if (!(h($hit->tatami) == "" or h($hit->tatami) == "なし")) { ?>
<span class="label label-success">座敷<?php echo h($hit->tatami); ?></span>
<?php } ?>

<?php if (!(h($hit->card) == "" or h($hit->card) == "利用不可")) { ?>
<span class="label label-success">カード<?php echo h($hit->card); ?></span>
<?php } ?>

<?php if (!(h($hit->non_smoking) == "" or h($hit->non_smoking) == "禁煙席なし")) { ?>
<span class="label label-success">禁煙席<?php echo h($hit->non_smoking); ?></span>
<?php } ?>

<?php if (!(h($hit->charter) == "" or h($hit->charter) == "貸切不可")) { ?>
<span class="label label-success">貸切<?php echo h($hit->charter); ?></span>
<?php } ?>

<?php if (!(h($hit->ktai) == "" or h($hit->ktai) == "つながりにくい")) { ?>
<span class="label label-success">携帯電話<?php echo h($hit->ktai); ?></span>
<?php } ?>

<?php if (!(h($hit->parking) == "" or h($hit->parking) == "なし")) { ?>
<span class="label label-success">駐車場<?php echo h($hit->parking); ?></span>
<?php } ?>

<?php if (!(h($hit->sommelier) == "" or h($hit->sommelier) == "なし")) { ?>
<span class="label label-success">ソムリエ<?php echo h($hit->sommelier); ?></span>
<?php } ?>

<?php if (!(h($hit->barrier_free) == "" or h($hit->barrier_free) == "なし")) { ?>
<span class="label label-success">バリアフリー<?php echo h($hit->barrier_free); ?></span>
<?php } ?>

<?php if (!(h($hit->open_air) == "" or h($hit->open_air) == "なし")) { ?>
<span class="label label-info">オープンエアー<?php echo h($hit->open_air); ?></span>
<?php } ?>

<?php if (!(h($hit->show) == "" or h($hit->show) == "なし")) { ?>
<span class="label label-info">ライブ・ショー<?php echo h($hit->show); ?></span>
<?php } ?>

<?php if (!(h($hit->equipment) == "" or h($hit->equipment) == "なし")) { ?>
<span class="label label-info">エンタメ設備<?php echo h($hit->equipment); ?></span>
<?php } ?>

<?php if (!(h($hit->karaoke) == "" or h($hit->karaoke) == "なし")) { ?>
<span class="label label-info">カラオケ<?php echo h($hit->karaoke); ?></span>
<?php } ?>

<?php if (!(h($hit->band) == "" or h($hit->band) == "不可")) { ?>
<span class="label label-info">バンド演奏<?php echo h($hit->band); ?></span>
<?php } ?>

<?php if (!(h($hit->tv) == "" or h($hit->tv) == "なし")) { ?>
<span class="label label-info">TV・プロジェクター<?php echo h($hit->tv); ?></span>
<?php } ?>

<?php if (!(h($hit->english) == "" or h($hit->english) == "なし")) { ?>
<span class="label label-info">英語メニュー<?php echo h($hit->english); ?></span>
<?php } ?>

<?php if (!(h($hit->pet) == "" or h($hit->pet) == "不可")) { ?>
<span class="label label-info">ペット<?php echo h($hit->pet); ?></span>
<?php } ?>

<?php if (!(h($hit->child) == "" or h($hit->child) == "お子様連れ不可")) { ?>
<span class="label label-info"><?php echo h($hit->child); ?></span>
<?php } ?>

<?php if (!(h($hit->lunch) == "" or h($hit->lunch) == "なし")) { ?>
<span class="label label-info">ランチ<?php echo h($hit->lunch); ?></span>
<?php } ?>

<?php if (!(h($hit->midnight) == "" or h($hit->midnight) == "営業していない")) { ?>
<span class="label label-info">23時以降<?php echo h($hit->midnight); ?></span>
<?php } ?>

[/php]

あとは気になった方、もう少しあれこれいじってもいいかもしれません。

コメント

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