Processwire shortcodes

Основна CMS,CMF IT processwire 370

<?=$config->urls->templates?> // лінк на папку шаблона
<?=$config->urls->root?> // лінк на головну сторінку
<title><?=$page->title?></title> // title
<meta name="description" content="<?=$page->summary?>"> // description
<?php
$menu = $modules->get('MarkupMenuBuilder');
$options = array(
	'wrapper_list_type' => 'ul',// ul, ol, nav, div, etc.
	'list_type' => 'li',// li, a, span, etc.
	'menu_css_id' => '',// a CSS ID for the menu
	'menu_css_class' => '',// a CSS Class for the menu
	'submenu_css_class' => '',// CSS Class for sub-menus
	'has_children_class' => '',// CSS Class for any menu item that has children
	'first_class'=>'',// CSS Class for the first item in
	'last_class' => '',
	'current_class' => '',
	'default_title' => 0,// 0=show saved titles;1=show actual/current titles
	'include_children' => 4, 
// whether to include natural/pw children of menu items in navigation; 
// 0=never;1=in menu only;2=in breadcrumbs only;3=in both;4=do not show
	'm_max_level' => 1,// how deep to fetch 'include_children'
	'current_class_level' => 1,// how high up the ancestral tree to apply 'current_class'
	'default_class' => '',// a CSS class to apply to all menu items
);
// 1062 -- page id!
echo $menu->render(1062, $options);
?>
<?php
$config->useFunctionsAPI = true; 
// опція у конфізі
// дозволяє використовувати розширене АПІ
?>
<?php
echo $pages->get("/settings/")->marker;
// вивід зі шаблонку settings поля marker
?>

додати заміну літер /wire/modules/Inputfield/InputfieldPageName/InputfieldPageName.module:

// і замінити літеру "и"
'и' => 'y',

'ґ' => 'g',
'Ґ' => 'g',
'ї' => 'i',
'Ї' => 'i',
'є' => 'ie',
'Є' => 'ie',
'і' => 'i',
'І' => 'i',
'ь' => '',
'Ь' => '',
<?=$user->language->title?> // виведе назву поточної мови
// свічер (хедер)
$homepage = $pages->get('/'); 

foreach($languages as $language) {
    if(!$page->viewable($language)) continue;
    $url = $page->localHttpUrl($language); 
    $hreflang = $homepage->getLanguageValue($language, 'name'); 

    if($hreflang == 'home'){       
        echo "\t";
        echo '<link rel="alternate" hreflang="uk" href="' . $url . '">';
    } else {
        echo "\n\t";
        echo '<link rel="alternate" hreflang="' . $hreflang . '" href="' . $url . '">';
    }
}
// свічер мови
foreach($languages as $language) {
    if(!$page->viewable($language)) continue;
    $url = $page->localUrl($language);

    if($language->title == 'uk'){
        echo "<a title='українська' href='$url'>укр<span>аїнська</span></a><hr>";
    } else {
        echo "<a title='русский' href='$url'>русс<span>кий</span></a>";
    }
}
// ще простіший свічер

foreach($languages as $language) {
        if(!$page->viewable($language)) continue;
        $class = "$language" == "$user->language" ? "navigation__current" : "";
        $url = $page->localUrl($language);
        echo "<li class='$class'><a title='$language->title' href='$url'>$language->title</a></li>";
    }
// перевірити наявність зображень у галереї
if(count($page->gallery)){
	echo 'true';
} else {
	echo 'false';
}