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

XF 1.5 Editing the templates.xml

Discussion in 'Styling and Customization Questions' started by MagicalMidge, Sep 16, 2016.

  1. MagicalMidge

    MagicalMidge Member

    Me again...

    So just playing with the templates.xml currently to re-arrange some things and remove some things that I dont want, however whenever I apply my changes, nothing happens...

    I can even load into the admin cp and check the templates from in there and my changes I have made to the actual xml file hasnt changed.

    I have tried rebooting the instance to see if it was a cache issue, it isnt.

    Does xen only take notice of the templates.xml when changed within the admin cp?

    I am using phpstorm to find the items I am editing, editing them within phpstorm, saving and then syncing the files, no changes.

    As a test, I even removed everything from the templates.xml so it was a blank xml file and again I could load into the admin cp and find everything was still there... Am I looking in the wrong place?

    I have tried doing a global search through phpstorm for the template code and it only finds stuff in templates.xml, no other references are found...

    Any help is as always appreciated

    Regards,
    Matthew
     
  2. Mike

    Mike XenForo Developer Staff Member

    Never change anything in the files or database unless given specific instructions to.

    Templates need to be edited through the interface in the control panel.
     
  3. MagicalMidge

    MagicalMidge Member

    This is just a local test installation I am essentially "playing" with different things - The xen interface in the control panel is clunky in the sense that it doesnt have a syntax highlighter, and I know you can link dreamweaver to the webdav, but I just want to be able to load everything in my ide and change the file to see what effect they have on the fly.

    Where can I find the files that xen actually reads from to put the page together?
     
  4. Mike

    Mike XenForo Developer Staff Member

    That's roughly the point -- they're from the data in the control panel, not any specific file. If you want to use an IDE, you'll need the WebDAV approach.
     
  5. MagicalMidge

    MagicalMidge Member

    So they must be in a file somewhere?
     
  6. Mike

    Mike XenForo Developer Staff Member

    They're stored in the database.
     
  7. MagicalMidge

    MagicalMidge Member

    Fair enough, is there any chance you could take a quick look at this and see if theres anything I am over looking?

    Below works fine

    Code:
    <xen:require css="UserRankImages.css" />
        
    <xen:if is="@UserRankImagesActive">
    
        <ul class="UserRankImages">
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages1UserGroup} AND @UserRankImages1">
                <li class="UserRankImages1"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages2UserGroup} AND @UserRankImages2">
                <li class="UserRankImages2"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages3UserGroup} AND @UserRankImages3">
                <li class="UserRankImages3"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages4UserGroup} AND @UserRankImages4">
                <li class="UserRankImages4"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages5UserGroup} AND @UserRankImages5">
                <li class="UserRankImages5"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages6UserGroup} AND @UserRankImages6">
                <li class="UserRankImages6"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages7UserGroup} AND @UserRankImages7">
                <li class="UserRankImages7"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages8UserGroup} AND @UserRankImages8">
                <li class="UserRankImages8"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages9UserGroup} AND @UserRankImages9">
                <li class="UserRankImages9"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages10UserGroup} AND @UserRankImages10">
                <li class="UserRankImages10"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages11UserGroup} AND @UserRankImages11">
                <li class="UserRankImages11"></li>
            </xen:if>
            
            <xen:if is="{xen:helpera ismemberof, $user, @UserRankImages12UserGroup} AND @UserRankImages12">
                <li class="UserRankImages12"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages13UserGroup} AND @UserRankImages13">
                <li class="UserRankImages13"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages14UserGroup} AND @UserRankImages14">
                <li class="UserRankImages14"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages15UserGroup} AND @UserRankImages15">
                <li class="UserRankImages15"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages16UserGroup} AND @UserRankImages16">
                <li class="UserRankImages16"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages17UserGroup} AND @UserRankImages17">
                <li class="UserRankImages17"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages18UserGroup} AND @UserRankImages18">
                <li class="UserRankImages18"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages19UserGroup} AND @UserRankImages19">
                <li class="UserRankImages19"></li>
            </xen:if>
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages20UserGroup} AND @UserRankImages20">
                <li class="UserRankImages20"></li>
            </xen:if>
            
        </ul>
    </xen:if>
    
    
    However when I try to swap it for "elseif" and go from 20-1 rather than 1-20 it refuses to save the template because of syntax error... Is the elseif limited to one per if statement?

    Below gives error: "The following templates contained errors and were not saved: UserRankImages: Line 69: Template syntax error." Which is the class closing tag.

    Code:
    <xen:require css="UserRankImages.css" />
        
    <xen:if is="@UserRankImagesActive">
    
        <ul class="UserRankImages">
            
            <xen:if is="{xen:helper ismemberof, $user, @UserRankImages20UserGroup} AND @UserRankImages20">
                    {<li class="UserRankImages20"></li>}
                    <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages19UserGroup} AND @UserRankImages19">
                        {<li class="UserRankImages19"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages18UserGroup} AND @UserRankImages18">
                        {<li class="UserRankImages18"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages17UserGroup} AND @UserRankImages17">
                        {<li class="UserRankImages17"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages16UserGroup} AND @UserRankImages16">
                        {<li class="UserRankImages16"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages15UserGroup} AND @UserRankImages15">
                        {<li class="UserRankImages15"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages14UserGroup} AND @UserRankImages14">
                        {<li class="UserRankImages14"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages13UserGroup} AND @UserRankImages13">
                        {<li class="UserRankImages13"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages12UserGroup} AND @UserRankImages12">
                        {<li class="UserRankImages12"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages11UserGroup} AND @UserRankImages11">
                        {<li class="UserRankImages11"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages10UserGroup} AND @UserRankImages10">
                        {<li class="UserRankImages10"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages9UserGroup} AND @UserRankImages9">
                        {<li class="UserRankImages9"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages8UserGroup} AND @UserRankImages8">
                        {<li class="UserRankImages8"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages7UserGroup} AND @UserRankImages7">
                        {<li class="UserRankImages7"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages6UserGroup} AND @UserRankImages6">
                        {<li class="UserRankImages6"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages5UserGroup} AND @UserRankImages5">
                        {<li class="UserRankImages5"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages4UserGroup} AND @UserRankImages4">
                        {<li class="UserRankImages4"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages3UserGroup} AND @UserRankImages3">
                        {<li class="UserRankImages3"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages2UserGroup} AND @UserRankImages2">
                        {<li class="UserRankImages2"></li>}
                        
                        <xen:elseif is="{xen:helper ismemberof, $user, @UserRankImages1UserGroup} AND @UserRankImages1">
                        {<li class="UserRankImages1"></li>}
                        
                    
                    </xen:if>
        
        </ul>
    </xen:if>
    
    
     
  8. Snog

    Snog Well-Known Member

    Each elseif needs to end with /> not >

    And I believe (could be wrong and probably am) the last elsif should be a <xen:else />.
     
    MagicalMidge likes this.
  9. MagicalMidge

    MagicalMidge Member

    I wish I could kiss you right about now!!!!!

    <3

    Needless to say you were correct (though I dont think the xen:else/> is needed as it works without) but the ending tag! How could I have missed that haha, anyway thank you!

    Regards
    Matthew :)
     
  10. Snog

    Snog Well-Known Member

    Yeah, I've never used an 'elseif is' as the final statement so I wasn't sure if it worked or not.

    Glad to here it's working now.
     

Share This Page