Jul 29, 2008

Using an extension from another extension

From time to time I notice that many extensions duplicate certain functionality. For example, many extensions have a page browser. Some of them use page browser provided by pi_list_browseresults function from tslib_pibase class. Examples include mininews, indexed search and tt_news. That function is hard to customize, so almost everyone creates a new page browser.

I came across it again this week. While creating a new extension I had to use a page browser. I have several page browsers already (in comments and some other extensions). But I do not like copying the code. If error exists in the code I will have to update all places where I copied the code.

Next I thought: it would be great if an extension could provide certain functionality to other extensions. For example, if I make a universal page browser, it could be used from any other extension.

Jul 24, 2008

Do not ask more than you need

There is a very nice principle for designing web sites. It sound likes this: "Do not ask from user more than you really need".

I often remember this principle when I go to download sample chapters of free demos from web sites. Many of them ask for lots of data. Why, for example, they need to know my social security code or phone number? Or why do they need my e-mail if I want to download the sample chapter? Do they want to spam me?

I usually refuse to give such information because I do not see why they need it and how they will use it. I am not paranoid but I do not see a need to give my details to every unfamiliar person or company.

Why am I writing about it here?

Jul 23, 2008

ExtJS-based blog

Sometimes browsing the web brings something really revolutionary and amazing.

Everyone knows WordPress. Everyone knows how many themes it has.

Many developers know ExtJS, which is really good JavaScript framework for creating rich user interface. It provides various widgets, forms, calendars, panels, sliders, even windows.

Today I discovered a web site that uses ExtJS to create a WordPress theme. This is really amazing. ExtJS uses AJAX a lot and this blog too. All articles are loaded using AJAX and side bar uses Outlook-like sliding layout. Looks really unusual. Give it a try.

What do you think about this site and the idea? Will blogs become more dynamic in future? More web 2.0 like?

Jul 22, 2008

Howto: use Frontend data in a TYPO3 mail form

Today I had an interesting challenge. I had to create a contact form on the Intranet web site. This web site always has Frontend user logged in. I was going to use standard TYPO3 mailform. Typically such form contains fields for user name and e-mail. When I started to create the form, I immediately realized that it will be stupid to ask for this information if user is already logged it. I should find a way to insert this information automatically.

The obvious solution that come to the mind is to make an extension that will modify the form to include Frontend user data. Yes, it is possible.

Jul 21, 2008

Slides from productivity session

In July I had a session about personal productivity at TYPO3 user group in Holland. I planned to make video from these slides but I instead I decided another way to share slides. I put them to SlideShare. You can also vote for these slides to participate in the "World Best Presentation Contest' 08".


Jul 15, 2008

Why subtituteMarkerArrayCached is bad

In the previous article we talked about TYPO3 template functions. I mentioned that substituteMarkerArrayCached is a function that developers should not use. In this article I am going to explain why.

As you remember there are four “substitute” functions for use with TYPO3 templates:
  • substituteMarker
    This function substitutes a single marker
  • substituteMarkerArray
    This function does the same as above but for many markers in the array
  • substituteSubpart
    Substitutes a single subpart
  • substituteMarkerArrayCached
    Our today's case.
The first two functions substitute marker and marker array. The third substitutes template subpart. The obvious missing function is the one to substitute subpart array.

How to fill RealURL cache with data

From time to time I see this question: how to fill RealURL cache with page addresses?

The answer is pretty simple. Make a new "hide in menu" page. Insert Sitemap there. Logout from Backend. Enter that new page address in the browser bar.

Notice that logging out is essential. RealURL will not cache anything if you are logged in to Backend.

This procedure will fill cache with page addresses. But it will not create cached entries for stuff like tt_news. So this tip is good if you have mostly pages.

Jul 11, 2008

Using templates in TYPO3 Frontend

Firsts, I wanted to write a warning article about the substituteMarkerArrayCached function. But then I understood that article is going to be about template functions in general and warning should be in the different article.

Let's have an overview of TYPO3 templates and functions to handle them.

TYPO3 template basics

Templates in TYPO3 are normal HTML files. These files contain special markers that TYPO3 can replace with data. Markers typically are words in CAPS surrounded by three hash marks. For example: ###LINK###.

There are two types of markers: single markers and subpart markers. Single markers is a single piece of data, it is replaced as is. Subpart markers surround parts of the HTML code. Here is an example:

<!-- ###LIST### begin -->
Repeating elements:
  <!-- ###REPEATING### begin -->
  <li>Iteration ###NUMBER###</li>
  <!-- ###REPEATING### end -->
<!-- ###LIST### end -->

Here ###LIST### and ###REPEATING### are subpart markers. Extension can get a subpart and replace it as whole. Often it is used for repeating elements of for subparts that should be removed under certain conditions. “begin” and “end” are not necessary but conventional.

###NUMBER### is a single marker.