[TYPO3-dev] parsing TSconfig in BE-module?

Jigal van Hemert jigal.van.hemert at typo3.org
Fri Mar 7 22:00:51 CET 2014


Hi,

On 7-3-2014 13:22, bernd wilke wrote:
> Am 07.03.14 11:05, schrieb Jigal van Hemert:
>> Did something similar a long time ago and simply used a page type to
>> have output which was suitable as basis for the export (no menu,
>> etcetera). Just called the frontend with that page type and processed
>> the output before adding it to the export.
>
> That would be possible, but as I export the page in the context of the
> page itself it would be very difficult to render complete different
> content for a pagetype which only delivers the urls of export-pages
>
> for a first iteration with an external tool I did something like this. I
> created pages with google-sitemaps of subtrees, including a
> pseudo-subtree for the newspages. but that is on a complete different
> subtree.
> now the export is initiated in the BE at the page itself.

I mentioned the page type because I needed the content of pages and not 
all the extra stuff such as header, menu, footer, etcetera but it's not 
something that is required.
The export I made was also initiated in the BE by selecting the root of 
the export in the pagetree and a few extra settings in the BE module. 
The code of the module would create a list of page and call the frontend 
for each page.

>>> Now I want to export some pages where for example news are displayed. so
>>> I don't want a hardcoded configuration I thought about a possibility to
>>> configure the export of variants of a page with additional
>>> url-parameters which could be retrieved by looking up record-uids from
>>> another page - or a combination. on other pages I need other record-uids
>>> to vary the page content.
>>> my attempt was to use page TSconfig to build up a list of uids/ URLs
>>> which can be configured in the page where the plugins are located.
>>
>> You can easily use page TSconfig to build a list with table, pid for the
>> records and the single view pid/url (maybe with a marker to insert the
>> uid of the record). Use the same method of calling the frontend with a
>> page type to have suitable output.
>
> I think I don't get it.
> can you be more specific? an example?

You can have page TSconfig such as:

mod.web_txexportsiteM1 {
         type = 98
         relPathPrefix = http://www.domain.ext/
}

In your code you retrieve the setting:
$this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 
'mod.web_txexportsiteM1');
$this->type = intval($this->modTSconfig['properties']['type']);

(Not that you need to use the 'type' setting, just a code example)

$domainName = 
t3lib_BEfunc::firstDomainRecord(t3lib_BEfunc::BEgetRootLine($this->id));
$url = 'http://' . $domainName . '/index.php?id=' . $this->id . '&type=' 
. $this->type;
$content = file_get_contents($url);

To retrieve a page from the frontend.

You can do similar things (settings and retrieving page content) when 
you pass uid's of records using the right URL formats.

-- 
Jigal van Hemert
TYPO3 CMS Active Contributor

TYPO3 .... inspiring people to share!
Get involved: typo3.org



More information about the TYPO3-dev mailing list