Typo3 - Multiple page templates - templates

I am very new to Typo3, and I have a very basic (not to say dumb) question: is it possible to have multiple page templates or can you only have one template?
What I need to do is have different templates call different scripts because apparently having the same template call all of them seems to create conflicts.
Thank you for your help!
Jane

Using TypoScript, you can include any number of scripts in your template.
You can even imagine the following page tree:
-Home
--Page 1
--Page 2
---Page A
---Page B
--Page 3
You can set a certain template for the homepage, and it will apply to all pages. But you can set a completely different template for page 3, and it will only apply to that page. You can also apply a slightly different template to page 2, overriding specific values (page background, CSS inclusion, etc), and it will apply to Page A and Page B as well.

yes, you can have many different templates on a site. Actually each single page can have its very own template. You might be interested in checking out templavoila since its very graphical and once you got it set up, you can easily change between templates within the Typo3 backend.
Tutorials
An alternative would be to use the original TypoScript templates which is not difficult yet requires a bit of TypoScript understanding.
TypoScript Templates
In any way you can chose between different templates.

Related

Django CMS blog - Replacing templates for different cases

I'm not sure, Django CMS Blog is complete app or foundation for self-extending ? I can see one huge logical mistake - inside one app config, I can't easy change template - for list, detail, archive and item - they are strict and hardcoded in plugin code.
Is there any way to customize it without hacking the app/writing tons of custom plugins ?
I need several versions for each template - especially for blog_item.html, blog_detail.html and blog_archive.html.
I want to use plugin feature from Django CMS and don't want to hardcode whole layout in template include logic because this is broking MVC logic (!).
OK, I know, I can include my custom subtemplate blog_item in list template with instance varibles, but I totaly can't imagine, how to do it in several places - front page, list page, post page etc BUT using regular Django CMS plugin features - I have static placeholders and tpl blocks - but there still is one template for item, inside app code.
I understand (less/more) Django template inheritance, but this case is more complicated than simple inheritance between templates.
At frontpage I want different list of latest posts - one template
at category list - different layout - so next template,
inside post - detail_view - need to be customized in other way.
Can somebody guide me, how to achieve this ? Custom plugin for each layout case or something ? A bunch of IF statement in template, dependend from contex is ridiculous..
I have replaced templates set, for app config - configured templates prefix, and whole folder with articles/*.html files. But changing item subtemplate cause change layout part in many places in the same time. This is main problem. Each using "latest posts" plugin, use same template - and I can't set template files for each plugin instance.
After some tests and talks, there is no nice way to replace templates, except extending plugin class and write own better version of plugin...

Joomla Template with different layouts for different sections of the website

I am very new with Joomla, and I have to create a template for joomla 3.0 based on a design given.
I have read a lot of manuals and tutorials about "simple joomla" templates that explain how to organize the directory structure, xml file, index.php and so on.
But I don't see where we can define different layouts for different sections of the website, for example:
Layout for the home page
Layout for articles listing (on search for example)
Layout for the article itself.
I am sure there must be thousands of tutorials regarding that point, bu I simply cannot find it.
Thanks for any advice.
I think one of the concepts you may be missing is "Template and Layout Overrides".
Components (the elements of Joomla! that create the main section of any given page) control the layout of any of their views. To change these a template need to create a matching override for the specific view.
A similar process is used for "Modules" the smaller elements of a web page (e.g. side-bar advertising or widgets).
Have a read of these articles:
How to override the output from Joomla! Core
Understanding Output Overrides
Converting a template for Joomla! 3
You may also want to look at the "Joomla 3.x Template Overrides Example" that You!Joomla created a while back.
Finally given that Joomla! 3.0 is a Short Term Support version (and 3.1 is due any day and so on) you will probably be advised to use the "Template Overrides in Joomla! 3.0" forum for specifics.
If you look in Isis you will see an example of using conditions to change he layout, that is how the control panel is so differen than the rest of the admin. You can either do it all in one file or you can have separate files

Django equivalent of Rails application.html.erb?

Is there a shared "master" layout in Django for HTML files similar to Rails application.html.erb? If not, is there a best practice on how to go about creating one?
In Django, the best practise is to use three levels of template using template inheritance.
I quote the django book to explain you:
You can use as many levels of inheritance as needed. One common way of
using inheritance is the following three-level approach:
Create a base.html template that holds the main look and feel of
your site. This is the stuff that rarely, if ever, changes.
Create a base_SECTION.html template for each “section” of your site
(e.g., base_photos.html and base_forum.html). These templates
extend base.html and include section-specific styles/design.
Create individual templates for each type of page, such as a forum
page or a photo gallery. These templates extend the
appropriate section template.
This approach maximizes code reuse and makes it easy to add items to
shared areas, such as section-wide navigation.

Combining multiple Django Views/Templates

I am working on a website. On the Homepage, I want to show the posts in the center and show famous tags on the right side of the page. Now, posts and tags are two different apps and their views/tempaltes are calculated/generated in two separate functions.
How can I show what I want on my Homepage keeping my mind that its two different views being called. As far as I understand, I can only call a single view to show my homepage.
This must be possible but I am unable to understand this. Any help will be much appreciated.
I think you need to create a custom template tag that in this case called: Inclusion tags
You can look into writing a custom template tag for the tags. That way the tag logic can stay in the right application.
It depends how these different apps render the templates. If they just render the template without extending from a base template you could simply use AJAX to load all the content into your homepage.
If not, then there is no other way than writing a custom solution for this. This could be an extension to your views, a custom template tag as already mentioned or something else according to what exactly you need.

Liferay 6 - How to set up custom layout as default?

I'm working on a Liferay 6 project, and part of the project is to create a new layout template to be used for the entire site as the default. Liferay's own wiki is very sparse on documentation about layout templates, and I haven't had better luck with Google searches or even here on SO.
I did find one article ( Liferay - Layout for each pages ) that sort of answers the question, but it seems like it might be overkill. In that question, the goal was to change the template based on the page, so the answer was to create a Hook and use that to set the template on the fly as needed. Here, I just want to have this custom template be the default for all pages, all the time, which is why I think the answer to that other question might be more than is really needed.
If anyone has the answer to this puzzler, please let me know. Thanks!
-- JLM --
OK, I've figured out my confusion. Liferay has two types of layout templates -- templates that are part of a theme, which is one type of Liferay project, as well as actual layout template projects themselves.
The templates in a theme are where you set up the overall page layout for the site. The main page template, named portal_normal.vm, is a full web page with an <html> tag, a <head> and <body>, etc. Other templates in the theme are usually page fragments.
A Layout Template, on the other hand, is only for laying out the portlets in the main content region of your page (which is defined by tags in your Theme's template files). It is always a fragment and can only have <div> elements or a <table> for laying out the portlets.
Fortunately, this actually makes answering my question very easy, at least in the context that I needed. Per Liferay's documentation at http://www.liferay.com/community/wiki/-/wiki/Main/How+To+Change+Liferay+Default+Theme :
Note: As of 6.x, you cannot just use the theme id specified in the liferay-look-and-feel.xml. Instead, go to Control Panel->Plugins Configuration->Click on theme of interest->note the Plugin ID and use that [as the value for default.theme.id in portal-ext.properties]
I hope this helps some other people trying to figure this out!