Dusty Posted January 14 Report Share Posted January 14 Как правильно задать нумерацию в <li class="position_? ipsType_center"> где ? должна быть нумерации 1,2,3,4,5 из которой будет брать код от CSS ? Quote Link to comment Share on other sites More sharing options...
AHristich Posted January 14 Report Share Posted January 14 1 час назад, Dusty сказал: Как правильно задать нумерацию в <li class="position_? ipsType_center"> где ? должна быть нумерации 1,2,3,4,5 из которой будет брать код от CSS ? <li class="position_1 ipsType_center"> <li class="position_2 ipsType_center"> <li class="position_3 ipsType_center"> не,не канает? Или в чем конкретно вопрос? Quote Link to comment Share on other sites More sharing options...
Dusty Posted January 14 Author Report Share Posted January 14 1 час назад, AHristich сказал: <li class="position_1 ipsType_center"> <li class="position_2 ipsType_center"> <li class="position_3 ipsType_center"> не,не канает? Или в чем конкретно вопрос? Суть в том чтоб он брал сам нумерацию 1-5 и добавлял CSS по этой нумерации из топ 5 пользователей которые берутся через <Li> asdasd </li> Quote Link to comment Share on other sites More sharing options...
AHristich Posted January 14 Report Share Posted January 14 (edited) 11 минут назад, Dusty сказал: Суть в том чтоб он брал сам нумерацию 1-5 и добавлял CSS по этой нумерации из топ 5 пользователей которые берутся через <Li> asdasd </li> ну так посмотрите в шаблоне топ-юзеров как выводятся их ID и сделаете без проблем. Либо как вариант, более понятно объяснить что вы хотите,желательно со скринами. Edited January 14 by AHristich Quote Link to comment Share on other sites More sharing options...
AHristich Posted January 14 Report Share Posted January 14 Кароче,не уверен что правильно вас понял,но... В шаблоне topContributorRows.phtml <li class='ipsDataItem'> заменить на <li class='position_{expression="$idx++"} ipsDataItem'> здесь {expression="$idx++"} это номера 1.2.3.4.5 ну а дальше уже сами .... кстати,не проверял на работоспособность,но должно проканать... забыл сказать ,что в css надо добавить классы .position_НОМЕР Dusty 1 Quote Link to comment Share on other sites More sharing options...
Dusty Posted January 14 Author Report Share Posted January 14 9 часов назад, AHristich сказал: Кароче,не уверен что правильно вас понял,но... В шаблоне topContributorRows.phtml <li class='ipsDataItem'> заменить на <li class='position_{expression="$idx++"} ipsDataItem'> здесь {expression="$idx++"} это номера 1.2.3.4.5 ну а дальше уже сами .... кстати,не проверял на работоспособность,но должно проканать... забыл сказать ,что в css надо добавить классы .position_НОМЕР Да оно но он почему то 1 пропускает как postion_ а потом идет нумерация Спойлер Quote Link to comment Share on other sites More sharing options...
Desti Posted January 14 Report Share Posted January 14 Видимо $idx надо определить выше - {{$idx=1;}} Quote Link to comment Share on other sites More sharing options...
Dusty Posted January 14 Author Report Share Posted January 14 16 минут назад, Desti сказал: Видимо $idx надо определить выше - {{$idx=1;}} Так выходит все будут под 1 Quote Link to comment Share on other sites More sharing options...
Desti Posted January 15 Report Share Posted January 15 Почему? Сначала определяем переменную, потом увеличиваем ее значение. На каждый вызов {expression="$idx++"} к значению будет прибавляться единица. А то, что у вас переменная не определена (плюс идиотизм разработчиков ips, которые не отслеживают такие ошибки в шаблонах в обычном режиме работы ) и дает вам первую пустую строку. Вот как должен выглядеть шаблон (в общем виде): {{$idx=1;}} <ul> <li class="position_{expression="$idx++"}">1</li> <li class="position_{expression="$idx++"}">2</li> <li class="position_{expression="$idx++"}">3</li> </ul> Можно без вреда для результата заменить {expression="$idx++"} на {$idx++}, работает так же. Dusty 1 Quote Link to comment Share on other sites More sharing options...
AHristich Posted January 15 Report Share Posted January 15 Desti {{$idx=1;}} уже есть в шаблоне. полный код вывода в шаблоне <ol class='ipsDataList ipsDataList_reducedSpacing cTopContributors'> {{$idx = 1;}} {{foreach $results as $memberId => $rep}} {{$member = \IPS\Member::load( $memberId );}} <li class='ipsDataItem'> <div class='ipsDataItem_icon ipsPos_middle ipsType_center ipsType_large ipsType_light'><strong>{expression="$idx++"}</strong></div> <div class='ipsDataItem_main ipsPhotoPanel ipsPhotoPanel_tiny'> {template="userPhoto" app="core" group="global" params="$member, 'tiny'"} <div> {$member->link()|raw} <br> {{if member.group['gbw_view_reps']}} <a href='{url="app=core&module=members&controller=profile&id={$member->member_id}&do=reputation" seoTemplate="profile_reputation" seoTitle="$member->members_seo_name"}' title="{lang="reputation_badge_tooltip_period"}" data-ipsTooltip class='ipsRepBadge {{if $rep > 0}}ipsRepBadge_positive{{elseif $rep < 0}}ipsRepBadge_negative{{else}}ipsRepBadge_neutral{{endif}}'><i class='fa {{if $rep > 0}}fa-plus-circle{{elseif $rep < 0}}fa-minus-circle{{else}}fa-circle-o{{endif}}'></i> {expression="\IPS\Member::loggedIn()->language()->formatNumber( $rep )"}</a> {{else}} <span title="{lang="reputation_badge_tooltip_period"}" data-ipsTooltip class='ipsRepBadge {{if $rep > 0}}ipsRepBadge_positive{{elseif $rep < 0}}ipsRepBadge_negative{{else}}ipsRepBadge_neutral{{endif}}'><i class='fa {{if $rep > 0}}fa-plus-circle{{elseif $rep < 0}}fa-minus-circle{{else}}fa-circle-o{{endif}}'></i> {expression="\IPS\Member::loggedIn()->language()->formatNumber( $rep )"}</span> {{endif}} </div> </div> </li> {{endforeach}} </ol> здесь код вывода номеров юзеров <div class='ipsDataItem_icon ipsPos_middle ipsType_center ipsType_large ipsType_light'><strong>{expression="$idx++"}</strong></div> соответственно я и предложил вариант <li class='position_{expression="$idx++"} ipsDataItem'> Dusty 1 Quote Link to comment Share on other sites More sharing options...
AHristich Posted January 15 Report Share Posted January 15 поэтому должно работать нормально.В крайнем случае,я бы попробывал не в class запихнуть position_{expression="$idx++"} а в id,т.е <li id='position_{expression="$idx++"}' class='ipsDataItem'> Quote Link to comment Share on other sites More sharing options...
Dusty Posted January 15 Author Report Share Posted January 15 3 часа назад, AHristich сказал: Desti {{$idx=1;}} уже есть в шаблоне. полный код вывода в шаблоне <ol class='ipsDataList ipsDataList_reducedSpacing cTopContributors'> {{$idx = 1;}} {{foreach $results as $memberId => $rep}} {{$member = \IPS\Member::load( $memberId );}} <li class='ipsDataItem'> <div class='ipsDataItem_icon ipsPos_middle ipsType_center ipsType_large ipsType_light'><strong>{expression="$idx++"}</strong></div> <div class='ipsDataItem_main ipsPhotoPanel ipsPhotoPanel_tiny'> {template="userPhoto" app="core" group="global" params="$member, 'tiny'"} <div> {$member->link()|raw} <br> {{if member.group['gbw_view_reps']}} <a href='{url="app=core&module=members&controller=profile&id={$member->member_id}&do=reputation" seoTemplate="profile_reputation" seoTitle="$member->members_seo_name"}' title="{lang="reputation_badge_tooltip_period"}" data-ipsTooltip class='ipsRepBadge {{if $rep > 0}}ipsRepBadge_positive{{elseif $rep < 0}}ipsRepBadge_negative{{else}}ipsRepBadge_neutral{{endif}}'><i class='fa {{if $rep > 0}}fa-plus-circle{{elseif $rep < 0}}fa-minus-circle{{else}}fa-circle-o{{endif}}'></i> {expression="\IPS\Member::loggedIn()->language()->formatNumber( $rep )"}</a> {{else}} <span title="{lang="reputation_badge_tooltip_period"}" data-ipsTooltip class='ipsRepBadge {{if $rep > 0}}ipsRepBadge_positive{{elseif $rep < 0}}ipsRepBadge_negative{{else}}ipsRepBadge_neutral{{endif}}'><i class='fa {{if $rep > 0}}fa-plus-circle{{elseif $rep < 0}}fa-minus-circle{{else}}fa-circle-o{{endif}}'></i> {expression="\IPS\Member::loggedIn()->language()->formatNumber( $rep )"}</span> {{endif}} </div> </div> </li> {{endforeach}} </ol> здесь код вывода номеров юзеров <div class='ipsDataItem_icon ipsPos_middle ipsType_center ipsType_large ipsType_light'><strong>{expression="$idx++"}</strong></div> соответственно я и предложил вариант <li class='position_{expression="$idx++"} ipsDataItem'> Я делал это для чата от плагина топ 5 юзеров чата ) Вот сам код Спойлер {{$rows = \IPS\Application::wkACS();}} <div class='wkACS_general ipsAreaBackground_light ipsPad_half ipsType_center'> {{if !$rows['statsMorePermissions']}}<a data-ipsdialog="" data-ipsdialog-forcereload="" data-ipsdialog-url="{$rows['statsMembersMore']}" data-ipsdialog-size="medium" data-ipsdialog-title="{lang="wkACS_statsMoreDialog"}" data-ipstooltip="" _title="{lang="wkACS_statsMoreDialog"}">{{endif}} {lang="wkACS_UserTotalEntries" sprintf="\IPS\Member::loggedIn()->language()->pluralize(\IPS\Member::loggedIn()->language()->get('wkACS_UserEntries2'), [ $rows['total'] ])"}{lang="wkACS_UserTotalEntriesToday" pluralize="$rows['today']"} {{if member.member_id}}<sup>({lang="wkACS_UserMyEntries" sprintf="$rows['my']"})</sup>{{endif}} {{if !$rows['statsMorePermissions']}}</a>{{endif}} <div class="itv-chatbox--stats"> <ul class="ipsList_inline"> {{foreach $rows['statsMembers'] as $k => $row}} {{$member = \IPS\Member::load( $row['user'] );}} <li class='itv-chatbox--row itv-chatbox--position_{expression="$idx++"} ipsType_center'> <div class='ipsDataItem_main ipsPhotoPanel ipsPhotoPanel_tiny wkACS_ipsGrid'> {template="userPhoto" app="core" group="global" params="$member, 'tiny'"} <div> {$member->link()|raw} {{if settings.wkACS_statusOnline}} {{if ( $member->isOnline() AND !$member->isOnlineAnonymously() ) OR ( $member->isOnlineAnonymously() AND \IPS\Member::loggedIn()->isAdmin() )}} <span class='ipsType_small ipsType_light'><i class='fa fa-circle {{if $member->isOnlineAnonymously()}}ipsOnlineStatus_anonymous{{else}}ipsOnlineStatus_online{{endif}}' data-ipsTooltip title='{{if $member->isOnlineAnonymously()}}{lang="online_now_anon" sprintf="$member->name"}{{else}}{lang="online_now" sprintf="$member->name"}{{endif}}'></i></span> {{else}} <span class='ipsType_small ipsType_light'><i class='fa fa-circle ipsOnlineStatus_offline' data-ipsTooltip title='{lang="wkACS_UserOffline" sprintf="$member->name"}'></i></span> {{endif}} {{endif}} <p class='wkACS_memberCount'> <a data-ipstooltip='' _title='{lang="wkACS_statsMoreInfo"}' id="wkACS-{$row['user']}" data-ipsmenu=''> {{if settings.wkACS_trophy && $k < 3}} <i class='fa fa-trophy'></i> {{endif}} <span class='ipsType_large'>{number="$row['count']"}</span> <span class='ipsType_small ipsType_light'>{lang="wkACS_UserEntries" pluralize="$row['count']"}</span> </a> </p> </div> </div> </li> {{endforeach}} </ol> </div> Quote Link to comment Share on other sites More sharing options...
AHristich Posted January 15 Report Share Posted January 15 Dusty так все-таки получилось или нет? Quote Link to comment Share on other sites More sharing options...
Dusty Posted January 15 Author Report Share Posted January 15 Все помогло Добавил его перед <ul> и все стало нормально работать) {{$idx=1;}} 1 минуту назад, AHristich сказал: Dusty так все-таки получилось или нет? Получилось Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.