- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
custom module - choose the blog
SOLVEFeb 8, 2017 3:46 AM
Hi, I'm creating a custom module to have a slider post.
I need to choose the blog from a list and have the number of posts to display. The syntax to set the blog is this: {% set posts = blog_recent_posts('default', 5) %} but how do I make dynamic the field "default" = blog name or its id, and the field "5" = number of posts to be displayed?
I've tried with this sintax
{% set posts = blog_recent_posts('{{widget.blog_name}}', '{{widget.n_posts}}') %}
but do not work
Can anyone help me?
Many thanks
Giovanni
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Accepted Solutions
Feb 9, 2017 12:44 PM
Hi Gio,
When you are within a HubL statement, it is not necessary to wrap HubL tokens in expression delimiters
{{ }}
Making these slight changes to your code should get this working
{% text "blog_id" label="Blog ID", value="4495212459", export_to_template_context=True %} {% set post_num = [1, 2, 3, 4, 5, 6] %} {% choice "blog_limit" label="Number of Posts", value="5", choices="post_num", export_to_template_context=True %} {% set posts = blog_recent_posts(widget_data.blog_id.value, widget_data.blog_limit.value) %}
Best,
Danielle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content