Re: Designer Contentで作成したブロックをページリストテンプレート内で表示したいです

2015年4月25日 at 21:46

contiさん

hissyさんのコードに追記するのは、おこがましいですが、
こんな感じで動くかと・・・(動作未検証です)

// get instance of the block
if (is_object($blocks[0])) {
$bObj = $blocks[0]->getInstance();
// print property of the block (Designer Content style)
echo $bObj->field_1_textbox_text;

// set for width and hight attribute for image tag
$width = 200;
$hight = 400;

// set field_2_image from field_2_image_fID
$bObj->set('field_2_image', (empty($bObj->field_2_image_fID) ? null : $bObj->get_image_object($bObj->field_2_image_fID, $width, $hight, true)));
if (!empty($field_2_image)) {
?>
<img src="<?php echo $field_2_image->src; ?>" width="<?php echo $field_6_image->width; ?>" height="<?php echo $field_6_image->height; ?> alt="<?php echo $field_2_image_altText; ?>" />
<?php
}

}