[TYPO3] Frontend plugin: Is this the best way

Drew Leske dleske at uvic.ca
Fri Apr 7 20:27:16 CEST 2006

Greetings all,

I have created a frontend plugin that grabs an RSS feed from an internal
service we have running here, filters the results slightly, and displays the
results as links to the service providing the feed.  It's simple, basic, and
far from perfect, but it does the job.

I can leave it as it is for now but I was hoping for clarification on a few
things.  I looked at a variety of documentation, including some of the
tutorial videos, but there are some things I'm still not clear on.
Apparently the FAQs and HOWTOs linked from the typo3.org site are extremely
useful, but they have been offline since I started with Typo3!

Anyway, if anybody can give me some advice here, I would appreciate it.
Like I said, it works, but I want to learn more and I want to know what
"best practices' are on these issues.

I'm unclear on the following points.

1. What is the difference between a "frontend plugin" extension and a simple
"frontend" extension?  My extension takes configuration on the backend, but
I don't know if it qualifies as a "web app" in this context: it provides
dynamic content, but without any input from the site user.

2. When inserting the plugin into a page, a field is provided to specify the
filter.  This is a simple string.  I created this field by extending the
tt_content page as suggested by the "Episode III" video.  This extends every
content record of course, for a plugin used once on my site (I do want the
flexibility of using the plugins multiple times on the site, independently).

I've looked at other plugins, and one that provides this sort of
customization is the Modern FAQ plugin.  It provides fields on the backend
in a completely different way.

Is how I did it appropriate for a plugin of this level of complexity (low)?
 What's the best practice?  I went with the simpler method alluded to by
Kaspar himself, but all those empty fields bother me.

3. In the video, when it comes to explaining how to code the plugin to
handle the customization field, Kaspar says he'll leave this as an exercise
to the viewer (d'oh!).  So I cobbled together some clues from other plugins
and from reverse-engineering what's available in $GLOBALS['TSFE'].

I need to grab the contents of that field from the tt_content table, by
searching for the record based on the content's uid.  This is where it gets
crazy.  Looking back at the plugin base class, I should be using function
pi_getRecord($table,$uid,$checkPage=0)--instead, I execute the query myself.
 But the question is, where do I get the $uid?

By looking at the contents of $GLOBALS['TSFE'], I've come up with the following:

      // get current record
      $currentRec = $GLOBALS['TSFE']->currentRecord;
      $parts = explode(':', $currentRec);
      $table = $parts[0];
      $contentId = $parts[1];

"currentRecord" == tt_content:$uid, so I split them and go with that.  This
seems like I'm going in through a back door rather than using the proper API.

So, have I done everything wrong, or what? ;)

Thanks for any information you can provide,

Drew Leske :: Systems Group/Unix, Computing Services, University of Victoria
  dleske at uvic.ca / +1250 472 5055 (office) / +1250 588 4311 (cel)

More information about the TYPO3-english mailing list