Zero108 Posted June 9, 2018 Share Posted June 9, 2018 (edited) Пытаюсь сделать пользовательский виджет для приложения Membemap 3.5.0, чтобы в боковой столбик главной страницы сайта выводить карту с маркерами без всяких кнопок и т.п. В самом приложении шаблон вывода карты такой: {{if request.do != 'embed'}} {{if request.clubId > 0 AND $club instanceof \IPS\Member\Club }} {{if settings.clubs and settings.clubs_header == 'full'}} {template="header" app="core" group="clubs" params="$club, \IPS\membermap\Markers\Groups::load( \IPS\membermap\Map::i()->getMemberGroupId() )"} {{endif}} {{endif}} <div class="ipsPageHeader ipsClearfix"> <header class='ipsSpacer_bottom'> <h1 class="ipsType_pageTitle">{lang="frontnavigation_membermap"}</h1> <div class='ipsPos_right ipsResponsive_noFloat'> <ul class="ipsToolList ipsToolList_horizontal ipsClearfix"> {{if $canAdd OR $canEdit}} <li id='membermap_addLocation_wrapper' class='ipsToolList_primaryAction'> <a class="ipsButton ipsButton_medium ipsButton_important ipsButton_fullWidth" href="#" title='' id="membermap_button_addLocation">{lang="membermap_button_addLocation"}</a> </li> <li id='membermap_myLocation_wrapper' class='ipsToolList_primaryAction' style='display:none;'> <a class="ipsButton ipsButton_medium ipsButton_important ipsButton_fullWidth" data-ipsmenu href='#elMyLocationMenu' id='elMyLocationMenu' title=''> {lang="membermap_button_myLocation"} <i class='fa fa-caret-down'></i> </a> <div id='elMyLocationMenu_menu' class='ipsMenu ipsMenu_auto ipsHide'> <ul> <li class="ipsMenu_item" id="membermap_button_editLocation"> <a href="#">{lang="membermap_button_editLocation"}</a> </li> <li class='ipsMenu_sep'><hr></li> <li class="ipsMenu_item" id="elMyLocationMenuGoHome"> <a href="{url='app=membermap&module=membermap&controller=showmap&goHome=1' seoTemplate='membermap'}">{lang="membermap_goHome"}</a> </li> </ul> </div> </li> {{endif}} <li> {{$unapproved = \iPS\membermap\Markers\Groups::getTotalUnapprovedCount();}} <a href="{url='app=membermap&module=markers&controller=groups' seoTemplate='markers'}" title='{lang="membermap_browse_markers"}' class='ipsButton ipsButton_medium ipsButton_fullWidth ipsButton_link'> <i class="icon-newspaper"></i> {lang="membermap_browse_markers"} {{if $unapproved > 0}} <strong class='ipsType_warning ipsType_medium'><i class='fa fa-warning'></i> {$unapproved}</strong>{{endif}} </a> </li> {{if \IPS\Member::loggedIn()->isAdmin()}} <li class='ipsToolList_primaryAction ipsResponsive_hidePhone'> <a href='#elToolsMenu' id='elToolsMenu' data-ipsmenu class='ipsButton ipsButton_normal ipsButton_link'> {lang="membermap_adminTools"} <i class='fa fa-caret-down'></i> </a> <div id='elToolsMenu_menu' class='ipsMenu ipsMenu_auto ipsHide'> <ul> <li class="ipsMenu_item" id='elToolsMenuBrowserCache'> <a href="{url='app=membermap&module=membermap&controller=showmap&dropBrowserCache=1' seoTemplate='membermap'}">{lang="membermap_rebuildBrowserCache"} <time></time></a> </li> <li class="ipsMenu_item" > <a href="{url='app=membermap&module=membermap&controller=showmap&rebuildCache=1' seoTemplate='membermap'}" data-action='ipsMenu_ping'> {{if $cacheTime > 0}} {lang="membermap_rebuildServerCache" htmlsprintf="\IPS\DateTime::ts( $cacheTime )->html( true, true )"} {{else}} {lang="membermap_rebuildServerCache_notSet"} {{endif}} </a> </li> </ul> </div> </li> {{endif}} </ul> </div> </header> </div> {{endif}} <section> <div id='membermapWrapper'> <div id="mapWrapper" class='ipsLayout_content clearfix'> <div id='mapCanvas'></div> </div> </div> <div class='ipsPad_top' id="membermap_counter"> <p>{lang="membermap_showing_markers"}</p> </div> </section> <div id='mapMarkers' class='ipsHide' data-markers='{expression="json_encode( $markers )"}'></div> Что нужно взять из этого шаблона для того, чтобы виджет заработал? Как изменить код? Для создания виджета используя плагин Advanced Custom Widgets 1.0.2, в котором поле вставки кода может быть в режиме TXT и HTML. Edited June 9, 2018 by Zero108 Link to comment Share on other sites More sharing options...
newbie Posted June 9, 2018 Share Posted June 9, 2018 Для создания виджета используя плагин Advanced Custom Widgets 1.0.2, в котором поле вставки кода может быть в режиме TXT и HTML. Что нужно взять из этого шаблона для того, чтобы виджет заработал?По сути <section> <div id='membermapWrapper'> <div id="mapWrapper" class='ipsLayout_content clearfix'> <div id='mapCanvas'></div> </div> </div> <div class='ipsPad_top' id="membermap_counter"> <p>{lang="membermap_showing_markers"}</p> </div> </section> <div id='mapMarkers' class='ipsHide' data-markers='{expression="json_encode( $markers )"}'></div>Можете вообще использовать iframe с адресом https://www.a108.net/holy_places/?do=embed, чтобы подключались все нужные js-скрипты Link to comment Share on other sites More sharing options...
Zero108 Posted June 9, 2018 Author Share Posted June 9, 2018 (edited) Спасибо за ответ. Я не совсем понимаю, что делать. Я вставил выделенный код как html. Он не заработал. Iframe попробовал - добавляется полоса прокрутки и border. Посмотрю, можно ли побороть с помощью css. Дивом вставить по простому нельзя? Нужно смотреть, каких js не хватает? Edited June 9, 2018 by Zero108 Link to comment Share on other sites More sharing options...
Zero108 Posted June 9, 2018 Author Share Posted June 9, 2018 С ифреймом много возни с css: не получается убрать рамку у ифрейма (border) и отступ сверху. Link to comment Share on other sites More sharing options...
newbie Posted June 9, 2018 Share Posted June 9, 2018 1 Link to comment Share on other sites More sharing options...
Zero108 Posted June 9, 2018 Author Share Posted June 9, 2018 Спасибо. Вроде встало на место. Link to comment Share on other sites More sharing options...
Zero108 Posted June 9, 2018 Author Share Posted June 9, 2018 (edited) А как в виджете выше добавить заголовок такого вида, чтобы он работал? <h3 class="ipsWidget_title ipsType_reset">{lang="frontnavigation_membermap"}</h3> Простой вставкой в HTML редакторе не работает. Edited June 9, 2018 by Zero108 Link to comment Share on other sites More sharing options...
newbie Posted June 10, 2018 Share Posted June 10, 2018 Простой вставкой в HTML редакторе не работает.Значит не поддерживается / не обрабатываются подобные теги. Link to comment Share on other sites More sharing options...
Zero108 Posted June 10, 2018 Author Share Posted June 10, 2018 (edited) Через Pages - Блоки научился делать. Будут ковырять css. Edited June 10, 2018 by Zero108 Link to comment Share on other sites More sharing options...
newbie Posted June 10, 2018 Share Posted June 10, 2018 А есть ли какой-то способ вывести языковую строку в виджете? Например, какой-то php скрипт или набор команд, которые будут обрабатываться в html режиме редактора?Только просить автора. Но я так и не понял, как кастомные блоки, созданные в Pages, можно применять в качестве виджетов. В списке виджетов выбираете "Custom Blocks (Select one of the custom blocks you have created)" и добавляете, например, в сайдбар.В конфигурации выбираете из выпадающего списка созданный блок. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now