Skip to content

Instantly share code, notes, and snippets.

View sashabeep's full-sized avatar

Sasha Beep sashabeep

View GitHub Profile
@Dmi3yy
Dmi3yy / evo3sitecontentmodelru.md
Last active December 28, 2024 10:42
Evo 3 SiteContent Model - RU

Работа с Деревом документов через SiteContent

Вступление

Для начала рекомендую ознакомиться с документацией по Eloquent на сайте Laravel https://laravel.com/docs/6.x/queries так как в Evo логика работы с базой такая же, это не только удобно но еще и дает возможность находить информацию что и как сделать не только в рамках Evolution CMS.

Работа с дополнительными полями (TV)

Спасибо Webber за DLSiteContent, https://github.com/webber12/DLSiteContent основные методы работы с TV так же интегрированны в ядро.

It's possible to some extent but won't be really accurate, the idea is load image with a known file size then in its onload event measure how much time passed until that event was triggered, and divide this time in the image file size.

Example can be found here: https://stackoverflow.com/questions/4583395/calculate-speed-using-javascript

Test case applying the fix suggested there:

@Padilo300
Padilo300 / JS saveUtm
Last active December 25, 2023 08:28
Save utm
function saveUtm(){
let params = (new URL(document.location)).searchParams;
if(params.get('utm_source') !== null){
document.cookie = "utm_source="+params.get('utm_source');
}
if(params.get('utm_campaign') !== null){
document.cookie = "utm_campaign="+params.get('utm_campaign');
}
@hqkqn
hqkqn / fancybox-v3-5-customized-layout.markdown
Created February 17, 2020 11:48
fancyBox v3.5 - Customized layout
@dzhuryn
dzhuryn / ssh_шпаргалка.md
Last active February 18, 2024 19:11
linux_command.md

Работа из папками и файлами

Вывод списка папок и файлов из их владеьцами

ls -l 

Размер попдопок в папке assets

@Dmi3yy
Dmi3yy / NewsController.php
Created November 6, 2019 11:30
NewsController
<?php
namespace EvolutionCMS\Odkb\Controllers;
class NewsController extends BaseController {
public function render() {
$this->data['newsmenu'] = json_decode($this->evo->runSnippet('DLMenu', ['parents' => 69, 'maxDepth' => 1, 'api' => 1]), true)[0];
$this->data['newsitems'] = $this->DocLister([
'depth'=>2,
@0test
0test / gist:2c897070bb07cab08b50c2aafe6631b8
Created August 28, 2019 09:24
Prepare editDocs and set multitv values
<?php
$process = isset($process) ? $process : '';
$mode = isset($mode) ? $mode : '';
switch ($process) {
case 'import':
//обработчик импорта
switch ($mode) {
case 'upd':
//обновляем ресурс
$data['img'] = 'assets/images/products/' . $data['art'] . '/' . $data['art'] . '.jpg';
<?php
class FastResource
{
protected $fields = array();
protected $tvs = array();
protected $tvIds = array();
protected $tvtpl = array();
protected $tvDefaults = array();
protected $modx = null;
public $newDoc = true;
@64j
64j / switch
Last active January 24, 2022 20:24
Snippet switch
<?php
$switch = !empty($switch) ? $switch : '';
$default = !empty($default) ? $default : '';
$out = '';
if (!empty($params)) {
$out = $default;
foreach($params as $k => $v) {
$value = mb_substr($k, 5);
if (mb_substr($k, 0, 5) === 'case:' && $value === $switch) {
$out = $v;
@Pathologic
Pathologic / GroupByLetter.php
Created December 14, 2017 19:17
Группировка документов по букве
<?php
/* Пример вызова:
[!GroupByLetter?
&parents=`24`
&depth=`3`
&showParent=`0`
&tpl=`@CODE:<a href="[+url+]">[+pagetitle+]</a><br>`
&wrapTpl=`@CODE:<h1>[+letter+]</h1>[+wrap+]`
&ownerTPL=`@CODE:[+dl.wrap+]`
!]