DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: PHP-based Data Display (Data Consumer)

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed:2012-06-26T14:05:23
Classification:phpdisplay
Description:The keywords help with categorizing and tagging of the manuals. You can combine two or more keywords and add additional keywords yourself. Please use at least one keyword from both lists. If your manual is NOT in english, see next tab "language" ---- forEditors (use this for editors / german "Redakteure") forAdmins (use this for Administrators) forDevelopers (use this for Developers) forBeginners (manuals covering TYPO3 basics) forIntermediates (manuals going into more depth) forAdvanced (covering the most advanced TYPO3 topics) see more: http://wiki.typo3.org/doc_template#tags ----
Keywords:forAdmins, forIntermediates, tesseract
Author:Fabien Udriot
Email:fabien.udriot@ecodev.ch
Info 4:
Language:en

img-1 img-2 EXT: PHP-based Data Display (Data Consumer) - phpdisplay

EXT: PHP-based Data Display (Data Consumer)

Extension Key: phpdisplay

Language: en

Keywords: forAdmins, forIntermediates, tesseract

Copyright 2007-2012, Fabien Udriot, <fabien.udriot@ecodev.ch>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.org

Table of Contents

EXT: PHP-based Data Display (Data Consumer) 1

`Introduction 3 <#__RefHeading__12752_1738894311>`_

What does it do? 3

Screenshot 3

Questions? 3

Keeping the developer happy 3

`Installation 4 <#__RefHeading__12762_1738894311>`_

Compatibility 4

`User manual 5 <#__RefHeading__12764_1738894311>`_

Setting up a template 5

Available variables 5

Syntax overview 5

`Bug reporting 7 <#__RefHeading__12802_1738894311>`_

Introduction

What does it do?

The "phpdisplay" extension is a Data Consumer for the Tesseract framework. It is used to display and format data given to him by the controller. PHP Display is well indicated when dealing with complex layout by offering the flexibility of the PHP language. It is also targeting developers who prefer to deal with PHP template. For small needs or for people who are not very familiar with PHP, the "templatedisplay" extension would be probably more appropriate.

Screenshot

Here's a view of a PHP Display record in the TYPO3 BE:

img-3

Questions?

If you have any questions about this extension, you may want to refer to the Tesseract Project web site ( http://www.typo3-tesseract.com/ ) for support and tutorials. You may also ask questions in the TYPO3 English mailing list (typo3.english).

Keeping the developer happy

If you like this extension, do not hesitate to rate it. Go the Extension Repository, search for this extension, click on its title to go to the details view, then click on the “Ratings” tab and vote (you need to be logged in). Every new vote keeps the developer ticking. So just do it!

You may also take a step back and reflect about the beauty of sharing. Think about how much you are benefiting and how much yourself is giving back to the community.

Installation

Installation is pretty straightforward, but the extension is useless on its own. It must be installed as part of the Tesseract project. Currently extensions making use of “phpdisplay” is the Display Controller (“displaycontroller”) as well as the Display Controller Advanced (“displaycontroller_advanced”).

The only condition is that “phpdisplay” must be installed before “displaycontroller”. If this order is not respected in your installation, either modify the extension list yourself (in typo3conf/localconf.php ) or uninstall and reinstall “displaycontroller”.

Compatibility

As of version 1.2.0, TYPO3 4.5 or more is required.

User manual

Setting up a template

Create a new record of type PHP based Display on a page or a sysfolder.

Define a value for field "Template path" (cf. screenshot bellow).

Start editing the file. Variable $datastructure contains the result of the data provider and can be used to manipulate data in the template. Some useful examples can be taken from file EXT:phpdisplay/samples/dummy.php.

<?php
    // a good starting point is to display / debug the structure
    print_r($datastructure);
?>

img-3

Available variables

$datastructure

variable name

$datastructure

asdf

the Data Structure passed by the controller which contains the records

Type

Array

$filter

variable name

$filter

asdf

the values of the Data Filter

Type

Array

$controller

variable name

$controller

asdf

the Display Controller itself which is the parent object

Type

Object

Syntax overview

As said, PHP Display is using PHP as a language template. To avoid confusion whenever writing PHP code within HTML, it is recommended to use the syntax bellow:

// loop
<?php foreach($datastructure as $record): ?>
        <?php print $record['title'] ?>
<?php endforeach ?>

// condition
<?php if($foo == 'foo'): ?>
        Test has been validated as TRUE
<?php else: ?>
        Test has been validated as TRUE
<?php endif ?>

Basically, a very basic PHP based template can looks like:

Hello World!

Here is a list of pages:
<ul>
    <li>
        <?php foreach($datastructure['page']['records'] as $record): ?>
            <?php print $record['title'] ?>
        <?php endforeach ?>
    </li>
</ul>

Bug reporting

For feature requests, please open a report on Forge issue tracker: http://forge.typo3.org/projects/extension-phpdisplay/issues

7