<?php // $Id$ /* * This file is internal part of Core CMS (http://core-cms.com/) engine. * * Copyright (C) 2004-2005 Core Dev Team (more info: docs/AUTHORS). * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; version 2 only. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ $query = sprintf("\n SELECT\n category_id, \n category_parent_id, \n category_name\n FROM \n %1\$s \n WHERE \n category_parent_id = '0' \n ORDER BY \n category_order \n ASC", TABLE_CATEGORY); $db->query($query); while ($db->next_record()) { $cat_id = $db->f("category_id"); $cat_parent_id = $db->f("category_parent_id"); $cat_name = $db->f("category_name"); $ft->assign(array('CAT_NAME' => replace_amp($cat_name), 'CAT_LINK' => $CoreRewrite->category_news($cat_id, $rewrite), 'CLASS' => "cat_parent", 'PARENT' => '')); $ft->define_dynamic("category_row", $assigned_tpl); $ft->parse('CATEGORY_ROW', ".category_row"); // funkcja pobieraj±ca rekurencyjnie strony dziedzicz±ce::child $tree->get_category_cat($cat_id, 2); }
// $Id$ /* * This file is internal part of Core CMS (http://core-cms.com/) engine. * * Copyright (C) 2004-2005 Core Dev Team (more info: docs/AUTHORS). * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; version 2 only. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ $query = sprintf("\n SELECT \n title, url \n FROM \n %1\$s \n ORDER BY \n link_order \n ASC", TABLE_LINKS); $db->query($query); if ($db->num_rows() > 0) { while ($db->next_record()) { $link_name = $db->f("title"); $link_url = replace_amp($db->f("url")); $ft->assign(array('LINK_NAME' => $link_name, 'LINK_URL' => $link_url)); $ft->define_dynamic("links_row", $assigned_tpl); $ft->parse('LINKS_ROW', ".links_row"); } } else { // swiadomie deklarowana pusta zmienna potrzebna // instrukcji warunkowej do przejscia do odpowiedniego miejsca szablonu $ft->assign('LINK_NAME', ''); }
function list_assigned_categories($id) { global $ft, $rewrite; $query = sprintf("\r\n SELECT \r\n a.*, b.* \r\n FROM \r\n %1\$s a \r\n LEFT JOIN \r\n %2\$s b \r\n ON \r\n a.category_id = b.category_id \r\n WHERE \r\n a.news_id = '%3\$d'", TABLE_ASSIGN2CAT, TABLE_CATEGORY, $id); $sql = new DB_SQL(); $sql->query($query); $count_cats = $sql->nf(); $idx = 1; while ($sql->next_record()) { $cname = replace_amp($sql->f('category_name')); $cid = $sql->f('category_id'); $category_link = (bool) $rewrite ? sprintf('1,%s,4,item.html', $cid) : 'index.php?p=4&id=' . $cid; $ft->assign(array('CATEGORY_NAME' => $cname, 'CATEGORY_LINK' => $category_link, 'COMMA' => $count_cats == $idx ? '' : ', ')); $ft->parse('CAT_ROW', ".cat_row"); $idx++; } // CAT_ROW musi byc czyste $ft->clear_parse('CAT_ROW'); }
<?php $query = sprintf("\r\n SELECT\r\n category_id, \r\n category_parent_id, \r\n category_name\r\n FROM \r\n %1\$s \r\n WHERE \r\n category_parent_id = '0' \r\n ORDER BY \r\n category_order \r\n ASC", TABLE_CATEGORY); $db->query($query); while ($db->next_record()) { $cat_id = $db->f("category_id"); $cat_parent_id = $db->f("category_parent_id"); $cat_name = $db->f("category_name"); if ((bool) $rewrite) { $cat_link = '1,' . $cat_id . ',4,item.html'; } else { $cat_link = 'index.php?p=4&id=' . $cat_id . ''; } $ft->assign(array('CAT_NAME' => replace_amp($cat_name), 'CAT_LINK' => $cat_link, 'CLASS' => "cat_parent", 'PARENT' => '')); $ft->define_dynamic("category_row", $assigned_tpl); $ft->parse('CATEGORY_ROW', ".category_row"); // funkcja pobieraj±ca rekurencyjnie strony dziedzicz±ce::child get_category_cat($cat_id, 2); }
function list_assigned_categories($id) { global $ft, $rewrite, $CoreRewrite; $query = sprintf("\n SELECT \n a.*, b.* \n FROM \n %1\$s a \n LEFT JOIN \n %2\$s b \n ON \n a.category_id = b.category_id \n WHERE \n a.news_id = '%3\$d'", TABLE_ASSIGN2CAT, TABLE_CATEGORY, $id); $sql = new DB_SQL(); $sql->query($query); $count_cats = $sql->nf(); $idx = 1; while ($sql->next_record()) { $cname = replace_amp($sql->f('category_name')); $cid = $sql->f('category_id'); $ft->assign(array('CATEGORY_NAME' => $cname, 'CATEGORY_LINK' => $CoreRewrite->category_news($cid, $rewrite), 'COMMA' => $count_cats == $idx ? '' : ', ')); $ft->parse('CAT_ROW', ".cat_row"); $idx++; } // CAT_ROW musi byc czyste $ft->clear_parse('CAT_ROW'); }