Can I have a mysource_area nested content block inside another mysource_area block?


(Mahearnpad) #1

The following is not working - code fragment below.

 

I'm not getting an error when the file is parsed. It's not picking the line <MySource_AREA id_name="login_page" design_area="nest_content" /> at all, as it's not available in the customisations file.

 

Is it possible to do what I'm trying to do here?  Using Matrix v4.14.1

 

TIA

 

<MySource_AREA id_name="user_name" design_area="show_if">
      <MySource_SET name="condition" value="logged_in" />
      <MySource_THEN>
       ... blah blah ...
      </MySource_THEN>
      <MySource_ELSE>
        <!-- not logged in -->
        <!-- show the login link -->
        <div class="login-logout clearfix">
          <div id="login-link">
            <!--<a href="/login" class="btn btn-primary btn-sm" data-redirect="/home"><span class="glyphicon glyphicon-log-in"></span>  Member Login</a>-->
            <a href="./?a=53932" class="btn btn-primary btn-sm" data-target="#login-modal" data-toggle="modal"><span class="glyphicon glyphicon-log-in"></span>  Member Login</a>
          </div>  
        </div>
         
        <!-- new login modal box -->
        <div class="modal fade" id="login-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&amp;times;</button>
                      <h4 class="modal-title" id="myModalLabel">Member Login</h4>
                    </div>
                    <div class="modal-body">
                      <MySource_AREA id_name="login_page" design_area="nest_content" />
                    </div>
                    <div class="modal-footer">
                      <p><a href="">Recover your password</a></p>
                      <p><a href="">Password for new members</a></p>
                    </div>
                </div>
            </div>
        </div>

 


(Tim Davison) #2

You can't nest it like that, but you can nest it by defining <MySource_AREA id_name="login_page" design_area="nest_content" /> somewhere else, setting it to print=no, and then using <MySource_PRINT id_name="login_page" /> within another area.  That will 'print' out the contents of the login_page design area.

 

Simple example:

<MySource_AREA id_name="login_page" design_area="nested_content" print="no" />
<MySource_AREA id_name="user_name" design_area="show_if">
  <MySource_SET name="condition" value="logged_in" />
  <MySource_THEN>
       ... blah blah ...
  </MySource_THEN>
  <MySource_ELSE>
    .. blah ..
    <MySource_PRINT id_name="login_page" />
    .. blah ..
  </MySource_ELSE>
</MySource_AREA>

This applies to other matrix areas as well, we use them quite heavily (although the logic can sometimes get a little obscure).  Examples in manual are here:

http://manuals.matrix.squizsuite.net/designs/chapters/show-if-design-area#Nesting-Show-If-Design-Areas


(Mahearnpad) #3

Ah, I see. Thanks Tim.