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

kontakt40205
kontakt40205

Hi!

I would like perform DB Queries with rainlab.builder plugin in twig. I've created in the rainlab.builder plugin (https://octobercms.com/plugin/rainlab-builder) a plugin called "Article" and added a DB, Model and Controller. Now I'm able to create articles and print them out. But I only want to have the newest articles and only 6 of them all. I can perform this DB Query like this:

$articles = Db::table('test_test2_article')->orderBy('created_at', 'desc')->take(6)->get();

But how I'm able to print that variable in Twig? Or do I have to manipulate the Builder plugin variable? But how? Right now I only can template out the articles with a variable set by the Builder plugin: {% set records = builderList.records %}

I have the following Codesnippet: https://jsfiddle.net/kh0o7nvw/1/

Thank you guys!

1-1 of 1

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