Пример #1
0
function get_description($ChannelID)
{
    $seo = YdCache::readSeo();
    if (!is_numeric($ChannelID)) {
        return $seo['DESCRIPTION'];
    }
    $m = D('Admin/Channel');
    while (true) {
        //$data = $m->where("ChannelID=$ChannelID")->getField('Description,Parent');
        $data = $m->field('Description,Parent')->find($ChannelID);
        if (!empty($data['Description'])) {
            return $data['Description'];
        }
        if ($data['Parent'] == 0) {
            return $seo['DESCRIPTION'];
        }
        $ChannelID = $data['Parent'];
    }
}