• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Template Layout Overrides - a beginner's guide
 

Template Layout Overrides - a beginner's guide

on

  • 10,804 views

Template overrides are now being very widely used in some of the better produced templates, but do you really understand how they work? Have you got a clue what the MVC concept is all about? We had ...

Template overrides are now being very widely used in some of the better produced templates, but do you really understand how they work? Have you got a clue what the MVC concept is all about? We had to do a bit of research ourselves to be able to explain it to others in "non geek speak" - hopefully you'll find this presentation useful.

Please note that there was a lot of discussion relating to this presentation - why not come along to our Joomla! User Group meeting to find out what you're missing!

Statistics

Views

Total Views
10,804
Views on SlideShare
10,723
Embed Views
81

Actions

Likes
2
Downloads
152
Comments
0

10 Embeds 81

http://www.suffolkcomputerservices.co.uk 35
http://www.slideshare.net 31
http://viet4777.vatlieu.us 4
http://localhost 3
http://viet4777.luyenkim.org 2
http://kythuatvatlieu.org 2
http://viet4777.xahoihoctap.net 1
http://vatlieu.us 1
http://vicoltd.biz 1
http://www.linkedin.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Template Layout Overrides - a beginner's guide Template Layout Overrides - a beginner's guide Presentation Transcript

    • Template overrides and the “MVC” concept Ruth Cheesley Suffolk Computer Services [email_address]
    • WHAT IS MVC?
    • What is MVC?
      • M ODEL
        • Manages the behaviour and the data
      • V IEW
        • Manages the graphical and/or textual output
          • Article, Category Blog, Section list
      • C ONTROLLER
        • Interprets mouse/keyboard inputs
    • Request for a section blog layout content page is sent (by user browsing to the page) Controller analyses the request and passes to appropriate component (com_content) Appropriate data (from the section ID) is pulled from the database and passed to the view View (section) and layout (blog) applied, overrides applied, content is displayed to user
    • WHY USE TEMPLATE OVERRIDES?
    • Why use Template Overrides?
      • Avoid editing the core
      • Change how an extension is displayed
      • Greater flexibility
      • If Component/module is 1.5 Native & uses MVC structure (has views/tmpl folder)
    • TEMPLATES, VIEWS AND LAYOUTS
    • Views and Layouts
      • Components display information in different ways (“views”)
      • Most components will have many views
        • com_content
          • Single article
          • Category/Section
          • Archive
          • Front Page
      • The view does not display the output – this is done by a “layout” (e.g. blog, html, RSS feed, PDF)
    • Run that by me again?!
      • Components can have multiple views
        • Each view assembles a fixed set of information (e.g. The Category view in Articles component assembles a number of articles)
      • Each view can have multiple layouts
        • Each layout can display the information in different ways (e.g. The Category view in Articles component can be laid out in blog or list layout)
    • What about modules?
      • Generally only display one thing, one way
      • Don’t really have views, but do support a layout
    • Templates and Layouts
      • Templates set up a structural framework for the page of the website
        • Positions for modules & components to display
      • What gets displayed is controlled by
        • Module layout
        • Combination of view & layout in the case of a component
    • Typical layout (rhuk_milkyway) Append ?tp=1 to show module positions over your template E.G. index.php?tp=1
    • Component Structure
      • Components/  High level folder (contains all components)
      • com_content/  Individual component folder
      • views/  The different views available for that specific component
      • articles/  For when displaying a single article view.html.php (this is the view that outputs the html)
      • view.pdf.php (this is the view that outputs the PDF)
      • tmpl/  Template folder
        • default.php (this is a layout)
        • form.php (this is a layout)
      • category/  For when displaying articles in category view
      • view.html.php (this is the view that outputs the html)
      • view.feed.php (this is the view that outputs RSS feed )
      • tmpl/  Template folder
      • blog.php (this is a layout)
      • blog_items.php (this is a sub-layout)
      • default.php (this is a layout)
    • HOW TO OVERRIDE
    • How to override components?
      • Templates/  High level folder (contains all templates)
      • MyTemplate/  My Template folder
      • html/  The template overrides folder
      • com_content /  The component to be overridden
      • articles/  Overrides to apply to single article view
        • default.php (this is a layout)
        • form.php (this is a layout)
      • category/  Overrides to apply to category view
      • blog.php (this is a layout)
      • blog_items.php (this is a sub-layout)
      • default.php (this is a layout)
      • Note:
      • There are three other views for com_content:
      • Archive
      • Section
      • Frontpage
      • It is not possible to customise the PDF or RSS feeds currently
    • How to override components?
      • Copy / components / com_content / views / article / tmpl /default.php
      • To
      • / templates / rhuk_milkyway / html/com_content / article /default.php
      • Make changes to file in template folder (not in the core)
      • Joomla will check for overrides – if there’s a file in the html folder for this component and this view, use it. Else, use default file .
    • What about modules?
      • Modules/  High level folder (contains all modules)
      • mod_latestnews/  Individual module folder
      • helper.php (helper file containing data logic)
      • mod_latest_news.php (main module file)
      • mod_latest_news.xml (module installation XML file)
      • tmpl/  The templates for that module (usually only one, but can be more)
      • default.php (this is a layout)
    • How to override modules?
      • Copy
      • / modules / mod_latestnews / tmpl /default.php
      • To
      • / templates / rhuk_milkyway / html/mod_latestnews /default.php
      • Make changes to file in template folder (not the core)
    • What else can I override?
      • Module Chrome
      • Pagination
      • Check out http://docs.joomla.org/Understanding_Output_Overrides
      • for some examples
    • THINGS TO CONSIDER
    • Things to consider
      • Only override 1.5 NATIVE MVC enabled components/modules (with views/tmpl folder)
      • Can’t override PDF/RSS Feeds (you have to edit the core)
      • File path is essential – get it right!
    • Ruth Cheesley Suffolk Computer Services [email_address]
    • References
      • Joomla Docs:
      • http://docs.joomla.org/MVC
      • http://docs.joomla.org/Understanding_Output_Overrides
      • http://docs.joomla.org/Category:Templates
      • http://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core
      • Wikipedia:
      • http://en.wikipedia.org/wiki/Model-view-controller