Skip to content

Instantly share code, notes, and snippets.

<?php
/*****************************************************
** Вывод списка заказов пользователей
**
**
****************************************************/
$tpl = $modx->getOption('tpl', $scriptProperties, '');
$pdoTools = $modx->getService('pdoTools');
$pdo = $modx->getService('pdoFetch');
@srsad
srsad / schema.tpl
Created August 4, 2017 13:15
pdoCrumbs по стандарту микроразметок schema.org
{'pdoCrumbs' | snippet : [
'showHome' => 1,
'showHidden' => 0,
'tpl' => '@INLINE <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a href="{{+link}}" itemscope itemtype="http://schema.org/Thing" itemprop="item">
<span itemprop="name">{{+menutitle}}</span>
</a>
<meta itemprop="position" content="{{+idx}}" />
</li>',
'tplCurrent' => '@INLINE <li class="active" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
//<div id="google-maps"><div class="google-maps"></div></div>
$(window).load(function() {
$(".google-maps").gmap3({
marker:{
address:"23, Mornington Crescent, London",options:{icon: "img/marker.png"}},
map:{
options:{
zoom: 14,
scrollwheel: false,
mapTypeControl: false,
@srsad
srsad / yourCity.php
Last active December 22, 2017 10:12
<?php
// определение ip
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip=$_SERVER['HTTP_CLIENT_IP'];
}elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
$ip=$_SERVER['REMOTE_ADDR'];
}
// https://dadata.ru/
@srsad
srsad / select`ы
Created December 6, 2017 09:43
Отцентровка выборного элемента в select
<style>
select {
text-align: center;
text-align-last: center;
}
option {
text-align: left;
}
</style>
<select name="number-of-default" aria-invalid="false">
Ext.onReady(function() {
MODx.Ajax.request({
url: Component.config.connector_url,
params: {
action: 'mgr/getlist',
},
listeners: {
success: {fn:function(r) {
console.log(r);
} }
// православный способ обработки "Fatal error: Call to a member function ..."
$res = $modx->getObject('className', 5);
if (is_object($res) && $res->get('id')) {
echo '1';
} else {
echo '0';
}
// lg
@media screen and (max-width: 1199px)
.catalogItem
height: 210px
margin-bottom: 20px
// md
@media screen and (max-width: 991px)
.catalogItem
height: 155px
{'pdoCrumbs' | snippet : [
'showHome' => 1,
'tpl'=> '@INLINE <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a href="{{+link}}" itemscope itemtype="http://schema.org/Thing" itemprop="item">
<span itemprop="name">{{+menutitle}}</span>
</a>
<meta itemprop="position" content="{{+idx}}" />
</li>',
'tplCurrent' => '@INLINE <li class="breadcrumb-item active" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<span itemscope itemtype="http://schema.org/Thing" itemprop="item">
<?php
$gallery = array(
'id' => $rid,
'name' => '',
'rank' => 0,
'file' => MODX_BASE_PATH.$arr[7]
);
$upload = $modx->runProcessor('gallery/upload', $gallery, array(
'processors_path' => MODX_CORE_PATH.'components/minishop2/processors/mgr/'
));