This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// сниппет отдает поле pagetitle текущей страницы. | |
// Если в адресе передан параметр lang, то выбирается соответствующий языковой TV из ресурса (nameRus, nameEng) | |
if (isset($_GET['lang'])) { | |
$lang= $modx->sanitizeString($_GET['lang']); | |
return $lang; | |
} | |
// Ниже строки просто как шпаргалка, к делу не относится! | |
$tv = $modx->getObject('modTemplateVar',array('name'=>'nameRus')); | |
$val = $tv->renderOutput($modx->resource->get('id')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// сниппет отдает поле pagetitle текущей страницы. | |
// Если в адресе передан параметр lang, то выбирается соответствующий языковой TV из ресурса (nameRus, nameEng) | |
if (isset($_GET['lang'])) { | |
$lang= $modx->sanitizeString($_GET['lang']); | |
switch ($lang) { | |
case 'rus': | |
$tv = $modx->getObject('modTemplateVar',array('name'=>'nameRus')); | |
$val = $tv->renderOutput($modx->resource->get('id')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// сниппет отдает поле pagetitle или nameRus, или nameEng в зависимости от переданного в URL параметра lang | |
// id ресурса тоже передается в качестве параметра | |
// пример вызова сниппета с парметрами: [[!getMenuItem? &resource_id=`20`]] | |
$field=''; | |
if (isset($_GET['lang'])) { | |
$lang= $modx->sanitizeString($_GET['lang']); | |
switch ($lang) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return $modx->runSnippet('pdoMenu',array('parents'=>0,'where'=>'{"id":"9"}')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// сниппет отдает поле pagetitle или nameRus, или nameEng в зависимости от переданного параметра lang | |
// id ресурса тоже передается в качестве параметра | |
// пример вызова [[!getMenuItem?&resource_id=`9`]] | |
$field=''; | |
$tpl='@INLINE <a href="[[!~[[+id]]]]"><span>[[+pagetitle]]<span></a>'; | |
if (isset($_GET['lang'])) { | |
$lang= $modx->sanitizeString($_GET['lang']); | |
switch ($lang) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($){ | |
$.ajax({ | |
type: 'GET', | |
url: '//remote.org/jsonp.php', | |
data: { | |
field: 'value' | |
}, | |
dataType: 'jsonp' | |
crossDomain: true, | |
}).done(function(response){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($){ | |
$.ajax({ | |
type: 'GET', | |
url: 'http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?', | |
data: { | |
tags: "cats", | |
//tagmode: "any", | |
format: "json", | |
//sort: "random" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($){ | |
$.ajax({ | |
type: 'GET', | |
url: 'http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?', | |
data: { | |
tags: "cats", | |
//tagmode: "any", | |
format: "json", | |
//sort: "random" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_RETURNTRANSFER => 1, | |
CURLOPT_URL => 'http://www.google-analytics.com/collect?v=1&tid=[UA-XXXXXXXXX-1]&cid=[RANDOM_INTEGER_OR_GUID]&t=event&ec=[EVENT_CATEGORY]&ea=[EVENT_ACTION]&el=[EVENT_LABEL]', | |
CURLOPT_USERAGENT => 'Vanity-URL-Tracker', | |
)); | |
$resp = curl_exec($curl); | |
curl_close($curl); | |
header("HTTP/1.1 301 Moved Permanently"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$message=''; | |
$formFields=array(); | |
$uploaddir = '/data02**/virt4**5630/domeenid**/www.*****.ee/htdocs/assets/downloads/'; | |
$attachment = $uploaddir . $_FILES['attachment']['name']; | |
move_uploaded_file($_FILES['attachment']['tmp_name'], $attachment); | |
//return $attachment; | |
/* $attachment содержит полный путь, включая имя файла для аттача */ |
OlderNewer