Keep in mind that the news list plugin is on the root of the site yet the tt_news single display page is also the root of the site.
- The extension's main script gathers the tt_news get parameters from the URL.
- The script checks to see if the parameters specified by the URL indicate that a single news article should be displayed.
- If a single news item has been requested, as indicated by a positive news article uid given in the url, the script then fetches the pid of the news article which is the uid of the system folder that the news article is stored in.
- Once it is determined what folder the news article is stored in, the script checks to see if a layout has been assigned for news stored in the folder
- If a layout is specified, then the content of the single news view page is replaced with the layout specified by the layout setting for the news storage folder that the news item is stored in.
- If the news storage folder doesn't specify a layout to be used to display articles within it, the content of the single news display page will show a default single news display layout.
- If a single news item is not requested, the script shows the content for a normal front page layout with tt_news LIST or LATEST plugins inserted.
I'll store most news articles in the folder designated for the 450 pixel wide layout. But if an article has some long lines of preformatted code that can't be wrapped and which won't display well in the normal 450 pixel column, then I'll just store the news item in the folder that is designated for articles needing a wider 800 pixel layout.
The extension mentioned earlier adds an extra field in the 'pages' database table and which is set in the page properties of each of the two news storage folders to specify the content element which contains the specific news layout to be used for articles stored in each of those folders.
Here's how the system works:
Lets say I have two different layouts that I'd like to use for displaying tt_news SINGLE items on the same page.
With one layout, the news is displayed in a column that is 450 pixels wide. For the other layout, the news plugin is rendered in an 800 pixel wide column.
So then, how does TYPO3 decide which layout will be used when a news item is requested in the front end?
It's simple. I create two system folders to store news articles.
One folder stores news that needs to be displayed in a 450 pixel wide column. The other folder stores news items that need a wider 800 pixel layout.
So I came up with a different way to specify what type of news page layout should be used with a particular news item.
This eventually resulted in the creation of an extension that handles the decision of what layout should be used to display each news article.
After I saw how simple typoscript made it for me to achieve the URL scheme that I wanted, I began to think of other situations like for example I might want a news item in SINGLE mode to be displayed with a different layout than other news items, and without using a different single news display page.
It would be easy to create some different categories for news items based on how the news item should be displayed.
For instance, If a news item had some code that I didn't want to wrap around in a narrow column of my template, I could create a category for news that needed a wider layout than normal. And then I could let tt_news choose how the item would be displayed based on the category that the news item was a child of.
This idea did not seem like an optimal solution as I feel that categories should be used to categorize content based on the topic of the content and not for categorizing the way that an article needs to be displayed.
My first approach was to use conditions in typoscript which specified that if a news item was clicked on, the page would dynamically show content containing the news plugin configured for SINGLE view. Otherwise, if no URLrameters indicated that a news article was chosen, the typoscript condition would automatically display content for a default home page view which contained the tt_news plugin configured to display in LIST or LATEST modes.
Using typoscript conditions in this way turned out to be successful in allowing my root page to show both displays for LIST and LATEST views, or for SINGLE view, based on the parameters passed in the URL. And this also made it possible to have a URL scheme that was just how I liked it - without the word article appearing in the URL - short and simple.
First off, I want to have clean and easy to understand urls for my site that make sense to both humans and search engines. I wanted to implement a URL scheme that is different than what usually results when tt_news and realurl are used together.
What had bothered me with the usual URL schemes that are characteristic of tt_news ccoupled with the realurl extension was that the word article, or something similar, is required as a realurl path segment for single news view pages.
Having the word article in every url that corresponds to a single view news item seemed a bit unnecessary to me. Of course it's an article and the URL shouldn't be required to denote that.
So my first wish for this site was that URLs would be generated in the following fashion:
I've been involved lately in working on backend programming and configuration of this web site which is built upon TYPO3 CMS.
One thing I am glad about is that TYPO3 is such a flexible system that for any task of development that may arise, there is a solution with TYPO3.
With this site, there are several issues that needed to be addressed, mostly having something to do with the amazing tt_news extension.