may the core be with you - jandbeyond 2014

Post on 27-Jan-2015

106 Views

Category:

Presentations & Public Speaking

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

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

TRANSCRIPT

May The Core Be With You

About this talk

Why Use More Core?

Easier Upgrades

Extension Compatibility

Knowledge Transfer

Future Proof

How To:Make The Most Out of Core

Example 1:Carousel With Modules

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

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

<?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

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

mod_custom new layout

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

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

Background Image: Slide Image

Select new alternate layout

Results

Example 2:Alternate Category Layout

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

Copy view files to template

<?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

<?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

<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

Let’s just recap

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

Example 3:Language Manager ‘Hack’

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

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

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

Any Code in Joomla!

What’s next?

Bloated CMS

Improve the CMS

Be Creative

Thanks!

“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

top related