![]() |
Показаны 5 сообщений на этой странице |
Форум сетевых администраторов (http://netadmin.ws/forum/index.php)
- Pmachine & ExpressionEngine (http://netadmin.ws/forum/forumdisplay.php?forumid=78)
-- Вопрос по категориям (http://netadmin.ws/forum/showthread.php?threadid=10705)
Вопрос по категориям
Вот такой вопрос задал человек на ихнем форуме , я думаю тема актуальная для многих :
"If I have a single weblog with multiple categories and subcategories, is there a way for me to limit the nested category list to display only the currently viewed parent category plus subcategories of that category, and ignore all other parent categories? I am displaying weblog entries by category and want to create a simple map of links to related categories (that is, a list of sub-categories belonging to the same parent category)
Or would I be better off to use different weblogs for each parent category?"
А вот что ответил Paul/reedmaniac pMachine Staff :
"Well, really the code already exists in the category_archive function in the mod.weblog.php file. Someone would just have to rewrite the queries, a few bits of PHP, and add a parameter...piece of cake! :-)
I will not be able to write it for you, alas, since I am quite buried right now. Perhaps someone else who is wise to such things will give it a try."
Отсюда просьба к знающим PHP людям : как конкретно это сделать ?
Может быть кто-то сделал уже?
Спасибо заранее.
там же откуда ты этот текст вырезал ЕСТЬ подробный ответ на него: h**p://www.pmachine.com/forum/threads.php?id=21057_0_19_0_C
__________________
RTFM (Уважаемые! Читайте документацию!)
Вот это :"?php if (substr("{segment_3}", 0, 1) == "C")
{
$catid = substr("{segment_3}", 1);
}
?
{exp:query sql="SELECT cat_name, cat_id FROM exp_categories WHERE parent_id = '<?php echo $catid; ?>' ORDER BY cat_name;"}
<a href="http://whatever.com/C{cat_id}" />{cat_name}</a> "
работает , только когда вместо '<?php echo $catid; ?>' вставляешь конкретную категорию , в смысле номер , иначе просто отбражаются все категории всех дневников.
Я небольшой специалист в программировании , мне непонятно что значат в первых строках цифры 0 , 1 .
Не могли бы вы пояснить?
http://ru.php.net/manual/en/function.substr.php
__________________
RTFM (Уважаемые! Читайте документацию!)
Ð_ешение проблемы :
{exp:weblog:category_heading}
{exp:query sql="SELECT exp_categories.cat_id, exp_categories.cat_name, exp_categories.group_id, exp_categories.parent_id, count( exp_category_posts.entry_id ) AS count, exp_categories.parent_id
FROM exp_categories LEFT JOIN exp_category_posts ON exp_categories.cat_id = exp_category_posts.cat_id
GROUP BY exp_categories.cat_name, exp_categories.group_id, exp_categories.parent_id
HAVING (((exp_categories.parent_id)='{category_id}'))
ORDER BY cat_order;"}
<li><a href="{path=weblog/index}C{cat_id}/">{cat_name} </a></li>
{/exp:query}
{/exp:weblog:category_heading}
| Формат времени GMT. Текущее время 22:25. | Показаны 5 сообщений на этой странице |
Powered by: vBulletin Version 2.2.4
Copyright © Jelsoft Enterprises Limited 2000, 2001.