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

XF template system question

Discussion in 'XenForo Questions and Support' started by Ryan Kent, May 20, 2011.

  1. Ryan Kent

    Ryan Kent Well-Known Member

    I really wish there was a XenTemplates 101 user guide so I could read it and learn. Since there is not, I will do my best to learn it the hard way.

    My initial question concerns "content" code. Using the below code as an example, my questions are:

    - where does the "hascontent" portion of xen:if hascontent="true" come from? Is it a variable?
    - where does the <xen:contentcheck> come from?

    I basically seek to understand this code and how it works. I am totally lost on these seemingly simple points.

            <xen:if hascontent="true">
                <xen:foreach loop="$StatusUpdates" value="$update">
                        <xen:avatar user="$update" size="s" img="true" />
                        <a href="{xen:link members, $update}" class="username" style="display: inline;">{xen:helper richUserName, $update}</a>
                        <span class="userTitle">{$update.message} (<xen:datetime time="$update.post_date" />)</span>
  2. James

    James Well-Known Member

    I assume you know their function? The contents of the <xen:if hascontent="true"> will only be displayed if there is content to display, and the <xen:contentcheck> goes hand-in-hand with the hascontent attribute.

    Where they come from I can't tell you as my test install isn't up. Try looking in the Compiler folder.
  3. Ryan Kent

    Ryan Kent Well-Known Member

    I appreciate the reply. I have developed in VBA and MS SQL extensively, but I learned absolutely nothing from your reply.

    How exactly is the determination made as to whether or not there is content?

    Where is this attribute's value set?

    What is a compiler folder? Where is it located?

    Again, I have never used a template system before XF. I need a basic user guide. Let's assume I am an intelligent life form with general coding experience, but have never used a template system before. I need to start from that point, and go from there. Your reply seems to be for someone who has worked with this system already and has knowledge of these things.
  4. James

    James Well-Known Member

    Hi Oracle,

    You are asking how it is compiled? I see. The compiler folder is located at library/XenForo/Template. I'll have a look through them, but I'm not entirely sure.
  5. James

    James Well-Known Member

    In library/XenForo/Template/Compiler/Tag you'll notice a file called If.php. This controls the <xen:if> conditionals, and inside it you'll see some code. This controls the <xen:if> attributes, which I now realise are is, hascontent, segments, line.
  6. Ryan Kent

    Ryan Kent Well-Known Member

    I realize you are trying to assist me James, and I appreciate your efforts. At this point I am absolutely not the slightest bit closer to answering my original questions. The thread is just getting bigger. If perhaps someone else could give a shot at responding, that would probably be best.
  7. Panupat

    Panupat Well-Known Member

    From my understandind, it checks in this order.

    <xen: contentcheck> is the one deciding if hascontent is true or not. In this case, we specified xen: avatar ,xen:link, and a few others.

    So if 1 of the specified value exists (avatar, link, etc), contentcheck has content, so hascontent=true.

    I found a similar thread, hope they're good examples.

    Brad L and Ryan Kent like this.
  8. James

    James Well-Known Member

    Maybe I was unsure of your question. I thought you wanted to know how it was compiled - my bad.
  9. Ryan Kent

    Ryan Kent Well-Known Member

    Thank you Panupat! Those links were absolutely perfect. I am clear now.

    James, I recognize you are very knowledgeable. In this instance you were not able to convey your knowledge in a way that I understood it. Probably my fault. No worries, and again I truly appreciate the effort.

Share This Page