CMS Development

matttunney
トップ投稿者

Determine first, last or count of a module

解決

Is there a way to get the count for each instance of a custom module?

 

Say a module is this

 

        </div>
    </div>
</div>
<div class="row-fluid-wrapper">
    <div class="row-fluid">
        <div class="span12">

 

Is there a way to say on the first instance do this?

 

{% unless moduleCount == '1' %}
        </div>
    </div>
</div>
{% endunless%}
<div class="row-fluid-wrapper">
    <div class="row-fluid">
        <div class="span12">

Thanks

0 いいね!
1件の承認済みベストアンサー
matttunney
解決策
トップ投稿者

Determine first, last or count of a module

解決

So Ive found a work around but it really feels like a hack and additional effort for my marketing team. It also leaves room for error.

 

A user will need to know the set the appropriate check box (first_container, last_container) to set the divider section as either the first of last item.

this will then dictate if the closing and opening html is rendered on the template.

 

 

{% unless module.first_container %}
</div><!--end widget-span -->
</div><!--end row-->
</div>
{% endunless %}

{% unless module.last_container %}
<div class="row-fluid-wrapper new-section {{ module.background.color }}" id="{{ module.section.id|replace(' ', '')|lower) }}">
<div class="row-fluid page-center {{ module.section.width }}">
<div class="span12">
{% endunless %}

This means I can provide a template that consitists of a single flexible column. This divider section module can be dropped in where required. This will create a new section in the page with custom display settings to suit the design.

 

 

The reason for looking at a solution for this is to provide marketing staff and content editors a little of the freedom of the template generator in the design manager, without the required knowledge, so they can generate the layout the need with the modules provided.

 

元の投稿で解決策を見る

0 いいね!
2件の返信
roisinkirby
HubSpot製品開発チーム
HubSpot製品開発チーム

Determine first, last or count of a module

解決

Hey @matttunney I haven not personally seen this done before, but would not consider myself an exeprt in HubSpot CMS design!

 

@Gonzalo do you know if this is possible?

0 いいね!
matttunney
解決策
トップ投稿者

Determine first, last or count of a module

解決

So Ive found a work around but it really feels like a hack and additional effort for my marketing team. It also leaves room for error.

 

A user will need to know the set the appropriate check box (first_container, last_container) to set the divider section as either the first of last item.

this will then dictate if the closing and opening html is rendered on the template.

 

 

{% unless module.first_container %}
</div><!--end widget-span -->
</div><!--end row-->
</div>
{% endunless %}

{% unless module.last_container %}
<div class="row-fluid-wrapper new-section {{ module.background.color }}" id="{{ module.section.id|replace(' ', '')|lower) }}">
<div class="row-fluid page-center {{ module.section.width }}">
<div class="span12">
{% endunless %}

This means I can provide a template that consitists of a single flexible column. This divider section module can be dropped in where required. This will create a new section in the page with custom display settings to suit the design.

 

 

The reason for looking at a solution for this is to provide marketing staff and content editors a little of the freedom of the template generator in the design manager, without the required knowledge, so they can generate the layout the need with the modules provided.

 

0 いいね!