p006/api/soft/smarty/3.1.39/libs/plugins/modifier.pagecat.php

43 lines
1020 B
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Smarty plugin
*
* @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty replace modifier plugin
* Type: modifier<br>
* Name: replace<br>
* Purpose: simple search/replace
*
* @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @author Uwe Tews
*
* @param string $string input string
* @param string $search text to search for
* @param string $replace replacement text
*
* @return string
*/
function smarty_modifier_pagecat($string)
{
require_once MYDIR . '/set/conf.php'; //цепляем конфиги
require_once MYDIR . '/api/php/mysql7.php'; //вызываем апи для работы с мускулом
global $db;
$db2 = new MySQL;
$db2 -> connect( $set['bd_host'], $set['bd_user'], $set['bd_pass'], $set['bd_name'] );
unset($a);
$a['id']=$string;
$res=$db2->get_val('page_cat', $a, 'txt');
return $res;
}