tt_news
1.7.6. RealUrl and SimulateStaticDocuments
Since tt_news only uses standard "typolink" functions to build its links, it works with "simulateStaticDocuments" and "RealUrl".
A RealUrl configuration example is included. See file: EXT:tt_news/res/realUrl_example_setup.txt
Copy the contents of this file to your /typo3conf/localconf.php. See comments in file for needed changes. The only thing which is needed change should be the id of the rootpage. For detailed information about the configuration of this extension see the "realUrl manual".
tt_news offers several ways to optimize RealUrls that include tt_news parameters. By default all links to a news single view will contain all GETvars that are needed to build the "back to List"-link. In case a link points from a LIST showing an archive period to the SINGLE view its realUrl would look like this:
http://www.example.com/news/archive/period/1112313600/2681999/archived/article/newstitle/
Which means: [domain name]/[pagetitle]/[pagetitle]/[label for archive vars]/[period start in unixtime]/[period length in seconds]/[tx_ttnews[arc]]/[label for news title]/[title of the news record]
This shows two problems at once:
a) Something like "1112313600" can not be considered as "speaking Url". For almost all humans it is not obvious that this means: April 1st 2005.
b) If the news article is shown in more than one list, there will be different SINGLE views with different backPid parameters. There will be multiple instances of the article in the page cache too, which will f.e. produce multiple search results for the same article in indexed search. RealUrl will detect these duplicates and will disable caching what will slow down the site.
Both problems can be solved by adding this to your TS setup:
plugin.tt_news {
dontUseBackPid = 1
useHRDates = 1
}
"dontUseBackPid" will prevent the backPid and all other backPid-related parameters in links from tt_news. The disadvantage of this feature is, that now the backPids from all SINGLE views will point to the same page � the one that is configured as "plugin.tt_news.backPid".
"useHRDates" will enable tt_news to use "year" and "month" instead of "pS". "pL" and "arc".
Now the URL from above should look like this:
http://www.example.com/news/article/newstitle/
With the monthnames and numbers as key-value pairs in the realUrl configuration, Urls with "speaking archive dates" are possible (see example realUrl configuration file). Links, pointing to archive periods would look like this:
http://www.example.com/news/2005/april/
With two additional parameters tt_news can be configured to add the values for "year", "month" and even the "day" to the links pointing to the SINGLE view. "useHRDatesSingle" will enable the use of all three vars, "useHRDatesSingleWithoutDay" will add only "year" and "month" to this links.
Example:
plugin.tt_news {
useHRDates = 1
useHRDatesSingle = 1
useHRDatesSingleWithoutDay = 1
}
The table shows with which configuration links would look how:
|
code |
useHRDatesSingle |
useHRDatesSingleWithoutDay |
|---|---|---|
|
LIST/LATEST |
http://www.example.com/news/ |
http://www.example.com/news/ |
|
AMENU |
http://www.example.com/news/view/2005/04/ |
http://www.example.com/news/view/2005/04/ |
|
SINGLE |
http://www.example.com/news/view/2005/04/12/this-is-awesome/ |
http://www.example.com/news/view/2005/04/this-is-awesome/ |
("view" is the name of the realUrl postVarSet for tt_news)
The table shows all views at the same page (news/). This is possible with a bit TypoScript which is explained in the section "TypoScript Examples" in this manual.
SimulateStaticDocuments
This feature is not so sophisticated as realUrl and therefore a bit easier to configure - you'll only have to add the lines below to your TS setup. With SimulateStaticDocuments the URLs of your site will look like this:
http://server.com/news/newstitle+M5aj89345.0.html
To get rid of the GET parameters from tt_news showing in the adressbar of your browser, you can add them to the pEnc_onlyP list (see example):
Example:
config {
simulateStaticDocuments=1
simulateStaticDocuments_pEnc=md5
# displays 22 chars of the page title
simulateStaticDocuments_addTitle=22
# include the GET parameters from tt_news to the encoded vars (all in one line)
simulateStaticDocuments_pEnc_onlyP = cHash, L, print, tx_ttnews[backPid],
tx_ttnews[tt_news], tx_ttnews[pS], tx_ttnews[pL], tx_ttnews[arc], tx_ttnews[cat],
tx_ttnews[pointer], tx_ttnews[swords]
}
More information: Tsref->CONFIG