# Render single module or module with specific template

**URL:** <https://forum.getkirby.com/t/render-single-module-or-module-with-specific-template/11599>\
**Category:** Questions\
**Tags:** v2\
**Created:** [November 5, 2018, 7:12pm UTC](https://forum.getkirby.com/t/render-single-module-or-module-with-specific-template/11599 "2018-11-05T19:12:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThomasLal](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thomaslal/32/3963_2.png) [@ThomasLal](https://forum.getkirby.com/u/ThomasLal)\
**Post date:** [November 5, 2018, 7:12pm UTC](https://forum.getkirby.com/t/render-single-module-or-module-with-specific-template/11599/1 "2018-11-05T19:12:08Z")

</div>

Hi guys,

I’m struggling the whole afternoon and try to solve one issue with modules plugin. I work with 2 multiple module section on 1 page. That means I want use modules for the content area and other modules for so called sidebar area. In the panel everything works quite well and has the structur (like this)

```
content/
       page-a/
               _modules/
               _sidebar/
               default.txt

```

I want to control the render process now and print the content-modules separately to the sidebar-modules. With $page-\>modules() i can print only everything, and render() gives me an error. What’s the best way to print multiple module sections on 1 pages?

Thanks!

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 5, 2018, 7:27pm UTC](https://forum.getkirby.com/t/render-single-module-or-module-with-specific-template/11599/2 "2018-11-05T19:27:09Z")

</div>

Hm, I’m a bit surprised that the plugin also fetches the modules from the `_sidebar` subfolder, because as far as I know, you can only have a single folder that contains submodules 🤔

---

<div class="post-metadata">

**Author:** ![ThomasLal](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thomaslal/32/3963_2.png) [@ThomasLal](https://forum.getkirby.com/u/ThomasLal)\
**Post date:** [November 5, 2018, 7:40pm UTC](https://forum.getkirby.com/t/render-single-module-or-module-with-specific-template/11599/3 "2018-11-05T19:40:56Z")

</div>

the setting

c::set(‘modules.parent.uid’, array(’\_modules’, ‘\_sidebar’));

make it happen. take a while to find it out

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 5, 2018, 8:00pm UTC](https://forum.getkirby.com/t/render-single-module-or-module-with-specific-template/11599/4 "2018-11-05T20:00:23Z")

</div>

Since modulelist() gives you a collection of modules, you can filter them like any collection, I assume. Haven’t tested this, but something like

```auto
$modules = $page->modulelist()->filterBy('parent', '_sidebar');

```

could probably work, or filter by templates or whatever these have in common.

With your array as config setting, you might however run into issues, at least the page method

```auto
	public function page() {
		if($this->parent()->uid() === Settings::parentUid()) {
			return $this->parent()->parent();
		} else {
			return $this->parent();
		}
	}

```

will not work, because the if statement will never be true, because you will compare a string to an array.

---

<div class="post-metadata">

**Author:** ![ThomasLal](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thomaslal/32/3963_2.png) [@ThomasLal](https://forum.getkirby.com/u/ThomasLal)\
**Post date:** [November 6, 2018, 7:21am UTC](https://forum.getkirby.com/t/render-single-module-or-module-with-specific-template/11599/5 "2018-11-06T07:21:18Z")

</div>

Hmn,

thats true - and the array in modules.parent.uid is the reason why render() dit not work too.

Thanks to find my mistake 😉

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 6, 2018, 9:54am UTC](https://forum.getkirby.com/t/render-single-module-or-module-with-specific-template/11599/6 "2018-11-06T09:54:09Z")

</div>

But why can’t you put all modules into one subfolder and give them template names to differentiate them? Or use two subfolders (main and sidebar) as parents with the modules inside them.

---

<div class="post-metadata">

**Author:** ![ThomasLal](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thomaslal/32/3963_2.png) [@ThomasLal](https://forum.getkirby.com/u/ThomasLal)\
**Post date:** [November 6, 2018, 11:23am UTC](https://forum.getkirby.com/t/render-single-module-or-module-with-specific-template/11599/7 "2018-11-06T11:23:00Z")

</div>

I need to separate it to fill them with different modules. If i storage all modules in one subfolder i have to chance the prefix, that i can select different modules. If i don’t do it, a selected module will insert in both module sections.

its the same problem like with parent.

 ![15](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/b/bbcddae5236b93d48acc87aec186b9fee9169825.png)

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 6, 2018, 11:28am UTC](https://forum.getkirby.com/t/render-single-module-or-module-with-specific-template/11599/8 "2018-11-06T11:28:12Z")

</div>

Then I’d go with the two parents solution.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:25pm UTC](https://forum.getkirby.com/t/render-single-module-or-module-with-specific-template/11599/9 "2025-02-06T17:25:49Z")

</div>


