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

Help with creating admin template to show table similar to 'attachment_list'

TheBigK

Well-known member
#1
I'm really stuck at creating a template that's similar to the 'attachment_list'. The variables available to me are:

$log.log_id, $log.user_id $log.keywords, $log.date_time

All I'm trying to achieve is display the information into a proper table that looks like the attachment browser table. I wish to have checkboxes in every row which I can select to delete records; and a 'select all' checkbox in the header that allows me to mass delete records.

I've been attempting this by referencing the attachment_list template but unable to get this to work. I found the following part very difficult to grasp:
PHP:
<xen:title>This is search tracker</xen:title>
<xen:require css="filter_list.css" />
<xen:require js="js/xenforo/filter_list.js" />

<xen:if is="{$log}">
    <div class="section">
        <h2 class="subHeading">
            <label class="checkAll"><input type="checkbox" class="CheckAll" />Select All</label>
        </h2>
       
        <ol id="log" class="FilterList Scrollable secondRow">
            <xen:foreach loop="$log" value="$log">
                <xen:listitem id="{$log.log_id}">
                    <xen:label>
                        <span class="secondRow">{$log.user_id}</span>
                    </xen:label>
                </xen:listitem>
            </xen:foreach>
        </ol>
    </div>
</xen:if>
I've going totally clueless about adding columns to display my keywords, user_id, date_time etc. Would really appreciate your help. Thanks!
 

Brogan

XenForo moderator
Staff member
#2
The foreach loop should be the entire array, the value should be one item from the array.
So this would be more likely:
PHP:
<xen:foreach loop="$logs" value="$log">
 

TheBigK

Well-known member
#3
The foreach loop should be the entire array, the value should be one item from the array.
So this would be more likely:
PHP:
<xen:foreach loop="$logs" value="$log">
I've fixed the typo and I'm getting following output -

Screen Shot 2015-11-20 at 5.19.57 PM.png
I'm not sure how do I add the columns?
 

Brogan

XenForo moderator
Staff member
#4
Have a look at the help_smilies template to see how to construct a basic table using foreach.

Otherwise you can use the attachment_list admin template as a guide.
 

TheBigK

Well-known member
#5
Otherwise you can use the attachment_list admin template as a guide.
Well, I am actually referring to the attachment_list admin template; but haven't been able to figure out which class goes where. Would really appreciate if someone can break it down to adding columns. That's the only thing that's not making it to my brain.