Module importing
Created 7 years ago by minkyov

Can I create a module and then call it from inside a page? For example I create the module sponsors and I want to add it to the home page of my website as a section in the end of the page. Thanks!

ryanthompson  —  7 years ago Best Answer

Of course! If you just need data you can get it with the entries function or if you need a view you can reference it with it's namespace like example.module.sponsors::your/view using Twig's include feature.

Hope this helps!

edster  —  7 years ago

As long as you have a plugin for your module yea.

What exactly are you trying to do?

You want to make a plugin to get and display what you want from the module or use the entries plugin to fetch from a stream to display stuff.

jcastillotx  —  7 years ago

What I do is call it via Twig for function:

{% for entry in entries('stream').get() %}
{% endfor %}

You can also add limits and where statements. Also you can do a plugin via Twig functions.

minkyov  —  7 years ago

Thank you I needed the view of the module {% include "" %} worked exactly as needed!

ryanthompson  —  7 years ago

Be sure to mark the answer 😊