[TYPO3-UG Dutch] PHP_SCRIPT_EXT in template

Edwin Blokker a.stoutjesdijk at chello.nl
Tue Feb 26 12:45:33 CET 2008


Hoi Ton,

Erg bedankt voor de snelle reactie, maar dit gaat mij echt even boven de 
pet. Ik heb mijn doel gelukkig op een andere manier kunnen bereiken, via 
RSS.

Groeten,
Edwin.


Ton Akveld [netcreators] schreef:
> Hi Edwin,
> 
> Was het leven maar zo eenvoudig...
> 
> Je zult zoiets moeten doen:
> 
> This is a casestory of how to use include-scripts.
> In this situation we would like to use some libraries of our very own, 
> not part of TYPO3. Therefore we use the feature of
> including a library at the very beginning of the page-parsing.
> First we put this TypoScript line in the "Setup"-field of the template:
> config.includeLibrary = fileadmin/scripts/include.inc
> The file include.inc is now included (in 
> typo3/sysext/cms/tslib/pagegen.php). In this case it looks like this:
> file: fileadmin/scripts/include.inc
> <?
> ...
> include("fileadmin/scripts/hello_world.inc");
> include("fileadmin/scripts/other_library.inc");
> ...
> ?>
> As you can see, this file includes our library "hello_world" and some 
> other libraries too!
> The file hello_world.inc looks like this:
> file: fileadmin/scripts/hello_world.inc
> <?
> class hello_world {
> function theMessage () {
> return "Hello World";
> }
> }
> ?>
> So far nothing has happend, except our libraries are included, ready for 
> use.
> Now we need to use the outcome of the hello_world class somewhere on a 
> page. So in the TypoScript code we setup a
> content-object that includes the third script:
> page.100 = PHP_SCRIPT
> page.100.file = fileadmin/scripts/surprise.inc
> surprise.inc looks like this:
> file: fileadmin/scripts/surprise.inc
> <?
> $hello_world_object = new hello_world; // New instance is created
> $contentBefore = $this->cObjGetSingle($conf["cObj"],$conf["cObj."]);
> $content = $contentBefore.$hello_world_object->theMessage();
> $content = $this->stdWrap($content,$conf["stdWrap."]);
> ?>
> Line 1: The PHP-object $hello_world_object is created.
> Line 2: This fetches the content of a cObject, "cObj", we defined
> Line 3: The result of line 2 is concatenated with the result of the 
> "theMessage"-function of the $hello_world_object object
> Line 4: Finally the content is stdWrap'ed with the properties of 
> ".stdWrap" of the $conf-array.
> TSref - 149
> The output:
> With this configuration -
> page.100 = PHP_SCRIPT
> page.100.file = fileadmin/scripts/surprise.inc
> - the output will look like this:
> Hello World
> With this configuration -
> page.100 = PHP_SCRIPT
> page.100 {
> file = fileadmin/scripts/surprise.inc
> cObj = TEXT
> cObj.value = Joe says:&nbsp;
> }
> - the output will look like this:
> Joe says: Hello World
> With this configuration -
> page.100 = PHP_SCRIPT
> page.100 {
> file = fileadmin/scripts/surprise.inc
> cObj = TEXT
> cObj.value = Joe says:&nbsp;
> stdWrap.wrap = <font color="red"> | </font>
> stdWrap.case = upper
> }
> - the output will look like this:
> JOE SAYS: HELLO WORLD
> End of lesson.
> 
> Edwin Blokker schreef:
>> Beste,
>>
>> Ik probeer een php bestand te includen in mijn template, op deze manier:
>>
>> lib.leftcontent = PHP_SCRIPT_EXT
>> lib.leftcontent.file = fileadmin/templates/hello.php
>>
>> Dit doet echter niets in de frontend. Het php bestand bestaat uit 
>> alleen maar <?php echo 'Hello World'; ?>
>>
>> Ik heb hier geen ervaring mee en doe vast iets verkeerd.. Wie kan mij 
>> vertellen wat?
>>
>> Alvast bedankt,
>> Edwin.
>> _______________________________________________
>> TYPO3-UG-dutch mailing list
>> TYPO3-UG-dutch at lists.netfielders.de
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-ug-dutch
>>   


More information about the TYPO3-UG-dutch mailing list