Russian TYPO3 community

Russian TYPO3 community (http://forum.typo3.ru/index.php)
-   TypoScript практикум (http://forum.typo3.ru/forumdisplay.php?f=27)
-   -   как выбрать параметры с конфигурации? (http://forum.typo3.ru/showthread.php?t=2729)

EugeneM 22.02.2007 21:05

как выбрать параметры с конфигурации?
 
для модуля в админке нужно вытянуть некоторые параметры из файла конфигурации setup.txt (от другого модуля).

как это можно сделать с меньшими потерями?

void 23.02.2007 00:16

Что имеется в виду? Модуль = be-модуль или fe-плагин?
setup.txt что содержит? TS? или TSConfig?

EugeneM 23.02.2007 13:16

Из модуля tt_products вытянуть коды статусов.
Содержимое setup.txt.

plugin.tt_products {
...

statusCodes {
# 1: Incoming orders
1 = Order submitted by user
# 2-49: Useable by the shop admin
2 = Order is received and accepted by store
10 = Shop is awaiting goods from third-party
11 = Shop is awaiting customer payment
12 = Shop is awaiting material from customer
13 = Order has been payed
20 = Goods shipped to customer
21 = Gift certificates shipped to customer
30 = Other message from store
# 50-99: Useable by the customer
# 50-59: General user messages
50 = Customer request for cancelling
51 = Message from customer to shop
# 60-69: Special user messages
60 = Send gift certificate message to receiver
# 100-299 : Order finalized.
100 = Order shipped and closed
101 = Order closed
200 = Order cancelled
}

...

}

подозреваю, что должна быть функция отвечающая за чтение инфы и создание массива на PHP. вот её и ищу.

void 23.02.2007 13:37

Если вытащить нужно для другого фронтэнд-плагина, то нет ничего проще:
$GLOBALS['TSFE']->tmpl->setup['plugin.']['tt_products']['statusCodes'];

Если же разговор идёт о бекенде, то тут всё гораздо сложнее... Чтобы получить php-массив, нужно инициализировать чуть ли не весь фронтэнд.
К тому же результирующий массив будет разным для страниц с разным id...
В общем, не совсем тривиальная задача.

EugeneM 23.02.2007 13:44

В общем-то это для backend и нужно. :D

void 23.02.2007 18:48

PHP код:

$template t3lib_div::makeInstance('t3lib_tsparser_ext');
$template->tt_track 0
$template->init();
$sys_page t3lib_div::makeInstance('t3lib_pageSelect');
$rootLine $sys_page->getRootLine($pid);//тут нужно найти правильный $pid.
$template->runThroughTemplates($rootLine);
$template->generateConfig(); 

Потом обращаться через $template->setup. С вас пиво ;)

EugeneM 07.03.2007 19:55

Цитата:

Сообщение от void (Сообщение 9982)
Потом обращаться через $template->setup. С вас пиво ;)

Буду в Пензе угощу. ;)

есть еще вопрос по tt_products: http://forum.typo3.biz/showthread.php?t=2812


Часовой пояс GMT +4, время: 16:33.

Работает на vBulletin® версия 3.8.1.
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Перевод: zCarot