[TYPO3-english] data['media'] and image thumbnails

Xavier Perseguers typo3 at perseguers.ch
Fri Feb 13 19:41:17 CET 2009


Hi Sten,

> I'm sorry for being a noob. This is my problem, I`d like to have a
> micro-gallery extension. My approach is: edit the subtemplate to generate a
> TS element and embedd it on the page using tscobj extension.
> The template:
> 
> includeLibs.test_library = fileadmin/test_library.php
> temp.output = USER
> temp.output.userFunc = user_test_library_class->test
> 
> php.output < temp.output

Why not creating a real extension? It's easy with kickstarter.

> Now inside of the php file I`d like to access 'media' propery of the page to
> read it`s images. $this->cObj->data['media'] was empty because I use
> templavoila. I solved it with this hacky mehtod:
> 
> $query = "SELECT media FROM pages WHERE uid = " .$this->cObj->data['pid'];
> $res = mysql(TYPO3_db,$query);
> $row = mysql_fetch_row($res);
> return $row[0];
> 
> It works, but I wonder if there is a better solution then that.

- There's a whole documentation on backend programming, you may find 
useful to read it.

- Do not use double quotes when single quotes suffices

- Never use mysql* functions directly, use t3lib_BEfunc static methods 
or $GLOBALS['TYPO3_DB']

- t3lib_pageSelect has some methods for dealing with pages that may help you

Regards

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en

One contribution a day keeps the fork away


More information about the TYPO3-english mailing list