Archive for category Typo3

Typo3 : Typo3temp folder full of js files


A common problem with anyone using Typo3 4.2 and GMENU Layers is that Typo3 creates a temporary js file each time a page is loaded. This ends up leading to your typo3temp folder being filled with thousands of js files. In some cases, with busy websites, we’ve seen the Typo3temp folder filled with as much as 1-2GBs of temporary js files. Clearly a problem, but not such as easy one to fix.

If you, for some reason are still running the 4.2 version of Typo3 here’s how you fix the issue.

The first thing you need to do is delete all those temporary js files from the typo3temp folder. This might be a bit of a nightmare if there are hundreds and thousands of files. In one case I needed to resort to removing the files via ssh using a wildcard and file name from within the typo3temp folder, e.g. rm -f javascript_12* (be very careful using the rm cmd MAKE SURE YOU ARE IN THE TYPO3TEMP FOLDER – no warranty provided by me if you mess up!).

Once that’s done and you’ve taken a complete backup of your website, complete the following steps:

1. Download patch file from http://bugs.typo3.org/view.php?id=12376
2. Upload the patch file to the root of your Typo3 installation (e.g. the directory with index.php and Typo3 folder etc)
3. Log into your SSH account and cd to the root folder
4. Type patch -p0 -i nameofpatchfile.diff
5. Log into FTP and delete all temporary js files from the typo3temp folder

You should now log on to your website and click around a few pages. Then check your Typo3Temp folder again through FTP to see if any js files have been created. You should really only see one (unless you have multiple navigations).

That’s it!

Tags: , , , , , , ,

No Comments

Backend Layout (Grid View) Feature of the New Typo3 4.5 LTS

For anyone who has ever used Typo3 as a CMS, they would be well aware of the limitations associated with the layout of a page (backend layout) in the administration area.

Without hacking or using third party extensions such as TemplaVoila, it was pretty difficult to get anything more than the Left, Normal, Right & Border columns to add content elements to your website. For someone familiar with Typo3, it wasn’t a major problem, but as soon as you put the administration system in front of someone who was about to use it for the first time, it created nothing but confusion.

With the release of Typo3 4.5, Typo3 developers now have the ability to make a more user friendly admin page for content editors through their new core feature Grid View (Backend Layout).

With ease, we can now give the Typo3 user a more user friendly and intuitive admin page just by creating a few simple backend layout views that only helps people make a better association with the websites design.

I found it very hard to find any decent information online about how to implement the Backend Layout feature, so I’ve decided to put together this little tutorial on how you can get started.

Step 1 : Create Backend Layout
The first thing you need to do is create a system folder to store your backend layout templates.

Once you’ve created the new system folder, choose List (on LHS) > the System Folder > Click the “Create Record” button at the top of the RHS page. Then from there, you should choose “Backend Layout”.

On the next screen that loads, enter your Title (used to easily identify the layout) and click the Grid Wizard icon (pencil and notepad) beside the Config field. It is also a good idea to associate a simple graphical icon to help you identify the layout visually.

 

The Grid Wizard allows you to design a layout, in our simple example we use a Top Left, Top Right and Bottom style layout.

 

One thing to note here is that you MUST enter a Name and Column number for each column of the layout grid. If you don’t do this, you will get a “not assigned” error in the admin page.

The Grid View wizard creates the config code required to make it all work!

E.g.

backend_layout {
colCount = 2
rowCount = 2
rows {
1 {
columns {
1 {
name = TopLeft
colPos = 1
}
2 {
name = TopRight
colPos = 2
}
}
}
2 {
columns {
1 {
name = Bottom
colspan = 2
colPos = 3
}
}
}
}
}

Once you are happy with your layout, you can now begin to apply the layout to the backend page.

 

Step 2 : Apply Layout to Backend Page
This step is very simple, all you need to do is access the page properties of the page you would like the Backend Layout applied to. Choose the “Options” tab and at the bottom of this page, you should see the icons (if you’ve applied one to the layout) of the layout options you have available. If not, you can simply choose your layout from the drop down menu.

 

Step 3 : Apply to Front End Template
Nothing hugely changes much from a front end perspective. We all have our own ways of doing this I’m sure. But here’s a simple example of what we would do:

Layout.html File

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>

<html>
<head>
<title>Untitled</title>
</head>

<body>

<!– ###DOCUMENT_BODY### –>
<div id=”topLeft”>
<!– ###TOPLEFT### –>
TOPLEFT of page
<!– ###TOPLEFT### –>
</div>
<div id=”topRight”>
<!– ###TOPRIGHT### –>
TOPRIGHT of page
<!– ###TOPRIGHT### –>
</div>

<div id=”bottom”>
<!– ###BOTTOM### –>
BOTTOM of page
<!– ###BOTTOM### –>
</div>

<!– ###DOCUMENT_BODY### –>

</body>
</html>

 

TypoScript Set Up
page = PAGE
page.typeNum = 0

page.10 = TEMPLATE
page.10.template = FILE
page.10.template.file = fileadmin/layout.html

page.10 {
workOnSubpart = DOCUMENT_BODY
subparts.TOPLEFT< styles.content.get
subparts.TOPLEFT.select.where = colPos = 1

subparts.TOPRIGHT< styles.content.get
subparts.TOPRIGHT.select.where = colPos = 2

subparts.BOTTOM < styles.content.get
subparts.BOTTOM.select.where = colPos = 3

}

One final thing to do is make sure that you have included the CSS Styled Content in your statics!

That should be enough to get you started with this great new feature! Enjoy!!

Tags: , , , , , , , ,

9 Comments

Convert Typo3 mod_rewrite rules to Zeus rewrite rules


We encountered a problem for the first time ever today and that was that a client wished to host their website with Register365.

Well that wasn’t really the problem, the problem was that the site was built in Typo3 and that Register365 doesn’t support the Apache mod_rewrite rules on their server because they use Zeus Web Server.

In effect, all the lovely mod_rewrite rules we use for making those lovely search engine friendly URLs on Typo3, no longer worked… bummer…

Luckily enough, the basics of Zeus Rewrite scripts are pretty straight forward, albeit daunting when you first encounter them. Register365 give a great example of how to convert a basic mod_rewrite rule to a Zeus Rewrite rule, this is what it looks like:

Mod Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^[^/]*\.html$ index.phpWould convert to:

Converts to:

Zeus Rewrite Rule
match URL into $ with ^/[^/]*\.html$
if matched then set URL = /index.php

Pretty cool and simple we thought – but unfortunately when you try and strive to look for the best way of doing things, this was a little too basic for our requirements. This would have worked perfectly if we used the standard simulation of static documents within Typo3, but we much prefer the RealURL’s extension as it does a great job of handling the news plugin aswell as many others. So we had to go an extra step further to make it work for us.

RULE_0_START:
map path into SCRATCH:DOCROOT from /

set SCRATCH:ORIG_URL = %{URL}
set SCRATCH:REQUEST_URI = %{URL}

# We need to check for any additional requests in the querystring

match URL into $ with ^(.*)\?(.*)$
if matched then
set SCRATCH:REQUEST_URI = $1
set SCRATCH:QUERY_STRING = $2
endif
RULE_0_END:

RULE_1_START:
set SCRATCH:REQUEST_FILENAME = %{SCRATCH:DOCROOT}
set SCRATCH:REQUEST_FILENAME . %{SCRATCH:REQUEST_URI}

# RealURLs rewrites everything, but we don’t want it to do this for images, css, etc.
# So we must check that the requested URL are not to actual files, if they are, do not rewrite.
look for file at %{SCRATCH:REQUEST_FILENAME}
if not exists then
look for dir at %{SCRATCH:REQUEST_FILENAME}
if not exists then
goto QSA_RULE_START
endif
endif

goto END
RULE_1_END:

QSA_RULE_START:
# If there was a query string, we need to append it so it knows what to do.
# the same as [QSA,L] for apache mod_rewrite
match SCRATCH:ORIG_URL into % with \?(.*)$
if matched then
set URL = %{URL}&%{SCRATCH:QUERY_STRING}
endif
goto END
QSA_RULE_END:

Don’t forget you’ll most likely have to add this through your hosting control panel. G’luck!

Tags: , , , , , , , , , ,

No Comments