Hi, I am stuck wit this peculiarity, wondering if you can spot the mistake I may be making.

What I have is a single-pager, which has
- a Homepage (index.php), which is a standalone template with header, hero section and some special blocks
- sections (sekce.php) - a clonable template containing Mosaic, based on which all further sections under Home are built
- additional pages such as gallery.php with images embedded into a mosaic tile based on relation selection - immaterial here.

I would like to allow individual bgr image for all sections bellow Home (i.e. clones of the sekce.php) - either color or image.

So in sekce.php I have

Code: Select all
<cms:editable type='dropdown' name="pozadi" label="Pozadí sekce" desc="" opt_values='Žádné=none | Béžová=var(--beige) | Fialová=var(--viol) | Světle zelená=var(--litegrin) | Světle modrá=var(--liteblu) | Obrázek=obrazek' order='10'  />

<cms:func _into='my_cond' pozadi=''>
   <cms:if pozadi='obrazek'>show<cms:else />hide</cms:if>
</cms:func>
<cms:editable type='image' name='obrazekpozadi' label='obrazekpozadi' not_active=my_cond order='20'/>

<cms:if pozadi == 'obrazek'>
<cms:set ttt="url(<cms:show obrazekpozadi />)"  scope='global' />
<cms:else />
   <cms:set ttt="<cms:show pozadi />"  scope='global' />
</cms:if>

...where the "ttt" is a variable in which I would like to store either color code or bgr image url.

and then I do a quick list of all existing sections (otherwise this masterpage will not be used):

Code: Select all
<cms:if k_is_list >   
   
   <section>
      <div class="wrap tretinky" style="background:<cms:show ttt />">
         <cms:pages masterpage='sekce.php' orderby='weight' order='asc' >
         <a id="<cms:show k_page_title />" class="page" style=" ... background:<cms:show ttt />" href="<cms:show k_page_link />">
            <h3 style="text-align:center; "><cms:show k_page_title /></h3>
            <div>
               <cms:show ttt  scope='global' />
               <cms:excerptHTML count='15' trail='...' ignore='h2'>
                  <cms:show text />
               </cms:excerptHTML>
            </div>      
         </a>
         </cms:pages>
      </div>
   </section>

<cms:else />
   <section style="background:<cms:show ttt />">
      <cms:embed 'mosaic-content.html' />
   </section>
</cms:if>   

Obviously, I would like to use the "ttt" variable in an inline CSS for each of the sections.

So in index.php I have

Code: Select all
<cms:pages masterpage='sekce.php' orderby='weight' order='asc' >
   <section id="<cms:show k_page_name />" style="background:<cms:get ttt />"   >
   <h2><cms:show k_page_title /></h2>
      <cms:embed 'mosaic-content.html' />
   </section>
</cms:pages>

In the admin, all looks good (hiding condition, image selection, saving...), but on fromt end the "ttt" background is not there - neither color, nor image.

At the same point, if I add to the sekce.php,
Code: Select all
<span style="height:200px; width:200px; display:block; background: <cms:show ttt />; border:2px solid green;"></span>

I can only see the square with desired background if it is outside of the "<cms:if k_is_list >" condition, if I place it inside, the background does not render. Likewise,
Code: Select all
<cms:show ttt />

properly shows the variable content (either color name or img url) only if placed outside of hat condition.

So the question is, could you advise how I can push the variable from clonable template to individual cloned pages to work as an inline style? The ultimate issue seems to be to get the variable from cloned page to the <cms:if k_is_list > tag and hence to the index.php page, where all the cloned pages are embedded with the <pages /> tag.

Why in one instance (the testing birdered square or plain cms:show) the output is there ok, but in an inline styleI I only see empy quotes in the DOM inspector, not even an incorrect CSS or so? Itried "capture" instead of "set" too and all combinations of get/show and quotes, but no do.

Placing the "<cms:if pozadi = 'obrazek'>" condition directly inside the <section style=""> on index.php works, but would like to try the variable. What seems to be hindering me, please?