際際滷

際際滷Share a Scribd company logo
Creating Components
without creating components
Brad Markle
@bwmarkle
inmotionhosting.com
an extension
What is a component?
plugins / modules / components
What is an extension?
What is an extension?
Components
Plugins
Modules
Which Components come already
installed?
Joomla Day MN 2014 - Brad Markle
But what if you need
 wiki
 forum
 classifieds
 site map
 glossary page
 support / ticket system
OPTION 1/4
Core hack:Just find the correct php files and edit
them
My site needs a _______.
OPTION 2/4 - Download an extension
My site needs a _______.
Joomla Day MN 2014 - Brad Markle
OPTION 3/4 - Install additional software
My site needs a _______.
Joomla Day MN 2014 - Brad Markle
Joomla Day MN 2014 - Brad Markle
Joomla Day MN 2014 - Brad Markle
wiki.yourdomain.com
yourdomain.com/wiki
store.yourdomain.com
yourdomain.com/store
OPTION 4/4
BUILD IT!
My site needs a _______.
BUILD IT yourself
 Build a component  Create a
template override
Youre not going to learn it in an hour
Component Development
Joomla Day MN 2014 - Brad Markle
Wha ha ha, excellent.
Oh, you can write PHP?
Where do they go?
Template Overrides
JOOMLA/components/ com_content/views/ article/tmpl/ default.php
TEMPLATE_NAME/html/ com_content/ article/
default.php
What are they named?
Template Overrides
default.php
Applied to all
**.php
Applied on a case-by-
case basis
How are they activated?
Template Overrides
default.php
No action needed
**.php
Edit Article
Options
Alternative
Layout
I use this stuff every day
Essential Techniques
// Get a db connection
$db = JFactory::getDbo();
id name email username
1 John Smith johnsmith@domain.example johnsmith
2 Magda Hellman magda_h@domain.example magdah
3 Yvonne de Gaulle ydg@domain.example ydegaulle
loadResult()
loadObject()
id name email username
1 John Smith johnsmith@domain.example johnsmith
2 Magda Hellman magda_h@domain.example magdah
3 Yvonne de Gaulle ydg@domain.example ydegaulle
loadObjectList()
id name email username
1 John Smith johnsmith@domain.example johnsmith
2 Magda Hellman magda_h@domain.example magdah
3 Yvonne de Gaulle ydg@domain.example ydegaulle
// get information on the current user
$user = JFactory::getUser();
Prints human-readable information about a variable
print_r
// Convert all applicable characters to HTML entities
htmlentities
<script>
// harmful code goes here
</script>
&lt;script&gt;
// harmful code goes here
&lt;/script&gt;
<input type=text value=Howdy yall />
// because injections and 1064s arent fun
addslashes
INERT INTO #__table
(`id`,`message`)
VALUES (null,Howdy
Yall)
JRequest::getVar('option');
// com_content
JRequest::getVar('view');
// article
JRequest::getVar('id');
// 1
please work, please work, please work, please work, please work,
please work, please work, please work, please work, please work, please work
Live Demonstration

More Related Content

Joomla Day MN 2014 - Brad Markle