This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

stevehaysom56011
stevehaysom56011

Code section: use RainLab\Blog\Models\Post as BlogPost;

function onStart(){ $homePagePost = []; $homePageSubPosts = []; foreach(BlogPost::all() as $blog){ foreach($blog->categories as $cat){ if($cat->slug == 'home-page') { array_push($homePagePost , $blog); break; } if($cat->slug =='home-page-sub-post') { array_push($homePageSubPosts, $blog); }

    }
}

$this['homePagePost'] = $homePagePost; $this['homePageSubPosts'] = $homePageSubPosts; }

Markup section: <ul class="post-list"> {% for post in homePagePost %} <li> {% if post.featured_images.count %} <div class="featured-images text-center"> {% for image in post.featured_images %} <p> <img data-src="{{ image.filename }}" src="{{ image.path }}" alt="{{ image.description }}" style="" /> </p> {% endfor %} </div> {% endif %} <h3>{{ post.title }}</h3> <span class="info">{{ post.published_at|date('M d, Y') }}</span> <p class="excerpt">{{ post.summary|raw }}</p> <div class="content">{{ post.content_html|raw }}</div>

</li>

{% else %} {% content "home.md" %} {% endfor %} </ul> any help would be appreciated. it's only displaying the featured image from original featured rainlab blog, not the new featured image when blog fields extension is added.

thanks

Steve

stevehaysom56011
stevehaysom56011

resorted to sql:

SELECT distinct rainlab_blog_posts.*, rainlab_blog_categories.name, janvince_smallextensions_blogfields.image, janvince_smallextensions_blogfields.featured_image, janvince_smallextensions_blogfields.featured_image_title, janvince_smallextensions_blogfields.featured_image_alt FROM janvince_smallextensions_blogfields RIGHT JOIN ((rainlab_blog_posts INNER JOIN rainlab_blog_posts_categories ON rainlab_blog_posts.id = rainlab_blog_posts_categories.post_id) INNER JOIN rainlab_blog_categories ON rainlab_blog_posts_categories.category_id = rainlab_blog_categories.id) ON janvince_smallextensions_blogfields.post_id = rainlab_blog_posts.id WHERE (((rainlab_blog_categories.slug)="home-page"));

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.