<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using theme variables in template hubl code not working for padding in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Using-theme-variables-in-template-hubl-code-not-working-for/m-p/919776#M37800</link>
    <description>&lt;P&gt;Thank you for this suggestion.&lt;/P&gt;
&lt;P&gt;t did not upload as written with the same syntax error but with single quotes around the statement it uploaded but didn't work.&lt;/P&gt;
&lt;P&gt;From this I thought about an 'if' statement and tried&lt;/P&gt;
&lt;PRE&gt; padding={&lt;BR /&gt;'top': '{% if theme.site_layout.section_top_bottom &amp;gt;= 0 %}{{ theme.site_layout.section_top_bottom }}{% else %}60{% endif %}'&lt;BR /&gt;},&lt;/PRE&gt;
&lt;P&gt;This did not work either.&lt;/P&gt;
&lt;P&gt;I also tried setting an intermediate variable first early in the template&lt;/P&gt;
&lt;PRE&gt;{% set padding = theme.site_layout.section_top_bottom %}&lt;/PRE&gt;
&lt;P&gt;and in the section&lt;/P&gt;
&lt;PRE&gt;...&lt;BR /&gt;&lt;BR /&gt;padding={&lt;BR /&gt;'top': {{ padding }}&lt;BR /&gt;},...&lt;/PRE&gt;
&lt;P&gt;This did not work either. It did not upload without quotes around the variable.&lt;/P&gt;
&lt;P&gt;I am starting to think it's the quotes that are the issue. Double and single quotes have been tried.&lt;/P&gt;
&lt;P&gt;I am currently going to set the full width sections with modules that can't have padding, set the padding to 0, and leave the CSS to give the rest of the sections padding.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2024 22:41:08 GMT</pubDate>
    <dc:creator>JohnLaprairie</dc:creator>
    <dc:date>2024-02-08T22:41:08Z</dc:date>
    <item>
      <title>Using theme variables in template hubl code not working for padding</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-theme-variables-in-template-hubl-code-not-working-for/m-p/919617#M37792</link>
      <description>&lt;P&gt;I am creating a theme template which has a drag and drop area. In this section will be placed a module. I also have a Theme Options settings page that allows the client to set a default padding on sections in the DND area (see attached image).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the hubl code I know I can write:&lt;/P&gt;
&lt;PRE&gt;{% dnd_section &lt;BR /&gt;full_width=true, &lt;BR /&gt;padding={&lt;BR /&gt;'top': 60,&lt;BR /&gt;'bottom': 60,&lt;BR /&gt;'left': '0',&lt;BR /&gt;'right': '0'&lt;BR /&gt;},&lt;BR /&gt;vertical_alignment='MIDDLE' %}&lt;BR /&gt;{% dnd_module path='/theme/theme-modules/module' %}&lt;BR /&gt;{% end_dnd_module %}&lt;BR /&gt;{% end_dnd_section %}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I will see that the section in the page editor will have these values for padding.&lt;/P&gt;
&lt;P&gt;When I attempt to write the content as:&lt;/P&gt;
&lt;PRE&gt;{% dnd_section &lt;BR /&gt;full_width=true, &lt;BR /&gt;padding={&lt;BR /&gt;'top': {{ theme.site_layout.section_top_bottom }},&lt;BR /&gt;'bottom': {{ theme.site_layout.section_top_bottom }},&lt;BR /&gt;'left': {{ theme.site_layout.body_padding }},&lt;BR /&gt;'right': {{ theme.site_layout.body_padding }}&lt;BR /&gt;},&lt;BR /&gt;vertical_alignment='MIDDLE' %}&lt;BR /&gt;{% dnd_module path='/template/template-modules/module' %}&lt;BR /&gt;{% end_dnd_module %}&lt;BR /&gt;{% end_dnd_section %}&lt;/PRE&gt;
&lt;P&gt;I get an error from the CLI on upload&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;BR /&gt;[ERROR] Error validating template.&lt;BR /&gt;[ERROR] line 187: Error parsing '{&lt;BR /&gt;'top': {{ theme.site_layout.section_top_bottom }},&lt;BR /&gt;'bottom': {{ theme.site_layout.section_top_bottom }},&lt;BR /&gt;'left': {{ theme.site_layout.body_padding }},&lt;BR /&gt;'right': {{ theme.site_layout.body_padding }},&lt;BR /&gt;}': {{ theme.site_layout.section_top_bottom }},&lt;BR /&gt;'bottom': {{ theme.site_layout.section_top_bottom }},&lt;BR /&gt;'left': {{ theme.site_layout.body_padding }},&lt;BR /&gt;'right': {{ theme.site_layout.body_padding }},&lt;BR /&gt;}}': syntax error at position 75, encountered '}', expected ':'&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I put the variable in quotation marks&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'top': '{{ theme.site_layout.section_top_bottom }}',&lt;/PRE&gt;
&lt;P&gt;The templae will upload without an error, however the section will not this padding when I create a new page.&lt;/P&gt;
&lt;P&gt;I also tried adding a suffix as well&lt;/P&gt;
&lt;PRE&gt;'top':&amp;nbsp; '{{ theme.site_layout.section_top_bottom }}px',&lt;/PRE&gt;
&lt;P&gt;This did not work.&lt;/P&gt;
&lt;P&gt;If I set to just print the variable to the page, I will get the value '120' and so I know the variable is being passed to the template.&lt;/P&gt;
&lt;P&gt;If I send a different variable to another field, it will work&lt;/P&gt;
&lt;PRE&gt;max_width= {{ theme.site_layout.maximum_content_width }},&lt;/PRE&gt;
&lt;P&gt;I am thinking it has something to do with the padding json formatting but I can quite figure it out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am currently passing these values through a custom CSS file as&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;.body-container-wrapper .body-container .dnd-section {&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; padding-left: {{ theme.site_layout.body_padding }}px;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; padding-right: {{ theme.site_layout.body_padding }}px;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;/PRE&gt;
&lt;DIV&gt;but this isn't ideal as there are some modules that need to be fullwidth without padding left and right while other modules that require that padding.&lt;/DIV&gt;
&lt;DIV&gt;Any thoughts on this appreciated.&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 18:50:17 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-theme-variables-in-template-hubl-code-not-working-for/m-p/919617#M37792</guid>
      <dc:creator>JohnLaprairie</dc:creator>
      <dc:date>2024-02-08T18:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using theme variables in template hubl code not working for padding</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-theme-variables-in-template-hubl-code-not-working-for/m-p/919719#M37797</link>
      <description>&lt;P&gt;Try adding a default value if the value given is null:&lt;/P&gt;&lt;P&gt;'top': {{ theme.site_layout.section_top_bottom or "60px" }},&lt;BR /&gt;'bottom': {{ theme.site_layout.section_top_bottom or "60px" }},&lt;BR /&gt;...&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 21:25:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-theme-variables-in-template-hubl-code-not-working-for/m-p/919719#M37797</guid>
      <dc:creator>dsmarion</dc:creator>
      <dc:date>2024-02-08T21:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using theme variables in template hubl code not working for padding</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-theme-variables-in-template-hubl-code-not-working-for/m-p/919776#M37800</link>
      <description>&lt;P&gt;Thank you for this suggestion.&lt;/P&gt;
&lt;P&gt;t did not upload as written with the same syntax error but with single quotes around the statement it uploaded but didn't work.&lt;/P&gt;
&lt;P&gt;From this I thought about an 'if' statement and tried&lt;/P&gt;
&lt;PRE&gt; padding={&lt;BR /&gt;'top': '{% if theme.site_layout.section_top_bottom &amp;gt;= 0 %}{{ theme.site_layout.section_top_bottom }}{% else %}60{% endif %}'&lt;BR /&gt;},&lt;/PRE&gt;
&lt;P&gt;This did not work either.&lt;/P&gt;
&lt;P&gt;I also tried setting an intermediate variable first early in the template&lt;/P&gt;
&lt;PRE&gt;{% set padding = theme.site_layout.section_top_bottom %}&lt;/PRE&gt;
&lt;P&gt;and in the section&lt;/P&gt;
&lt;PRE&gt;...&lt;BR /&gt;&lt;BR /&gt;padding={&lt;BR /&gt;'top': {{ padding }}&lt;BR /&gt;},...&lt;/PRE&gt;
&lt;P&gt;This did not work either. It did not upload without quotes around the variable.&lt;/P&gt;
&lt;P&gt;I am starting to think it's the quotes that are the issue. Double and single quotes have been tried.&lt;/P&gt;
&lt;P&gt;I am currently going to set the full width sections with modules that can't have padding, set the padding to 0, and leave the CSS to give the rest of the sections padding.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 22:41:08 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-theme-variables-in-template-hubl-code-not-working-for/m-p/919776#M37800</guid>
      <dc:creator>JohnLaprairie</dc:creator>
      <dc:date>2024-02-08T22:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using theme variables in template hubl code not working for padding</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-theme-variables-in-template-hubl-code-not-working-for/m-p/920037#M37802</link>
      <description>&lt;DIV&gt;Ok, I guess I'll ask some stupid questions - I am much more familiar with the CRM than the CMS in HS:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;- Are you sure there is any value in theme.site_layout.section_top_bottom or other theme fields?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;- Are your theme fields defined in your theme's fields.json file (theme.site_layout.section_top_bottom and the others)?&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;- I ask this because I don't see where those are defined in the cms_boilerplate theme (of course, different themes can define custom fields)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;- or maybe they are defined somewhere else?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;- can you verify any value is stored in those fields?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 12:00:09 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-theme-variables-in-template-hubl-code-not-working-for/m-p/920037#M37802</guid>
      <dc:creator>dsmarion</dc:creator>
      <dc:date>2024-02-09T12:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using theme variables in template hubl code not working for padding</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-theme-variables-in-template-hubl-code-not-working-for/m-p/920198#M37811</link>
      <description>&lt;P&gt;When adding HubL values to an object you should not use the brackets at all.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;padding={
  'top': theme.site_layout.section_top_bottom,
  'bottom': theme.site_layout.section_top_bottom,
  'left': theme.site_layout.body_padding,
  'right': theme.site_layout.body_padding
}&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 09 Feb 2024 16:33:57 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-theme-variables-in-template-hubl-code-not-working-for/m-p/920198#M37811</guid>
      <dc:creator>alyssamwilie</dc:creator>
      <dc:date>2024-02-09T16:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using theme variables in template hubl code not working for padding</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-theme-variables-in-template-hubl-code-not-working-for/m-p/920210#M37813</link>
      <description>&lt;P&gt;Thank you very much. This works like I would expect it to, easy and simple.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 16:44:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-theme-variables-in-template-hubl-code-not-working-for/m-p/920210#M37813</guid>
      <dc:creator>JohnLaprairie</dc:creator>
      <dc:date>2024-02-09T16:44:27Z</dc:date>
    </item>
  </channel>
</rss>

