Top Banner
May The Core Be With You
51

May the core be with you - JandBeyond 2014

Jan 27, 2015

Download

Chad Windnagle

Slides from Chad Windnagle's talk at JandBeyond 14.

Full description:
Joomla has some amazing and powerful technology that can make using it for highly customized sites very easy. Learn how to embrace the Joomla core, stop using extensions for simple things that Joomla can already do, and make upgrading or migrating your sites much easier. This session will demonstrate to attendees the methods used to customize Joomla in simple ways that have a big impact on building sites that make the most out of core as possible.

Specific techniques that will be demonstrated:
-Language Overrides
-Template Overrides
-Module Chromes

http://jandbeyond.org/program/sessions/may-the-core-be-with-you.html
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: May the core be with you - JandBeyond 2014

May The Core Be With You

Page 2: May the core be with you - JandBeyond 2014

About this talk

Page 3: May the core be with you - JandBeyond 2014
Page 4: May the core be with you - JandBeyond 2014
Page 5: May the core be with you - JandBeyond 2014

Why Use More Core?

Page 6: May the core be with you - JandBeyond 2014

Easier Upgrades

Page 7: May the core be with you - JandBeyond 2014

Extension Compatibility

Page 8: May the core be with you - JandBeyond 2014
Page 9: May the core be with you - JandBeyond 2014

Knowledge Transfer

Page 10: May the core be with you - JandBeyond 2014

Future Proof

Page 11: May the core be with you - JandBeyond 2014
Page 12: May the core be with you - JandBeyond 2014
Page 13: May the core be with you - JandBeyond 2014

How To:Make The Most Out of Core

Page 14: May the core be with you - JandBeyond 2014

Example 1:Carousel With Modules

Page 15: May the core be with you - JandBeyond 2014

Order of Operations1. Add chrome to modules.php2. Add position to template index.php3. Add new custom module layout4. Add module instances to position5. Check the result

Page 16: May the core be with you - JandBeyond 2014

function modChrome_carouselInner($module, &$params, $attribs){

$img = $params->get('backgroundimage');$sfx = htmlspecialchars($params-

>get('moduleclass_sfx'));

if ($module->content) {echo "<div class=\"item" . $sfx . "\">";echo "<img src=\"" . $img . "\" \>";echo "<div class=\"carousel-caption\">";echo $module->content;echo "</div>";echo "</div>";

}}

modules.php

Page 17: May the core be with you - JandBeyond 2014

<?php if ($this->countModules('carousel')): ?><div id="bootstrap-carousel" class="carousel slide">

<div class="carousel-inner"><jdoc:include type="modules"

name="carousel" style="carouselInner"

/></div><a class="carousel-control left"

href="#bootstrap-carousel" data-slide="prev">&lsaquo;

</a><a class="carousel-control right"

href="#bootstrap-carousel" data-slide="next">&rsaquo;

</a></div>

<?php endif; ?>

template’s index.php

Page 18: May the core be with you - JandBeyond 2014

<?php echo $module->content; ?>

mod_custom new layout

Page 19: May the core be with you - JandBeyond 2014

Sanity CheckFile Locations

Template Index File (new module positon):<jroot>/templates/my_template/index.php

Modules.php File (new module chrome):<jroot>/templates/my_template/html/modules.php

Custom Module Layout (for mod_custom):<jroot>/templates/my_template/html/mod_custom/text.php

Page 20: May the core be with you - JandBeyond 2014
Page 21: May the core be with you - JandBeyond 2014

Position: carouselContent: description textDiv Class: active (first slide/module)Title: slide title

Page 22: May the core be with you - JandBeyond 2014

Background Image: Slide Image

Page 23: May the core be with you - JandBeyond 2014

Select new alternate layout

Page 24: May the core be with you - JandBeyond 2014

Results

Page 25: May the core be with you - JandBeyond 2014
Page 26: May the core be with you - JandBeyond 2014
Page 27: May the core be with you - JandBeyond 2014

Example 2:Alternate Category Layout

Page 28: May the core be with you - JandBeyond 2014

Order of Operations1. Copy some view files to the template2. Make some minor code changes

a. this is an ‘alternate layout’3. Add new menu item4. Check the result

Page 29: May the core be with you - JandBeyond 2014

Copy view files to template

Page 30: May the core be with you - JandBeyond 2014

<?xml version="1.0" encoding="utf-8"?><metadata>

<layout title="COM_CONTENT_CATEGORY_VIEW_BLOG_TITLE" option="COM_CONTENT_CATEGORY_VIEW_BLOG_OPTION">

<helpkey =

"JHELP_MENUS_MENU_ITEM_ARTICLE_CATEGORY_BLOG"/><message>

<![CDATA[COM_CONTENT_CATEGORY_VIEW_BLOG_DESC]]>

</message></layout>

blog.xml

Page 31: May the core be with you - JandBeyond 2014

<?xml version="1.0" encoding="utf-8"?><metadata>

<layout title="COM_CONTENT_CATEGORY_VIEW_ACCORDION_TITLE" option="COM_CONTENT_CATEGORY_VIEW_ACCORDION_OPTION">

<helpkey =

"JHELP_MENUS_MENU_ITEM_ARTICLE_CATEGORY_BLOG"/><message>

<![CDATA[COM_CONTENT_CATEGORY_VIEW_BLOG_DESC]]>

</message></layout>

accordion.xml

Page 32: May the core be with you - JandBeyond 2014

<div class="accordion-group"><div class="accordion-heading">

<a class="accordion-toggle" data-toggle="collapse" data-parent="#cat-accord-<?php echo

$this->item->catid; ?>" href="#accordion-<?php echo $this-

>item->id; ?>"><?php echo $this->item->title; ?

></a>

</div> <div id="accordion-<?php echo $this->item->id; ?>" class="accordion-body collapse"> <?php // the content ?> </div></div>

accordion_item.php

Page 33: May the core be with you - JandBeyond 2014
Page 34: May the core be with you - JandBeyond 2014
Page 35: May the core be with you - JandBeyond 2014
Page 36: May the core be with you - JandBeyond 2014

Let’s just recap

Page 37: May the core be with you - JandBeyond 2014
Page 38: May the core be with you - JandBeyond 2014

500+ Extensions!?(Or we could just use core…)

Page 39: May the core be with you - JandBeyond 2014

Example 3:Language Manager ‘Hack’

Page 40: May the core be with you - JandBeyond 2014
Page 41: May the core be with you - JandBeyond 2014
Page 42: May the core be with you - JandBeyond 2014

<?php // some view, or model, or controller, or anything ?>

<?php echo JText::_('GLOBAL_CONSTANT'); ?>

<?php // the rest of your code ?>

Any Code in Joomla!

Page 43: May the core be with you - JandBeyond 2014

What’s next?

Page 44: May the core be with you - JandBeyond 2014
Page 45: May the core be with you - JandBeyond 2014

Bloated CMS

Page 46: May the core be with you - JandBeyond 2014
Page 47: May the core be with you - JandBeyond 2014

Improve the CMS

Page 48: May the core be with you - JandBeyond 2014

Be Creative

Page 49: May the core be with you - JandBeyond 2014

Thanks!

Page 50: May the core be with you - JandBeyond 2014
Page 51: May the core be with you - JandBeyond 2014

“Fear is the path to the Dark Side. Fear leads to anger, anger leads to hate, hate leads to suffering.”- Yoda

Better Understood as:

“Extensions are the path to the dark side. Extensions lead to migration problems, swearing and suffering.”- Unknown