Upload
philip-locke
View
104
Download
0
Tags:
Embed Size (px)
DESCRIPTION
It is extremely common that parts of pages within a Joomla! website are replicated across several views, or even across several extensions. So what does Joomla! contain that could potentially make our lives easier to manage these repeating entities? JLayouts enters the room... Joomla's superb JLayout structure was added to Joomla! v3 to help solve this very problem. Having the ability to use different layout's and associated data across views and extensions is such an awesome addition to Joomla!, but have you used it? Philip will be explaining JLayouts, what it is, how it works & where you could possibly be missing a trick in your front-end development of Joomla! websites.
Citation preview
Joomla 3JLayouts
has entered the building!
Joomla 3JLayouts#JD14NL
Joomla 3JLayouts
Philip Lockewww.fastnetwebdesign.co.uk
&www.joostrap.com
WHOWHO IS THIS GUY?
MamboMamboleading toleading to
JoomlaJoomla
MamboMamboleading toleading to
JoomlaJoomla
Open Source Open Source Matters (OSM)Matters (OSM)Open Source Open Source
Matters (OSM)Matters (OSM)
Bootstrap Bootstrap &&
JoostrapJoostrap
Bootstrap Bootstrap &&
JoostrapJoostrap
WHOWHO IS THIS GUY?
20032010
2012
Joomla 3JLayouts
WHATSO WHAT’S THIS SESSION ABOUT?
1. Blinding you with science2. What is a JLayout3. Why use JLayout’s4. Process & Implementation5. How to use JLayout6. Q … A
Joomla 3JLayouts
WHATWHAT IS A JLAYOUT?
No hacking
Override
Untie data & design
Super easy integration
Joomla 3JLayouts
WHATWHAT IS A JLAYOUT?
Joomla 3JLayouts
WHATWHY USE JLAYOUTS?
Maintain one layout
Split code from design
Designers customise layout’s
Joomla 3JLayouts
It’s bloody awesome!
SETUPWHAT WE HAVE TO DO
Joomla 3JLayouts
SETUPLET’S DO THIS PUNK
1. Copy the ‘layout’ files from core…[root]/layouts/joomla
2. Paste them into your template HTML folder…/html/layouts/joomla
Joomla 3JLayouts
SIMPLE2 EASY STEPS
1. Create our new JLayout file
2. Add to our tmpl HTML override
Joomla 3JLayouts
Joomla 3JLayoutsEXAMPLE
CREATING A NEW JLAYOUT
THE CODE
The Code:<?phpdefined('JPATH_BASE') or die;?>
<div class="hottopic"> <h3><span class="label label-success">Hot Topic!</span></h3></div>
Joomla 3JLayouts
CREATING A NEW JLAYOUT
File Location:templates/[our-template]/html/layouts/joomla/content/hottopic.php
THE CODE
The Code:<?php$layout = new JLayoutFile('joomla.content.hottopic');echo $layout->render();?>
Joomla 3JLayouts
CREATING A NEW JLAYOUT
File Location:templates/[our-template]/html/com_content/article/default.php
Joomla 3JLayoutsEXAMPLE
CREATING A NEW JLAYOUT
Joomla 3JLayoutsEXAMPLE
CREATING A NEW JLAYOUT
Joomla 3JLayoutsEXAMPLE
OVERRIDING AN EXISTING JLAYOUT
THE CODE
The Code:<dd class="create"> <span class="label label-primary"> <?php echo
JText::sprintf('COM_CONTENT_CREATED_DATE_ON', JHtml::_('date', $displayData['item']->created, JText::_('DATE_FORMAT_LC3'))); ?>
</span></dd>
Joomla 3JLayouts
CREATING A NEW JLAYOUT
File Location:[our-template]/html/layouts/joomla/content/info_block/create_date.php
THE CODE Joomla 3JLayouts
CREATING A NEW JLAYOUT
The Code:<?php$layout = new JLayoutFile('joomla.content.info_block.create_date');echo $layout->render(); ?>
File Location:templates/[our-template]/html/com_content/article/default.php
Joomla 3JLayoutsEXAMPLE
OVERRIDING AN EXISTING JLAYOUT
WHY NOT!LET’S TAKE THIS FURTHER
Joomla 3JLayouts
So….
Where to go from here?
We all want the simple thingsin life… right?
Joomla 3JLayoutsWHY NOT!
LET’S TAKE THIS FURTHER
Normal blog_item.php
350+ lines of code… woo!
Joomla 3JLayouts
Brain wave!Actually… it’s pretty obvious
WHY NOT!LET’S TAKE THIS FURTHER
Joomla 3JLayoutsWHY NOT!
LET’S TAKE THIS FURTHER
WHY NOT!LET’S TAKE THIS FURTHER
Joomla 3JLayouts
Our new blog_item.php file
31 lines of code
All code split into easy tomanage JLayouts snippets
OTHER IDEASGOING THE EXTRA MILE
Joomla 3JLayouts
Place JLayout’s where you want
Blog view, Article view, etc…
Componets, Modules
Mash things up - just have a play!
JLayouts are Super Cool
WOWGOING THE EXTRA MILE
Joomla 3JLayouts
After explaining JLayouts…
Nerd- Gasm!
QUESTIONS & ANSWERS
Q…A
Joomla 3JLayoutsQUESTIONS?
OR SHALL WE JUST GO TO THE BAR!
Joomla 3JLayoutsPHILIP LOCKE
CONTACT ME
Website:
www.joostrap.com
www.fastnetwebdesign.co.uk
Email:
Twitter:
@philiplocke
@joostrap