Realurl is a neat TYPO3 tool written by Dimitry Dulepov in order to allow your urls to look more like those of old times, before the days which makes them ofcourse easier to understand and remember for your users if used in the right way.
Although basic setup of realurl is very easy, when you want to start turning your get variables into "path segments" within your urls so I have written out, using this site as an example how this would be set up for converting an id (from the database table) to the title of said item in the database.
The following must be included as a part of your realurl configuration file, wherever you choose to include it:
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'_DEFAULT' => array(
'postVarSets' => array(
'_DEFAULT' => array(
===
Below is where we really get into the postvarsets, or get-variable conversion, the beginning of this array "view" is the label of the segment which will be set as a prefix as "/view/" in your path before any of these converted id's.
===
'view' => array(
array(
===
Here we say which get variable is going to be effected by this translation
===
'GETvar' => 'tx_blogs_pi3[category]',
===
lookUpTable is stating that we are going to be using the database to get the label value for this translation
===
'lookUpTable' => array(
===
Obviously this is the table we will be working with
===
'table' => 'tx_blogs_categories',
===
Again this should be obvious, but it is the field in the database where we will be checking the value of the getvar against to get the required row.
===
'id_field' => 'uid',
===
The alias field is quite simply the field in the database which we will be using for the label.
===
'alias_field' => 'title',
===
addWhereClause is where we put any extra requirements for the query, as you can see I am ensuring that the item is not deleted from the database.
===
'addWhereClause' => ' AND "deleted" != 1',
===
I must admit, currently useUniqueCache is somewhat confusing to me, however two options within this are very useful, firstly you can set all the urls to be lower case which is nicer for the eye and secondly and more importantly, you can replace the spaces in the generated url with a character of your choice, therefore avoiding valid urls.
===
'useUniqueCache' => '1',
'useUniqueCache_conf' => array(
'strtolower' => '1',
'spaceCharacter' => '-',
),
),
),
),
),
),
)
);
If you require to fill your url with hardcoded data in place of from the database the following simple explaination should help you:
array(
'GETvar' => 'tx_blogs_pi4[date]',
'valueMap' => array(
'january' => 1,
'february' => 2,
'march' => 3,
'april' => 4,
'may' => 5,
'june' => 6,
'july' => 7,
'august' => 8,
'september' => 9,
'october' => 10,
'november' => 11,
'december' => 12,
),
),
I hope that this was useful to someone and as soon as I learn a bit more about realurl I will be sure to write a follow up post as it seems to be the one tool which is used in every TYPO3 site we make and one which although should be relatively simple to learn is not due to the manual being written more as a reference than a tutorial.
this site was made by gamereaction
powered by TYPO3
RSS Feed
2 comments have been posted
omg someone came to my site, you are welcome Frederik. Sorry for the formatting.
Thanks a lot..! This was just the article i was looking for.. or the examples anyway.. ;) /Frede