mercoledì 2 novembre 2011

My Typo3 basic extensions: LumoNet PHP

Before i go in deep on some of my tips, i need to let you know the basic tool.
This simple plugin do what i most need to do on a Typo3 page:
RUN PHP CODE ON A TYPO3 PAGE INSIDE THE PHP ENGINE!

As you my guess, this is pretty cool when you go 'advanced' in T3 developement.

The basics (my way...):
1-You must have your standardphpcode.php ranamed to standardphp.txt
2-Create a new record on the page and select 'PHP include' plugin as new content element
3-Upload from local your standardphp.txt
4-Next time when you need to edit, i suggest you to go from ftp to uploads/tx_lumophpinclude and edit from here to avoid the creation of undreds of version inside the folder

Now have a look at your page, see the result and start the hardwork!

Some other thips on php and lumo i'd like to share:

This sample to get access to the Typo3db via the Typo3 Engine and its conenction:
<?php
$sel="SELECT * FROM yourtable";
$res = $GLOBALS['TYPO3_DB']->sql(TYPO3_db,$sel);
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
echo $row['yourfield']."<br>";
}
?>
 And with this simple line you get the actual FE_USER id (really useful for someone!):

$usrlog=$GLOBALS['TSFE']->fe_user->user['uid'];
 If you want to check a simple result of a php 'in-page' code, here my 'cat show results' page:
http://www.felixweb.it/public/index.php?id=231&L=2

I use php to build up the data from two tables, build the html table and the various href links to the details of the single shows.
There is also a management system in the front end to allow the fe_users in the 'manager' group to arrange manage the results data.

Nessun commento:

Posta un commento