• REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Add Showcase count to Slider, need a little help

lionhoho

New Member
AMS
SC Premium
Hi,

I'm trying to add Showcase count to the slider but it seems doesn't work. I modified the thumbs to show user name and icon, it works fine but I add the code below
Code:
                <xen:if is="{$user.showcase_count}">
                    <dl class="pairsJustified">
                        <dt>Showcase Items:</dt>
                        <dd><a href="{xen:link 'showcase/member', $user}" class="concealed">{$user.showcase_count}</a></dd>
                    </dl>
                </xen:if>

It doesn't work. I tried rebuild showcase count cache but still the same.

I think I missed something. Can I ask for some help?

Thanks
 
You are using $user when you need to be using $item. The $item array contains all of the "user" data for the owner of that specific item.

Code:
                <xen:if is="{$item.showcase_count}">
                    <dl class="pairsJustified">
                        <dt>Showcase Items:</dt>
                        <dd><a href="{xen:link 'showcase/member', $item}" class="concealed">{$item.showcase_count}</a></dd>
                    </dl>
                </xen:if>
 
You are using $user when you need to be using $item. The $item array contains all of the "user" data for the owner of that specific item.

Code:
                <xen:if is="{$item.showcase_count}">
                    <dl class="pairsJustified">
                        <dt>Showcase Items:</dt>
                        <dd><a href="{xen:link 'showcase/member', $item}" class="concealed">{$item.showcase_count}</a></dd>
                    </dl>
                </xen:if>

Woo! That was SUPER FAST! Thanks a lot!
So I tried
Code:
                <xen:if is="{$item.showcase_count}">
                    <dl class="pairsJustified">
                        <dt>Showcase Items:</dt>
                        <dd><a href="{xen:link 'showcase/member', $item}" class="concealed">{$item.showcase_count}</a></dd>
                    </dl>
                </xen:if>
The number is there but the link doesn't work. I changed to $user just for here to xen:link 'showcase/member', $user but still.
Anything wrong here?

Thank you.
 
There is no $user variable. $variables have to be generated by the specific action with in a specific controller and then passed into the view for use within a template. In the sliders case, the variable $items (Plural) is being passed in which contains ALL the data for ALL the Items for the slider. I loop through the $items array which sets a TEMP array called $item that contains that specific items worth of data, it then outputs its display and the loop generates the next $item and so on until the loop has gone through all of the $items.

As for the LINK, it doesn't even need "user data". This specific route only requires the user_id of the owner of the showcase item (which is always in the $item variable as its part of the item record). Try it without the tick marks.
Code:
{xen:link showcase/member, $item}
 
Back
Top