• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Need help with style chooser

Matthew Hawley

Well-known member
#1
Okay so I'm trying to make the style chooser a popup menu. I was successful somewhat. It is working at the actual style chooser page but not in the footer.

You can see it here: http://2dmods.com/misc/style But first you will have to choose the style "Testing" then go to the link.

This is my code for style_chooser
Code:
<xen:title>{xen:phrase style_chooser}</xen:title>

<xen:container var="$head.metaNoindex"><meta name="robots" content="noindex" /></xen:container>

<xen:require css="chooser_overlay.css" />
<xen:require css="style_chooser.css" />

<div class="section styleChooser" data-overlayClass="chooserOverlay">

    <xen:if is="{$targetStyle}">
     
        <div class="chooserConfirm">
            <h3 class="primaryContent chooserConfirm">
                {xen:phrase please_confirm_that_you_would_like_to_change_to_following_style}:
                <strong>{$targetStyle.title}</strong>
            </h3>
            <div class="secondaryContent">
                <a href="{xen:link 'misc/style', '', 'style_id={$targetStyle.style_id}', '_xfToken={$visitor.csrf_token_page}', 'redirect={$redirect}'}" class="button primary">{xen:phrase use_this_style}</a>
            </div>
        </div>
     
    <xen:else />
                        <li><div class="Popup">
                              <a rel="Menu">Styles</a>
                              <div class="Menu">
                                      <span class="arrowWidget"></span>
                                          <div class="primaryContent menuHeader">
                                    <div class="muted"><a href="{xen:link 'misc/style', '', 'style_id=0', '_xfToken={$visitor.csrf_token_page}', 'redirect={$redirect}'}">{xen:phrase use_default_style}</a></div>
                                </div>
                                            <ul class="secondaryContent blockLinksList">
                                                <xen:foreach loop="$styles" value="$style">
                                        <xen:if is="{$style.user_selectable} OR {$visitor.is_admin}">
                                        <li class="{xen:if '!{$style.user_selectable}', 'unselectable'}">
                                            <a href="{xen:link 'misc/style', '', 'style_id={$style.style_id}', '_xfToken={$visitor.csrf_token_page}', 'redirect={$redirect}'}">
                                            <span class="title">{$style.title}</span>
                                            </a>
                                        </li>
                                        </xen:if>
                                    </xen:foreach>
                                            </ul>
                              </div>
                </div></li>
Then I created a template called style_list and put this in it. Also I included the template in the style_chooser and it worked fine.
Code:
  <li><div class="Popup">
                              <a rel="Menu">Styles</a>
                              <div class="Menu">
                                      <span class="arrowWidget"></span>
                                          <div class="primaryContent menuHeader">
                                    <div class="muted"><a href="{xen:link 'misc/style', '', 'style_id=0', '_xfToken={$visitor.csrf_token_page}', 'redirect={$redirect}'}">{xen:phrase use_default_style}</a></div>
                                </div>
                                            <ul class="secondaryContent blockLinksList">
                                                <xen:foreach loop="$styles" value="$style">
                                        <xen:if is="{$style.user_selectable} OR {$visitor.is_admin}">
                                        <li class="{xen:if '!{$style.user_selectable}', 'unselectable'}">
                                            <a href="{xen:link 'misc/style', '', 'style_id={$style.style_id}', '_xfToken={$visitor.csrf_token_page}', 'redirect={$redirect}'}">
                                            <span class="title">{$style.title}</span>
                                            </a>
                                        </li>
                                        </xen:if>
                                    </xen:foreach>
                                            </ul>
                              </div>
                </div></li>
This is what happens when I try to put it in the footer using:
Code:
<xen:include template="style_list" />
And I get this error up top:



And this is what the style list looks like.

 

Jeremy

Well-known member
#2
$styles appears that its not available in the footer template. You'll need an add-on to make it available by extending a controller (or controllers).