ありがとうございます!!
できました!!
長々、いろいろご指導ありがとうございました!!
助かりました!!!
いただいた通り、default.php に
以下と記載することで取得できました。
が、画像だけ、この記述だと記載できなかったので、少し変更したらできました。
<?php if ($this->BcBaser->isHome()): ?>
<?php
$BlogPost = new BlogPost();
$posts = $BlogPost->find('all', array(
'conditions' => array_merge($BlogPost->getConditionAllowPublish(), array(
'BlogPost.blog_content_id' => array(1,2,3,4) //blog IDを指定
)),
'order' => array('BlogPost.posts_date DESC'), //並び順:日付順
'limit' => 3 //記事取得件数
));
?>
<?php
if ($posts):
foreach ($posts as $key => $post):
//記事のブログnameの取得
$blogName = $post["BlogContent"]["name"];
$baseCurrentUrl = "/".$blogName . '/archives/';
//記事のファイルアップロードディレクトリ
$baseCurrentImgUrl = "/files/blog/".$blogName . "/blog_posts/";
//記事のURL
$postLink = $this->BcBaser->getUrl($baseCurrentUrl.$post['BlogPost']['no'],true);
if($post["BlogPost"]["eye_catch"]){
// アイキャッチ画像のパス
$eyeCatch = $baseCurrentImgUrl . $post["BlogPost"]["eye_catch"];
// アイキャッチ画像を別サイズで利用する場合は文字列置換
// $eyeCatch = str_replace(".jpg","__mobile_thumb.jpg", $eyeCatch);
// $eyeCatch_m = str_replace(".jpg","__thumb.jpg", $eyeCatch);
} else {
// アイキャッチが指定されてなかった場合
$eyeCatch = "/img/no-photo.png";
}
?>
<div class="post">
<a href="<?php echo $postLink; ?>">
<figure>
<img src="<?php echo $eyeCatch; ?>" alt="">
</figure>
<h2><?php $this->Blog->postTitle($post,false) ?>
<p><?php
// $post['BlogPost']['content'] //概要
// $post['BlogPost']['detail'] //本文
echo $post['BlogPost']['content'];
?>
</p>
</a>
</div>
<?php endforeach; ?>
<?php else: ?>
<p class="no-data">記事がありません
<?php endif ?>
<?php endif ?>
アイキャッチ画像をリンク付きで取得する記述に変えて、以下だと画像が取得できました。
<?php if ($this->BcBaser->isHome()): ?>
<?php
$BlogPost = new BlogPost();
$posts = $BlogPost->find('all', array(
'conditions' => array_merge($BlogPost->getConditionAllowPublish(), array(
'BlogPost.blog_content_id' => array(1,2,3,4) //blog IDを指定
)),
'order' => array('BlogPost.posts_date DESC'), //並び順:日付順
'limit' => 3 //記事取得件数
));
?>
<?php
if ($posts):
foreach ($posts as $key => $post):
//記事のブログnameの取得
$blogName = $post["BlogContent"]["name"];
$baseCurrentUrl = "/".$blogName . '/archives/';
//記事のファイルアップロードディレクトリ
$baseCurrentImgUrl = "/files/blog/".$blogName . "/blog_posts/";
//記事のURL
$postLink = $this->BcBaser->getUrl($baseCurrentUrl.$post['BlogPost']['no'],true);
if($post["BlogPost"]["eye_catch"]){
// アイキャッチ画像のパス
$eyeCatch = $baseCurrentImgUrl . $post["BlogPost"]["eye_catch"];
// アイキャッチ画像を別サイズで利用する場合は文字列置換
// $eyeCatch = str_replace(".jpg","__mobile_thumb.jpg", $eyeCatch);
// $eyeCatch_m = str_replace(".jpg","__thumb.jpg", $eyeCatch);
} else {
// アイキャッチが指定されてなかった場合
$eyeCatch = "/img/no-photo.png";
}
?>
<div class="post">
<a href="<?php echo $postLink; ?>">
<?php $this->Blog->postLink($post, $this->Blog->getEyeCatch($post, array('link' => false)));?>
<h2><?php $this->Blog->postTitle($post,false) ?>
<p><?php
// $post['BlogPost']['content'] //概要
// $post['BlogPost']['detail'] //本文
echo $post['BlogPost']['content'];
?>
</p>
</a>
</div>
<?php endforeach; ?>
<?php else: ?>
<p class="no-data">記事がありません
<?php endif ?>
<?php endif ?>