Kapitel 4

4.1 Ausschnitt der modifizierten robots.txt-Datei
User-agent: *
Disallow: /administrator/
Disallow: /bin/
#Disallow: /cache/
Disallow: /cli/
Disallow: /components/
Disallow: /includes/
Disallow: /installation/
Disallow: /language/
Disallow: /layouts/
Disallow: /libraries/
Disallow: /logs/
Disallow: /modules/
Disallow: /plugins/
Disallow: /tmp/

Kapitel 9

9.1 Angepasste CSS-Definition in der beez5.css
#logo span.header1 {
    display: block;
    top: 0;
    line-height: 0.8em;
    font-size: 0.7em;
    padding-left: 55px;
    color: white;
}

Kapitel 12

12.1 Angaben in der Template-Sprachdatei /de-DE.tpl_ihrtemplate.sys.ini
                    COM_CONTENT_CATEGORY_VIEW_PORTFOLIO_TITLE="Portfolio Ansicht"
                    COM_CONTENT_CATEGORY_VIEW_PORTFOLIO_OPTION="Portfolio"
                    COM_CONTENT_CATEGORY_VIEW_PORTFOLIO_DESC="Mit dieser Auswahl legen Sie ein Blog mit Portfolio Layout an"
                    
12.2 Basisangaben in der portfolio.xml-Datei
                    
                      
                        
                             COM_CONTENT_CATEGORY_VIEW_PORTFOLIO_DESC
                        
                      
                 
12.3 Einfache Modul-Chrome-Funktion in der modules.php-Datei
                    function modChrome_meinstil($module, &$params, &$attribs)
                    {
                     if ($module->content)
                     {
                        echo $module->content;
                     }
                    }
                
12.4 Überschreiben der Dateien aus dem media/jui/js/-Ordner
                templates/ihrtemplate/js/jui/bootstrap.min.js
                templates/ihrtemplate/js/jui/html5.js
                templates/ihrtemplate/js/jui/jQuery.min.js
                templates/ihrtemplate/js/jui/jQuery-migrate.min.js
                templates/ihrtemplate/js/jui/jQuery-noconflict.min.js
                
12.5 Überschreiben der Dateien aus dem media/system/js-Ordner
                templates/ihrtemplate/js/system/caption.js
                templates/ihrtemplate/js/system/core.js
                templates/ihrtemplate/js/system/html5fallback.js
                templates/ihrtemplate/js/system/polyfill.event.js
                
12.6 Beispielcode einer Dritterweiterung (Suche nach vorhandendem Override)
                $css_path = JPATH_THEMES. '/'.$document->template.'/css/'.$module_name;
                    if(file_exists($css_path.'/'.$style.'.css'))
                    {
                        $document->addStylesheet(JURI::base(true) .
                        '/templates/'.$document->template.'/css/'. $module_name.' /'.$style.'.css');
                    }

                
12.7 Ansicht der Datei layouts/joomla/content/readmore.php


                    

12.8 Erster Teil der templateDetails.xml-Datei
                
                    
                        paula
                        2017
                        Elisa Foltyn
                        book@coolcat-creations.com
                        http://www.coolcat-creations.com
                        Copyright 2013-2016 Blackrock Digital LLC
                        Code released under the [MIT]
                        (https://github.com/BlackrockDigital/startbootstrap-creative/blob/gh-pages/LICENSE)  license.
                        
                        1.0
                        TPL_PAULA_DESC
                
12.9 Datei- und Ordnerstrukturauflistung in der templateDetails.xml-Datei

 index.php
 templateDetails.xml
 template_preview.png
 template_thumbnail.png
 favicon.ico
 LICENSE
 css
 html
 images
 js
 language
 less
 vendor


                
12.10 Auflistung der Modulpositionen in der templateDetails.xml-Datei

 mainnav
 header
 teaser
 top
 breadcrumbs
 right
 portfolio
 action
 contact


                
12.11 Übersetzung Modulpositionen in der de-DE.tpl_paula.sys.ini-Datei
TPL_PAULA_POSITION_MAINNAV="Hauptnavigation"
TPL_PAULA_POSITION_HEADER="Headerbereich"
TPL_PAULA_POSITION_TEASER="Teaserbereich"
TPL_PAULA_POSITION_TOP="Oben"
TPL_PAULA_POSITION_BREADCRUMBS="Navigationspfad"
TPL_PAULA_POSITION_RIGHT="Rechts"
TPL_PAULA_POSITION_PORTFOLIO="Referenzen"
TPL_PAULA_POSITION_ACTION="Call to Action"
TPL_PAULA_POSITION_CONTACT="Kontakt"
               
12.12 Auflistung der Template-Parameter in der templateDetails.xml-Datei

 
  
12.13 Übersetzung der Template-Parameter in der de-DE.tpl_paula.ini-Datei
TPL_PAULA_FIELD_THEME="Templatefarbe"
TPL_PAULA_FIELD_THEME_DESC="Wählen Sie hier die Templatefarbe aus"
TPL_PAULA_FIELD_THEME_ORANGE="Orange"
TPL_PAULA_FIELD_THEME_BLUE="Blau"
TPL_PAULA_FIELD_LOGOTYPE="Logoart"
TPL_PAULA_FIELD_LOGOTYPE_DESC="Wählen Sie hier aus ob Sie das Logo als Text oder Bild darstellen wollen"
TPL_PAULA_FIELD_LOGOTYPE_TEXT="Textlogo"
TPL_PAULA_FIELD_LOGOTYPE_IMG="Bildlogo"
TPL_PAULA_FIELD_LOGOTEXT="Logotext"
TPL_PAULA_FIELD_LOGOTEXT_DESC="Tragen Sie hier den Text ein, der als Logo erscheinen soll"
TPL_PAULA_FIELD_LOGOIMG="Bild hochladen"
TPL_PAULA_FIELD_LOGOIMG_DESC="Laden Sie hier ein Bild im Format 200 x 20px hoch"
TPL_PAULA_FIELD_LOGOIMG_ALT="Logo Alt Text"
TPL_PAULA_FIELD_IMGUPLOAD_ALT_DESC="Tragen Sie hier den Alt-tag für das Logobild ein"

                
12.14 Auflistung der Sprachdateien in der templateDetails.xml-Datei

 en-GB/en-GB.tpl_paula.ini
 en-GB/en-GB.tpl_paula.sys.ini
 de-DE/de-DE.tpl_paula.ini
 de-DE/de-DE.tpl_paula.sys.ini

                
12.15 Vollständige templateDetails.xml für unser Template.

                    
 paula
 2017
 Elisa Foltyn
 book@coolcat-creations.com
 http://www.coolcat-creations.com
 Copyright 2013-2016 Blackrock Digital LLC
 Code released under the [MIT]
 (https://github.com/BlackrockDigital/startbootstrap-creative/blob/gh-pages/LICENSE) license.
 
 1.0
 TPL_PAULA_DESC
 
  index.php
  templateDetails.xml
  template_preview.png
  template_thumbnail.png
  favicon.ico
  LICENSE
  css
  html
  images
  js
  language
  less
  vendor
 

 
  mainnav
  header
  teaser
  top
  breadcrumbs
  right
  portfolio
  action
  contact
 


 
  
en-GB/en-GB.tpl_paula.ini en-GB/en-GB.tpl_paula.sys.ini de-DE/de-DE.tpl_paula.ini de-DE/de-DE.tpl_paula.sys.ini
12.16 Style-Angaben in der index.php-Datei
// Laden der Bootstrap CSS
$this->addStyleSheet($tplpath . '/vendor/bootstrap/css/bootstrap.min.css');

// Schriften laden
$this->addStyleSheet($tplpath . '/vendor/font-awesome/css/font-awesome.min.css');
$this->addStyleSheet('https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800');
$this->addStyleSheet('https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic');

// CSS Datei für die Portfolio Popups laden
$this->addStyleSheet($tplpath . '/vendor/magnific-popup/magnific-popup.css');

// CSS Dateien für das Template laden
$this->addStyleSheet($tplpath . '/css/creative.css');
                
12.17 Skript-Angaben in der index.php Datei
// Skripte laden

// HTML5 Unterstützung aktivieren
$this->setHtml5(true);

// jQuery Skript von Joomla! laden
JHtml::_('jquery.framework');

// Bootstrap von Joomla! einbinden
// (Die Bootstrap Datei muss nicht extra geladen werden, nur in den richtigen Ordner verschoben werden)
JHtml::_('bootstrap.framework');

// Laden der Skriptdateien für Easing, Scrolling und Popups
$this->addScript('https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js', 'text/javascript', array('defer'=>'defer'));
$this->addScript($tplpath. '/vendor/scrollreveal/scrollreveal.min.js', 'text/javascript', array('defer'=>'defer'));
$this->addScript($tplpath. '/vendor/magnific-popup/jquery.magnific-popup.min.js', 'text/javascript', array('defer'=>'defer'));

// Laden der Skriptdateien für das Template
$this->addScript($tplpath . '/js/creative.min.js', 'text/javascript', array('defer'=>'defer'));

                
12.18 CustomTag und Meta-Angaben in der index.php-Datei
// nur für den IE 9 nutzen wir hier customTags
// Custom Tags für den IE9 definieren
$stylelink = '' . "\n";

// Custom Tags für den IE9 hinzufügen
$this->addCustomTag($stylelink);

// MetaTag für den Viewport definieren
$this->setMetaData('viewport', 'width=device-width, initial-scale=1');

                
12.19 Einleitung der index.php-Datei
<?php defined('_JEXEC') or die('Restricted access');

// Hier definieren wir eine kurze Variable fÃŒr den aktuellen Templatepfad
$tplpath = $this->baseurl . '/templates/' . $this->template;

// Laden der Joomla! System CSS
$this->addStyleSheet($this->baseurl . '/templates/system/css/system.css');

// Laden der Bootstrap Core CSS
$this->addStyleSheet($tplpath . '/vendor/bootstrap/css/bootstrap.min.css');

// Schriften laden
$this->addStyleSheet($tplpath . '/vendor/font-awesome/css/font-awesome.min.css');
$this->addStyleSheet('https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800');
$this->addStyleSheet('https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic');

// CSS Datei fÃŒr die Portfolio Popups laden
$this->addStyleSheet($tplpath . '/vendor/magnific-popup/magnific-popup.css');

// CSS Datei fÃŒr das Template laden
$this->addStyleSheet ($this->baseurl . '/templates/' . $this->template . '/css/creative.css');

// Skripte laden

// jQuery Skript von Joomla! laden
JHtml::_('jquery.framework');

// Bootstrap von Joomla! einbinden
// (Die Bootstrap Datei muss nicht extra geladen werden, nur in den richtigen Ordner verschoben werden)
JHtml::_('bootstrap.framework');

// Laden der Skriptdateien fÃŒr Easing, Scrolling und Popups
$this->addScript('http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js', 'text/javascript', true, false);
$this->addScript($tplpath. '/vendor/scrollreveal/scrollreveal.min.js', 'text/javascript', true, false);
$this->addScript($tplpath . '/vendor/magnific-popup/jquery.magnific-popup.min.js', 'text/javascript', true, false);

// Laden der Skriptdateien fÃŒr das Template
$this->addScript($tplpath . '/js/creative.min.js', 'text/javascript', true, false);

// Dokument Objekt laden //
$doc = JFactory::getDocument();

// nur fÃŒr den IE 9 nutzen wir hier customTags
// Custom Tags fÃŒr den IE9 definieren
$stylelink = '<!--[if lte IE 9]>' . "\n";
                $stylelink .= '<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>' . "\n";
                $stylelink .= '<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>' . "\n";
                $stylelink .= '<![endif]-->' . "\n";

// Custom Tags fÃŒr den IE9 hinzufÃŒgen
$this->addCustomTag($stylelink);

// MetaTag fÃŒr den Viewport definieren
$this->setMetaData('viewport', 'width=device-width, initial-scale=1');
?>
                
12.20 Dynamischer Abruf des Template-Stils in der index.php-Datei
// Falls im Stil „orange“ als Farbe ausgewählt ist, lade creative.css
if ($this->params->get('templatecolor', 'orange') == 'orange' )
 {
  $this->addStyleSheet ('$tplpath . '/css/creative.css');
 }
// Andernfalls ist die blaue CSS-Datei zu laden
else
 {
  $this->addStyleSheet ($tplpath . '/css/creative-blue.css');
 }

                
12.21 Dynamischer Abruf der Template-Parameter für das Logo in der index.php

<?php if ($this->params->get('logotype', 'text') == 'image')
    { ?>
    <img src="<?php echo $this->params->get('logoimg', ''); ?>" alt="<?php echo $this->params->get('logoimgalt', ''); ?>" width="200px" height="20px" />
    <?php }
    else
    { ?>
    <?php echo $this->params->get('logotext', ''); ?>
    <?php } ?>
</a>
12.22 Code aus der Template-Vorlage für die Navigation
<nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
 <div class="container-fluid">
  <!-- Brand and toggle get grouped for better mobile>
  <div class="navbar-header">
   <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
   data-target="#bs-example-navbar-collapse-1">
   <span class="sr-only">Toggle navigation</span> Menu
   <i class="fa fa-bars"></i>
   </button>

  <a class="navbar-brand page-scroll" href="<?php echo $this->baseurl ?>">

   <?php if ($this->params->get('logotype', 'text') == 'image')
   { ?>
      <img src="<?php echo $this->params->get('logoimg', ''); ?>"
      alt="<?php echo $this->params->get('logoimgalt', ''); ?>" width="200px" height="20px" />
   <?php }
   else
   { ?>
      <?php echo $this->params->get('logotext', ''); ?>
   <?php } ?>

  </a>
 </div>
<!-- Collect the nav links, forms, and other content for toggling -->
 <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
  <ul class="nav navbar-nav navbar-right">
    <li>
     <a class="page-scroll" href="#about">About</a>
    </li>
    <li>
     <a class="page-scroll" href="#services">Services</a>
    </li>
    <li>
     <a class="page-scroll" href="#portfolio">Portfolio</a>
    </li>
    <li>
     <a class="page-scroll" href="#contact">Contact</a>
    </li>
   </ul>
  div>
     <!-- /.navbar-collapse -->
 </div>
     <!-- /.container-fluid -->
</nav>

                
12.23 Modul Chrome für die Navigation in der modules.php-Datei
function modChrome_navigation($module, &$params, &$attribs)
{
$moduleTag           = $params->get('module_tag', div);
$moduleclass_sfx     = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');

if (!empty ($module->content)) : ?>

  <<?php echo $moduleTag; ?> class="collapse navbar-collapse
                    <?php echo $moduleclass_sfx; ?>" id="bs-example-navbar-collapse-1">
                    <?php echo $module->content; ?>
  </<?php echo $moduleTag; ?>>

                <?php endif;
}

                </pre>


                <strong>
                    Listing 12.24	Navigation in der index.php-Datei
                </strong>

                <pre class="brush: plain">
<nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
 <div class="container-fluid">
  <!-- Brand and toggle get grouped for better mobile display -->
  <div class="navbar-header">
   <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
           data-target="#bs-example-navbar-collapse-1">
    <span class="sr-only">Toggle navigation</span> Menu <i class="fa fa-bars"></i>
   </button>
   <a class="navbar-brand page-scroll" href="<?php echo $this->baseurl ?>">

   <!-- Abfrage der Parameter fÃŒr das Logo -->
       <?php if ($this->params->get('logotype', 'text') == 'image') { ?>
       <!-- Ausgabe des Logo-Bildes -->
    <img src="<?php echo $this->params->get('logoimg', ''); ?>"
         alt="<?php echo $this->params->get('logoimgalt', ''); ?>" width="200px"
         height="20px" />
       <?php }
   else { ?>
       <!-- Ausgabe des Logo-Textes -->
       <?php echo $this->params->get('logotext', ''); ?>
       <?php } ?>

   </a>
  </div>

     <!-- Hier laden wir nun die Position mainnav mit dem Stil navigation -->
   <jdoc:include type="modules" name="mainnav" style="navigation"/>

   </div> <!-- /.container-fluid -->
</nav>
                </pre>


                <strong>
                    12.25	Code fÃŒr den header-Bereich in der Template-Vorlage
                </strong>

                <pre class="brush: plain">
<header>
 <div class="header-content">
  <div class="header-content-inner">
   <h1 id="homeHeading">
    Your Favorite Source of Free Bootstrap Themes
   </h1>
   <hr>
   <p>Start Bootstrap can help you build better websites
   using the Bootstrap CSS framework! Just download your
   template and start going, no strings attached!</p>
   <a href="#about" class="btn btn-primary btn-xl page-scroll">
    Find Out More
   </a>
  </div>
 </div>
                </pre>


                <strong>
                    12.26	Teil 1 des Modul Chrome fÌr den Header in der modules.php-Datei mit Variablen
                </strong>

                <pre class="brush: plain">
function modChrome_header($module, &$params, &$attribs)
{
$moduleTag = $params->get('module_tag', 'header');
$moduleId = $module->position . '-' . $module->id;
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');
$headerTag = htmlspecialchars($params->get('header_tag', 'h1'), ENT_COMPAT, 'UTF-8');
$headerClass = htmlspecialchars($params->get('header_class', ''), ENT_COMPAT, 'UTF-8');
$bgimage = 'style="background-image:url('. $params->get('backgroundimage') .');"';
if ($module->content)
{
?>
                </pre>


                <strong>
                    12.27	Teil 2 des Modul Chrome fÌr den Header in der modules.php
                </strong>

                <pre class="brush: plain">
<<?php echo $moduleTag; ?> id="<?php echo $moduleId; ?>" class="<?php echo $moduleclass_sfx; ?>" <?php echo $bgimage; ?>>

                </pre>


                <strong>
                    12.28	Teil 3 des Modul Chrome fÌr den Header in der modules.php
                </strong>

                <pre class="brush: plain">
<div class="header-content">
 <div class="header-content-inner">

                </pre>


                <strong>12.29	Teil 4 des Modul-Chrome fÌr den Header in der modules.php
                </strong>

                <pre class="brush: plain">
                    <?php if $module->showtitle) : ?>
 <<?php echo $headerTag . ' class=" ' . $headerClass . '"'; ?>>
                    <?php echo $module->title; ?>
 </<?php echo $headerTag; ?>>
                <?php endif; ?>

                
12.30 Teil 5 des Modul-Chrome für den Header in der modules.php
                         <?php echo $module->content; ?>
    </div>
    </div>
  </<?php echo $moduleTag; ?>>
 <?php
 }
}
                
12.31 Fertiggestelltes Modul-Chrome für den Header in der modules.php
                    /* Chrome fÃŒr das Headermodul */
function modChrome_header($module, &$params, &$attribs){
 $moduleTag = $params->get('module_tag', 'header');
 $moduleId = $module->position . '-' . $module->id;
 $moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');
 $headerTag = htmlspecialchars($params->get('header_tag', 'h1'), ENT_COMPAT, 'UTF-8');
 $headerClass = htmlspecialchars($params->get('header_class', ''), ENT_COMPAT, 'UTF-8');
 $bgimage = 'style="background-image:url('. $params->get('backgroundimage') .');"';

 if ($module->content) {
 ?>

 <<?php echo $moduleTag; ?> id="<?php echo $moduleId; ?>" class="<?php echo $moduleclass_sfx; ?>" <?php echo $bgimage; ?>>
  <div class="header-content">
   <div class="header-content-inner">

    <?php if ($module->showtitle) : ?>

     <<?php echo $headerTag . ' class=" ' . $headerClass . '"'; ?>>
      <?php echo $module->title; ?>
     </<?php echo $headerTag; ?>>

    <?php endif; ?>

    <?php echo $module->content; ?>
   </div>
  </div>
 </<?php echo $moduleTag; ?>>
<?php
 }
}

                
12.32 Ausgabe der modules/mod_custom/tmpl/default.php-Datei
<?php defined('_JEXEC') or die; ?>
<div class="custom<?php echo $moduleclass_sfx ?>"
  <?php if ($params->get('backgroundimage')) : ?> style="background-image:url(<?php echoparams->get('backgroundimage');?>)"<?php endif;?>>
  <?php echo $module->content;?>
</div>

                
12.33 Code der Datei templates/paula/html/mod_custom/clean.php
<?php defined('_JEXEC') or die; ?>
<?php echo $module->content;?>
                
12.34 Code des Teaser-Bereichs in der Template-Vorlage
                    <section class="bg-primary" id="about">
 <div class="container">
  <div class="row">
   <div class="col-lg-8 col-lg-offset-2 text-center">
    <h2 class="section-heading">We've got what you need!</h2>
    <hr class="light">
    <p class="text-faded">Start Bootstrap has everything you need to get your new website up and running inno time! All of the templates and themes on Start Bootstrap are open source, free to download, and easy to use. No strings attached!</p>
    <a href="#services" class="page-scroll btn btn-default btn-xl sr-button">Get Started!</a>
   </div>
  </div>
 </div>
                
12.35 Erster Teil des Modul Chrome für den Teaser-Bereich in der Datei modules.php
function modChrome_primary($module, &$params, &$attribs)
{
 $moduleTag = $params->get('module_tag', 'header');
 $moduleId = $module->position . '-' . $module->id;
 $moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');
 $headerTag = htmlspecialchars($params->get('header_tag', 'h1'), ENT_COMPAT, 'UTF-8');
 $headerClass = htmlspecialchars($params->get('header_class', ''), ENT_COMPAT, 'UTF-8');
 $bgimage = 'style="background-image:url('. $params->get('backgroundimage') .');"';

 if ($module->content) {
?>
                
12.36 Zweiter Teil des Modul Chrome für den Teaser-Bereich in der Datei modules.php
                    <<?php echo $moduleTag; ?> class="bg-primary" id="<?php echo $moduleId; ?>" <?php echo $bgimage; ?>>
 <div class="container">
  <div class="row">
   <div class="<?php echo $moduleclass_sfx ?>">

    <?php if ($module->showtitle) : ?>

     <<?php echo $headerTag . ' class=" ' . $headerClass . '"'; ?>>
      <?php echo $module->title; ?>
     </<?php echo $headerTag; ?>>

    <?php endif; ?>

    <?php echo $module->content; ?>
   </div>
  </div>
 </div>
</<?php echo $moduleTag; ?>>

<?php
 }
}

                
12.37 Einsetzen der Variablen in das Alternative Layout für den Iconmodul-Bereich in der Datei templates/paula/html/mod_articles_news/iconmodule.php
                    <?php defined('_JEXEC') or die;
 $moduleTag = $params->get('module_tag', 'section');
 $moduleId = $module->position . '-' . $module->id;
 $headerTag = htmlspecialchars($params->get('header_tag', 'h3'), ENT_COMPAT, 'UTF-8');
 $headerClass = $params->get('header_class');
 $headerClass = !empty($headerClass) ? ' class="section-heading ' . htmlspecialchars($headerClass, ENT_COMPAT, 'UTF-8') . '"' : '';

 $item_heading = $params->get('item_heading', 'h4');
 $iconitems = count($list);
 $lgclass = floor(12 / $iconitems);
?>

<div class="newsflash<?php echo $moduleclass_sfx; ?>">
   <?php foreach ($list as $item) : ?>
      <?php require JModuleHelper::getLayoutPath('mod_articles_news', '_item'); ?>
   <?php endforeach; ?>
</div>

                
                
12.38 Iconmodul-Bereich in der Template-Vorlage
                    <section id="services">
 <div class="container">
  <div class="row">
   <div class="col-lg-12 text-center">
    <h2 class="section-heading">At Your Service</h2>
    <hr class="primary">
   </div>
  </div>
 </div>
 <div class="container">
  <div class="row">
   <div class="col-lg-3 col-md-6 text-center">
    <div class="service-box">
     <i class="fa fa-4x fa-diamond text-primary sr-icons"></i>
     <h3>Sturdy Templates</h3>
     <p class="text-muted">Our templates are updated regularly so they don't break.</p>
    </div>
   </div>
   <div class="col-lg-3 col-md-6 text-center">
    <div class="service-box">
     <i class="fa fa-4x fa-paper-plane text-primary sr-icons"></i>
     <h3>Ready to Ship</h3>
     <p class="text-muted">You can use this theme as is, or you can make changes!</p>
    </div>
   </div>
   <div class="col-lg-3 col-md-6 text-center">
    <div class="service-box">
     <i class="fa fa-4x fa-newspaper-o text-primary sr-icons"></i>
     <h3>Up to Date</h3>
     <p class="text-muted">We update dependencies to keep things fresh.</p>
    </div>
   </div>
  </div>
 </div>
</section>

                
12.39 Fertiggestelltes, Alternatives Layout für den Iconmodul-Bereich in der Datei templates/paula/html/mod_articles_news/iconmodule.php
                    <?php defined('_JEXEC') or die;
$moduleTag   = $params->get('module_tag', 'section');
$moduleId    = $module->position . '-' . $module->id;
$headerTag   = htmlspecialchars($params->get('header_tag', 'h2'), ENT_COMPAT, 'UTF-8');
$headerClass = $params->get('header_class');
$headerClass = !empty($headerClass) ? ' class="section-heading ' . htmlspecialchars($headerClass, ENT_COMPAT, 'UTF-8') . '"' : '';

$item_heading = $params->get('item_heading', 'h4');
$iconitems    = count($list);
$lgclass      = floor(12 / $iconitems);
?>
<<?php echo $moduleTag; ?> class="<?php echo $moduleclass_sfx; ?>" id="<?php echo $moduleId; ?>">

<!-- Abfrage ob der Modultitel dargestellt werden soll -->
<?php if ($module->showtitle) : ?>
   <div class="container">
      <div class="row">
         <div class="col-lg-12 text-center">
            <<?php echo $headerTag . ' class=" ' . $headerClass . '"'; ?>>
               <?php echo $module->title; ?>
            </<?php echo $headerTag; ?>>
            <hr class="primary">
         </div>
      </div>
   </div>
<?php endif; ?>

<div class="container">
   <div class="row">
      <!-- Foreach Schleife - ruft die Artikel aus der gewÀhlten Kategorie in einer Schleife auf -->
      <?php foreach ($list as $item) : ?>
         <div class="col-lg-<?php echo $lgclass; ?> text-center ">
            <div class="service-box">
               <!-- Abfrage ob der Titel eingeblendet werden soll -->
               <?php if ($params->get('item_title')) : ?>

                  <!-- Ausgabe des �berschriften-Tags mit Modulklassen-Suffix -->
                  <<?php echo $item_heading; ?> class="newsflash-title<?php echo $params->get('moduleclass_sfx'); ?>">

                  <!-- Abfrage ob der Titel mit Link ausgegeben werden soll -->
                  <?php if ($params->get('link_titles') && $item->link != '') : ?>
                     <a href="<?php echo $item->link; ?>">
                     <?php echo $item->title; ?>
                     </a>

                  <?php else : ?>
                     <!-- Ansonsten Titel ohne Link ausgeben -->
                     <?php echo $item->title; ?>
                  <?php endif; ?>

               </<?php echo $item_heading; ?>>

               <?php endif; ?>

               <?php if (!$params->get('intro_only')) : ?>
                  <?php echo $item->afterDisplayTitle; ?>
               <?php endif; ?>

               <?php echo $item->beforeDisplayContent; ?>

               <?php if ($params->get('show_introtext', '1')) : ?>
                  <?php echo $item->introtext; ?>
               <?php endif; ?>

               <?php echo $item->afterDisplayContent; ?>

               <?php if (isset($item->link) && $item->readmore != 0 && $params->get('readmore')) : ?>
                  <?php echo '<a class="readmore" href="' . $item->link . '">' . $item->linkText . '</a>'; ?>
               <?php endif; ?>
         </div>
      </div>
   <?php endforeach; ?> <!-- Ende der foreach Schleife -->
   </div> <!--Row Ende-->
</div> <!-- Container Ende -->
</<?php echo $moduleTag; ?>>

                
12.40 Portfolio-Bereich in der Template-Vorlage
                    <section class="no-padding" id="portfolio">
 <div class="container-fluid">
  <div class="row no-gutter popup-gallery">

   <div class="col-lg-4 col-sm-6">
    <a href="img/portfolio/fullsize/1.jpg" class="portfolio-box">
     <img src="img/portfolio/thumbnails/1.jpg" class="img-responsive" alt="">
     <div class="portfolio-box-caption">
      <div class="portfolio-box-caption-content">
       <div class="project-category text-faded">
        Category
       </div>
       <div class="project-name">
        Project Name
       </div>
      </div>
     </div>
    </a>
   </div>

   <div class="col-lg-4 col-sm-6">
    <a href="img/portfolio/fullsize/2.jpg" class="portfolio-box">
     <img src="img/portfolio/thumbnails/2.jpg" class="img-responsive" alt="">
     <div class="portfolio-box-caption">
      <div class="portfolio-box-caption-content">
       <div class="project-category text-faded">
        Category
       </div>
       <div class="project-name">
         Project Name
       </div>
      </div>
     </div>
    </a>
   </div>

   <div class="col-lg-4 col-sm-6">
    <a href="img/portfolio/fullsize/3.jpg" class="portfolio-box">
     <img src="img/portfolio/thumbnails/3.jpg" class="img-responsive" alt="">
     <div class="portfolio-box-caption">
      <div class="portfolio-box-caption-content">
       <div class="project-category text-faded">
        Category
       </div>
       <div class="project-name">
         Project Name
       </div>
      </div>
     </div>
    </a>
   </div>

   <div class="col-lg-4 col-sm-6">
    <a href="img/portfolio/fullsize/4.jpg" class="portfolio-box">
     <img src="img/portfolio/thumbnails/4.jpg" class="img-responsive" alt="">
     <div class="portfolio-box-caption">
      <div class="portfolio-box-caption-content">
       <div class="project-category text-faded">
        Category
       </div>
       <div class="project-name">
         Project Name
       </div>
      </div>
     </div>
    </a>
   </div>

   <div class="col-lg-4 col-sm-6">
    <a href="img/portfolio/fullsize/5.jpg" class="portfolio-box">
     <img src="img/portfolio/thumbnails/5.jpg" class="img-responsive" alt="">
     <div class="portfolio-box-caption">
      <div class="portfolio-box-caption-content">
       <div class="project-category text-faded">
        Category
       </div>
       <div class="project-name">
         Project Name
       </div>
      </div>
     </div>
    </a>
   </div>

   <div class="col-lg-4 col-sm-6">
    <a href="img/portfolio/fullsize/6.jpg" class="portfolio-box">
     <img src="img/portfolio/thumbnails/6.jpg" class="img-responsive" alt="">
     <div class="portfolio-box-caption">
      <div class="portfolio-box-caption-content">
       <div class="project-category text-faded">
        Category
       </div>
       <div class="project-name">
         Project Name
       </div>
      </div>
     </div>
    </a>
   </div>

  </div>
 </div>
</section>

                
12.41 Ausschnitt aus der Variablen-Definition in der Datei templates/paula/html/mod_articles_news/portfolio.php.
<?php defined('_JEXEC') or die;
$moduleTag      = $params->get('module_tag', 'section');
$moduleId       = $module->position . '-' . $module->id;
?>

                
12.42 Bereich um die Foreach-Schleife in der Datei templates/paula/html/mod_articles_news/portfolio.php
                    <<?php echo $moduleTag; ?> class="no-padding" id="<?php echo $moduleId; ?>">
 <div class="container-fluid">
  <div class="row no-gutter popup-gallery <?php echo $moduleclass_sfx; ?>">
   <?php foreach ($list as $item) : ?>
    <!�- Hier werden im nÀchsten Schritt die Artikel geladen -->
   </div><!-- Row Ende -->
</div><!--Container Ende -->
</<?php echo $moduleTag; ?>>



                
12.43 Fertiggestelltes Alternatives Layout für mod_articles_news in der Datei templates/paula/html/mod_articles_news/portfolio.php
<?php defined('_JEXEC') or die;
$moduleTag = $params->get('module_tag', 'section');
$moduleId = $module->position . '-' . $module->id;
?>

<<?php echo $moduleTag; ?> class="no-padding" id="<?php echo $moduleId; ?>">
 <div class="container-fluid">
  <div class="row no-gutter popup-gallery <?php echo $moduleclass_sfx; ?>">

   <!-- Foreach Schleife - ruft die Artikel aus der gewÀhlten Kategorie in einer Schleife auf -->
    <?php foreach ($list as $item) : ?>
     <!-- Zuweisung der Variablen fÃŒr das Einleitungsbild und das Bild, welches im Popup aufgeht -->

     <?php
     $images = json_decode($item->images);
     $introimg = $images->image_intro;
     $introimgalt = $images->image_intro_alt;
     $fullimg = $images->image_fulltext;
     ?>
     <!-- Ausgabe der Bildkacheln -->
     <div class="col-lg-4 col-sm-6">
      <a href="<?php echo $fullimg; ?>" class="portfolio-box">
      <img src="<?php echo $introimg; ?>" class="img-responsive" alt="<?php echo $introimgalt; ?>">

      <div class="portfolio-box-caption">
       <div class="portfolio-box-caption-content">
        <div class="project-category text-faded">
         <!-- Ausgabe des Kategorietitels -->
          <?php echo $item->category_title; ?>
        </div>
       <div class="project-name">
        <!-- Ausgabe des Artikeltitels -->
        <?php echo $item->title; ?>
       </div>
      </div>
     </div>
    </a>
   </div>
  <?php endforeach; ?>
 </div><!-- Row Ende -->
</div><!-- Container Ende -->
</<?php echo $moduleTag; ?>>

                
12.44 Call-to-Action-Bereich in der Template-Vorlage
<aside class="bg-dark">
 <div class="container text-center">
  <div class="call-to-action">
   <h2>Free Download at Start Bootstrap!</h2>
   <a href="http://startbootstrap.com/template-overviews/creative/" class="btn btn-default btn-xl sr-button">Download Now!
   </a>
  </div>
 </div>
</aside>

                
12.45 Kontaktbereich in der Template-Vorlage
<section id="contact">
 <div class="container">
  <div class="row">
   <div class="col-lg-8 col-lg-offset-2 text-center">
    <h2 class="section-heading">Let's Get In Touch!</h2>
    <hr class="primary">
    <p>Ready to start your next project with us? That's great! Give us a call or
    send us an email and we will get back to you as soon as possible!</p>
   </div>
   <div class="col-lg-4 col-lg-offset-2 text-center">
    <i class="fa fa-phone fa-3x sr-contact"></i>
    <p>123-456-6789</p>
   </div>
   <div class="col-lg-4 text-center">
    <i class="fa fa-envelope-o fa-3x sr-contact"></i>
     <p>
      <a href="mailto:your-email@your-domain.com">
       feedback@startbootstrap.com
      </a>
     </p>
    </div>
   </div>
  </div>
</section>

                
12.46 Aufruf des Kontaktbereichs in der index.php-Datei
<?php if ($this->countModules('contact')) : ?>
<section id="contact">
<div class="container">
<div class="row">
<jdoc:include type="modules" name="contact" style="none" />
</div>
</div>
</section>
                
12.47 Aufruf des Komponentenbereichs in der index.php-Datei
<main class="container" id="maincontent">
   <div class="row">
<?php
/* Variable fÃŒr SpaltenprÃŒfung */
$rechtespalte = ($this->countModules('right'));

/* Wenn die rechte Spalte existiert, dann wird der Inhalt nicht verschoben */
if($rechtespalte == '1'):
   $inhaltsklasse = 'class="col-lg-8"';

/* Wenn die rechte Spalte nicht existiert, dann wird der Inhalt um 2 Spalten verschoben */
else :
$inhaltsklasse = 'class="col-lg-8 col-lg-offset-2"';

endif;
?>
<div <?php echo $inhaltsklasse;?>>
   <!� Hier wird die Systemnachricht ausgegeben �>
   <jdoc:include type="message"/>
   <!� Navigationspfad�>
   <jdoc:include type="module" name="breadcrumbs" title="Navigationspfad"/>
   <!� Bereich fÌr die Komponentenausgabe �>
   <jdoc:include type="component"/>
</div>

<?php if ($rechtespalte) : ?>
   <div class="col-lg-4">
      <jdoc:include type="modules" name="right" style="xhtml"/>
   </div>
<?php endif; ?>
 </div>
</main>

                
12.48 Ergänzung der Template-Parameter in der templateDetails.xml-Datei
<field name="mainoutput" type="radio" default="yes"
       label="TPL_PAULA_FIELD_MAINOUTPUT"
       description="TPL_PAULA_FIELD_MAINOUTPUT_DESC">
   <option value="yes">JSHOW</option>
   <option value="no">JHIDE</option>
</field>

                
12.49 Ergänzung der Template-Parameterübersetzungen in der de-De.tpl_paula.xml-Datei
TPL_PAULA_FIELD_MAINOUTPUT="Komponentenbereich ausgeben"
TPL_PAULA_FIELD_MAINOUTPUT_DESC="WÀhlen Sie aus ob die Komponente und die rechte Seitenleiste angezeigt werden sollen."
                
12.50 Fertiggestellte index.php-Datei
<?php defined('_JEXEC') or die('Restricted access');

// Hier definieren wir eine kurze Variable fÃŒr den aktuellen Templatepfad
$tplpath = $this->baseurl . '/templates/' . $this->template;

// Laden der Bootstrap CSS
$this->addStyleSheet($tplpath . '/vendor/bootstrap/css/bootstrap.min.css');

// Schriften laden
$this->addStyleSheet($tplpath . '/vendor/font-awesome/css/font-awesome.min.css');
$this->addStyleSheet('https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800');
$this->addStyleSheet('https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic');

// CSS Datei fÃŒr die Portfolio Popups laden
$this->addStyleSheet($tplpath . '/vendor/magnific-popup/magnific-popup.css');

// CSS Dateien fÃŒr das Template laden und hinterlegten Parameter prÃŒfen.
// Bevor die CSS Dateien per Parameter eingebunden wurden, wurden die CSS folgenderma�en geladen:
// $this->addStyleSheet($tplpath . '/css/creative.css');

if ($this->params->get('templatecolor', 'orange') == 'orange')
{
 $this->addStyleSheet($tplpath . '/css/creative.css');
}
else
{
 $this->addStyleSheet($tplpath . '/css/creative-blue.css');
}

// Skripte laden

// HTML5 UnterstÃŒtzung aktivieren
$this->setHtml5(true);

// jQuery Skript von Joomla! laden
JHtml::_('jquery.framework');

// Bootstrap von Joomla! einbinden
// (Die Bootstrap Datei muss nicht extra geladen werden, nur in den richtigen Ordner verschoben werden)
JHtml::_('bootstrap.framework');

// Laden der Skriptdateien fÃŒr Easing, Scrolling und Popups
$this->addScript('https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js', 'text/javascript', array('defer'=>'defer'));
$this->addScript($tplpath. '/vendor/scrollreveal/scrollreveal.min.js', 'text/javascript', array('defer'=>'defer'));
$this->addScript($tplpath. '/vendor/magnific-popup/jquery.magnific-popup.min.js', 'text/javascript', array('defer'=>'defer'));

// Laden der Skriptdateien fÃŒr das Template
$this->addScript($tplpath . '/js/creative.min.js', 'text/javascript', array('defer'=>'defer'));

// Custom Tags fÃŒr den IE9 definieren
$stylelink = '<!--[if lte IE 9]>' . "\n";
$stylelink .= '<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>' . "\n";
$stylelink .= '    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>' . "\n";
$stylelink .= '<![endif]-->' . "\n";

// Custom Tags fÃŒr den IE9 hinzufÃŒgen
$this->addCustomTag($stylelink);

// MetaTag fÃŒr den Viewport definieren
$this->setMetaData('viewport', 'width=device-width, initial-scale=1');

?>

<!DOCTYPE html>

<html xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>">

<head>
   <!-- Hier werden die Joomla! Headerdaten geladen -->
   <jdoc:include type="head"/>

</head>

<body id="page-top">

<nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
   <div class="container-fluid">
      <!-- Brand and toggle get grouped for better mobile display -->
      <div class="navbar-header">
         <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                 data-target="#bs-example-navbar-collapse-1">
            <span class="sr-only">Toggle navigation</span> Menu <i class="fa fa-bars"></i>
         </button>
         <a class="navbar-brand page-scroll" href="#page-top">

            <!-- Abfrage der Parameter fÃŒr das Logo -->
            <?php if ($this->params->get('logotype', 'text') == 'image')
            { ?>
               <!-- Ausgabe des Logo-Bildes -->
               <img src="<?php echo $this->params->get('logoimg', ''); ?>"
                    alt="<?php echo $this->params->get('logoimgalt', ''); ?>" width="200px" height="20px"/>
            <?php }
            else
            { ?>
               <!-- Ausgabe des Logo-Textes -->
               <?php echo $this->params->get('logotext', ''); ?>
            <?php } ?>

         </a>
      </div>

      <!-- Hier laden wir nun die Position mainnav mit dem Stil navigation -->
      <jdoc:include type="modules" name="mainnav" style="navigation"/>

   </div>
   <!-- /.container-fluid -->
</nav>

<!-- Hier laden wir die Position header mit dem Stil header-->
<jdoc:include type="modules" name="header" style="header"/>

<!-- Hier laden wir die Position teaser mit dem Stil primary -->
<jdoc:include type="modules" name="teaser" style="primary"/>

<!-- Hier laden wir die Position top mit dem Stil primary -->
<jdoc:include type="modules" name="top" style="no"/>

<!-- Hier folgt der Inhaltsbereich -->
<?php if ($this->params->get('mainoutput', 'yes') == 'yes') : ?>
   <main class="container" id="maincontent">
      <div class="row">

         <?php
         /* Variable fÃŒr SpaltenprÃŒfung */
         $rechtespalte = ($this->countModules('right'));

         /* Wenn die rechte Spalte existiert, dann wird der Inhalt nicht verschoben */
         if ($rechtespalte == '1'):
            $inhaltsklasse = 'class="col-lg-8"';

         /* Wenn die rechte Spalte nicht existiert, dann wird der Inhalt um 2 Spalten verschoben */
         else :
            $inhaltsklasse = 'class="col-lg-8 col-lg-offset-2"';

         endif;

         ?>

         <div <?php echo $inhaltsklasse; ?>>
            <!� Hier wird die Systemnachricht ausgegeben �>
            <jdoc:include type="message"/>
            <!� Navigationspfad�>
            <jdoc:include type="modules" name="breadcrumbs" style="none"/>
            <!� Bereich fÌr die Komponentenausgabe �>
            <jdoc:include type="component"/>
         </div>

         <?php if ($rechtespalte) : ?>
            <div class="col-lg-4">
               <jdoc:include type="modules" name="right" style="xhtml"/>
            </div>
         <?php endif; ?>

      </div>
   </main>
<?php endif; ?>

<!-- Hier laden wir die Position portfolio mit dem Stil none -->
<jdoc:include type="modules" name="portfolio" style="none"/>

<!-- Hier laden wir die Position action mit dem Stil dark -->
<jdoc:include type="modules" name="action" style="dark"/>

<!-- Hier prÌfen wir ob ein Modul auf der Position contact veröffentlicht wurde -->
<?php if ($this->countModules('contact')) : ?>
   <section id="contact">
      <div class="container">
         <div class="row">
            <!-- Hier laden wir die Position contact mit dem Stil none -->
            <jdoc:include type="modules" name="contact" style="none"/>
         </div>
      </div>
   </section>
<?php endif; ?>

</body>

</html>
                
12.51 Darstellung des Hauptinhalts einer vereinfachten component.php-Datei
                    <body>
<jdoc:include type="message" />
<jdoc:include
                
12.52 Codebeispiel für eine abhängige Fehlermeldung in der error.php-Datei
                    <?php if ($this->error->getCode() == '404') { ?>
<h1>Ups � </h1>
<p>Die Seite die Sie aufgerufen haben, konnte nicht gefunden werden.<p>
<?php } ?>

                

Kapitel 13

13.1 Durch Joomla! mitgelieferte htaccess.txt
IndexIgnore *
Options -Indexes

Options +FollowSymlinks


RewriteEngine On

RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]


RewriteBase /

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

Kapitel 16

16.1 – Ausschnitt aus der Datei /components/com_users/views/profile/tmpl/default_custom.php – hier werden die Feld-Namen der Variable $customFields zugeordnet
                    $tmp = isset($this->data->jcfields) ? $this->data->jcfields : array();
$customFields = array();

foreach ($tmp as $customField)
{
 $customFields[$customField->name] = $customField;
}
                
16.2 – Abrufen des Benutzers im Beitragslayout
$user = JFactory::getUser($this->item->created_by);
JEventDispatcher::getInstance()->trigger('onContentPrepare', array(
'com_users.user',&$user,&$user->params,0 ));

                
16.3 – Anzeige der Datei components/com_contact/views/contact/tmpl/default_form.php
                    1	<?php
2	/**
3	 * @package     Joomla.Site
4	 * @subpackage  com_contact
5	 *
6	 * @copyright   Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights
7	reserved.
8	 * @license     GNU General Public License version 2 or later; see LICENSE.txt
9	 */
10	defined('_JEXEC') or die;
11
12	JHtml::_('behavior.keepalive');
13	JHtml::_('behavior.formvalidator');
14
15	?>
16	<div class="contact-form">
17	 <form id="contact-form" action="<?php echo JRoute::_('index.php'); ?>" method="post" class="form-validate form-horizontal well">
18	  <?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
19	   <?php if ($fieldset->name === 'captcha'&& !$this->captchaEnabled) : ?>
20	    <?php continue; ?>
21	   <?php endif; ?>
22	   <?php $fields = $this->form->getFieldset($fieldset->name); ?>
23	    <?php if (count($fields)) : ?>
24	     <fieldset>
25	      <?php if (isset($fieldset->label) && ($legend = trim(JText::_($fieldset->label))) !== '') : ?>
26	       <legend><?php echo $legend; ?></legend>
27	      <?php endif; ?>
28	      <?php foreach ($fields as $field) : ?>
29	        <?php echo $field->renderField(); ?>
30	      <?php endforeach; ?>
31	     </fieldset>
32	    <?php endif; ?>
33	   <?php endforeach; ?>
34	  <div class="control-group">
35	   <div class="controls">
36	    <button class="btn btn-primary validate" type="submit"><?php echo JText::_('COM_CONTACT_CONTACT_SEND'); ?></button>
37	    <input type="hidden" name="option" value="com_contact" />
38	    <input type="hidden" name="task" value="contact.submit" />
39	    <input type="hidden" name="return" value="<?php echo $this->return_page; ?>" />
40	    <input type="hidden" name="id" value="<?php echo $this->contact->slug; ?>" />
41	    <?php echo JHtml::_('form.token'); ?>
42	   </div>
43	  </div>
44	 </form>
45	</div>

                
16.4 – Ausgabe des Titels, des Alias und aller eigenen Felder im Formular
                    <?php echo $this->form->renderField('title'); ?>

 <?php if (is_null($this->item->id)) : ?>
  <?php echo $this->form->renderField('alias'); ?>
   <?php endif; ?>

<?php foreach ($this->form->getFieldsets('com_fields') as $name => $fieldSet) : ?>
  <?php foreach ($this->form->getFieldset($name) as $field) : ?>
   <?php echo $field->renderField(); ?>
  <?php endforeach; ?>

<?php endforeach; ?>

                
16.5 – Einleitung des Alternativen Layouts
                    <?php defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');

// KÃŒrzel zum Abrufen der Artikelparameter
$params  = $this->item->params;
                
16.6 – Code zum Einbinden der eigenen Felder per Feldnamen
                    // Beitrags-Felder Mapping
$customFields = $this->item->jcfields;
foreach ($customFields as $customField){
 $customFields[$customField->name] = $customField;
}
                
16.7 – Einbinden der eigenen Felder des Benutzers im Beitrag
                    //Userobjekt aufrufen
$user = JFactory::getUser($this->item->created_by);
JEventDispatcher::getInstance()->trigger('onContentPrepare', array(
'com_users.user',&$user,&$user->params,0 ));
//Benutzer-Felder Mapping
$userFields = $user->jcfields;
foreach ($userFields as $userField){
$userFields[$userField->name] = $userField;
}

                
Listing 16.8 – Umwandeln der Firmenfarbe in RGB
                    //Farbe in rgb Liste umwandeln
$farbe = $userFields['firmenfarbe']->value;
list($r, $g, $b) = sscanf($farbe, "#%02x%02x%02x");
$rgbcolor = $r.','.$g.','.$b;

                
Listing 16.9a – Erstellen von CSS Definitionen
                    // CSS Definieren
$css = "body.site { background:".$farbe ."; }\n";
$css .= ".page-header, a { color:".$farbe ."; }\n";
$css .= ".arbeitgeberbox { background-color:rgba(". $rgbcolor .",0.1); border:1px solid " . $farbe . "; padding:20px;  }\n";
$css .= ".merkmale { text-align:center; font-size:1.2em; font-weight:bold; background-color:rgba(". $rgbcolor .",0.3); border:1px solid " . $farbe . "; color:" . $farbe . "; padding:10px; }\n";

                
Listing 16.9b – Einbinden der CSS-Definitionen
                    // Dokumenten Objekt aufrufen
$doc = JFactory::getDocument();

// Lokale CSS Definitionen hinzufÃŒgen
$doc->addStyleDeclaration($css, $type= 'text/css');

                
Listing 16.10 – Ausgabe der Eigenen Felder in einem eigenen Layout
                    <div class="item-page<?php echo $this->pageclass_sfx; ?>" itemscope itemtype="http://schema.org/JobPosting">
<meta itemprop="inLanguage" content="<?php echo ($this->item->language === '*') ? JFactory::getConfig()->get('language') : $this->item->language; ?>" />

 <div class="row-fluid">
  <div class="span12 page-header">
   <h1 itemprop="title">
    <?php echo $this->escape($this->item->title); ?>
   </h1>
  </div>
 </div>

 <div class="row-fluid">
  <div class="span6">
   <p itemprop="description">
    <?php echo $customFields['stellenbeschreibung']->value; ?>
   </p>
  </div>
  <div class="span2 merkmale">
   <p itemprop="employmentType">
    <?php echo $customFields['arbeitszeit']->value; ?>
   </p>
  </div>
  <div class="span2 merkmale">
   <p itemprop="datePosted">
    <?php echo $customFields['einstellungsdatum']->value; ?>
   </p>
  </div>
  <div class="span2 merkmale">
   <p itemprop="skills">
    <?php echo $customFields['programmiersprachen']->value; ?>
   </p>
  </div>
 </div>

 <div class="row-fluid">
  <div class="span6">
   <iframe width="600" height="450" frameborder="0" style="border:0"
   src="https://www.google.com/maps/embed/v1/place?q=<?php echo $userFields['adresse']->value; ?>&key=IHRAPIKEY" allowfullscreen>
   </iframe>
  </div>
  <div class="span6 arbeitgeberbox"  >
   <h3>
    <?php echo $userFields['firmenname']->value; ?>
   </h3>
   <span itemprop="addressLocality">
    <?php echo $userFields['adresse']->value; ?>
   </span>
   <p>
    <?php echo $userFields['arbeitgeberbeschreibung']->value; ?>
   </p>
  </div>

 </div>

<?php if (!empty($this->item->pagination) && $this->item->pagination && $this->item->paginationposition && !$this->item->paginationrelative) :
 echo $this->item->pagination;?>
<?php endif; ?>

</div>
                
16.11 – Einfache options.xml-Datei mit Feld zum Bestimmen der Schriftfarbe.
                    <?xml version="1.0" encoding="utf-8"?>
<form addfieldpath="/libraries/cck/construction/field">
 <fieldset name="position_legend" label="VAR_MEINEVARIATION_LEGEND_POSITION_LEGEND">
  <field name="font" type="color" default="#000"
   label="VAR_MEINEVARIATION_FONTCOLOR_LABEL"
   description=" VAR_MEINEVARIATION_FONTCOLOR_DESC" />
 </fieldset>
</form>
                
16.12 – Beispielcode für eine Variation
                    <?php defined( '_JEXEC' ) or die;

// Parameter fÃŒr die Schriftfarbe abrufen
$fontcolor = $options->get('fontcolor' );

//Einbindung des Farbparameters in eine css Variable
$css   =  '.meinevariation { color:'.$fontcolor.'; }'."\n";

//Css Stil lokal einbinden
$cck->addCSS($css);

?>

<div class="meinevariation">
   <!-- Ausgabe aller Felder -->
   <?php echo $content; ?>
</div>

                

Kapitel 17

17.1 Direkter Aufruf der JMail Klasse mittels Konstruktor
$mail = new JMail();
$mail->addRecipient("test@example.com");
$mail->setSubject("Testmail");
$mail->send();
17.2 Erzeugung der Instanz über die Nutzung der Factory-Methode
$mail = JFactory::getMailer();
$mail->addRecipient("test@example.com");
$mail->setSubject("Testmail");
$mail->send();
17.3 Beispiel für die Nutzung der Klasse JDatabase
$db = JFactory::getDBO();
$query = "SELECT email FROM #__users WHERE username = 'admin'";
$db->setQuery($query);
$email = $db->loadResult();
17.4 Beispiel für die Nutzung von JDatabaseQuery
$db = JFactory::getDBO();

$query = $db->getQuery(true);
$query->select("email, username");
$query->from("#__users");
$db->setQuery((string)$query);

$users = $db->loadObjectList();

foreach($users as $user) {
    echo '<a href="'.$user->email.'">'.$user->username.'</a>';
}
17.5 Beispiel für die Nutzung der JInput-Klasse
//Abfrage des Parameters id aus dem $_REQUEST Array
$input = JFactory::getApplication()->input;
$id = $input->get('id','0','INT');

//Abfrage des Parameters name aus dem $_POST Array
$input = JFactory::getApplication()->input;
$name = $input->post->get('name','','STRING');
17.6 Beispiel zur Nutzung von JDocumentHTML
$document = JFactory::getDocument();

$document->addStyleSheet("/media/com_jobs/jobs.css");
$document->setGenerator("Joomla 7.0");
17.7 Beispiel zur Nutzung der Klassen JFile und JFolder
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');

$path = JPATH_SITE."/images/";

if(JFolder::exists($path))
{
    $files = JFolder::files($path);
    foreach ($files as $file)
    {
        echo "Datei: ".$file." | Dateityp: ".JFile::getExt($file);
    }
}
17.8 jobs.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.7.0" method="upgrade">
    <name>COM_JOBS</name>
    <creationDate>March 2017</creationDate>
    <author>David Jardin</author>
    <authorEmail>d.jardin@djumla.de</authorEmail>
    <authorUrl>http://www.djumla.de</authorUrl>
    <copyright>Copyright 2017 David Jardin</copyright>
    <license>GPL v2 or later</license>
    <version>0.0.1</version>
    <description>COM_JOBS_DESCRIPTION</description>

    <!-- PHP-Skript wird ausgeführt bei Installation, Deinstallation und Update -->
    <scriptfile>script.php</scriptfile>

    <!-- SQL-Skript für die Installation -->
    <install>
        <sql>
            <file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
        </sql>
    </install>
    <!-- SQL-Skript für die Deinstallation -->
    <uninstall>
        <sql>
            <file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
        </sql>
    </uninstall>
    <!-- SQL-Skripte für die Aktualisierung der Erweiterung -->
    <update>
        <schemas>
            <schemapath type="mysql">sql/updates/mysql</schemapath>
        </schemas>
    </update>

    <!-- Kopieranweisungen für das Frontend -->
    <files folder="site">
        <filename>jobs.php</filename>
        <filename>controller.php</filename>
        <folder>views</folder>
        <folder>models</folder>
        <folder>language</folder>
    </files>

    <!-- Kopieranweisungen für das Media-Verzeichnis -->
    <media destination="com_jobs" folder="media">
        <filename>index.html</filename>
        <folder>images</folder>
    </media>

    <languages folder="site">
        <language tag="de-DE">language/de-DE/de-DE.com_jobs.ini</language>
    </languages>

    <administration>
        <!-- Administrations Menü -->
        <menu img="../media/com_jobs/images/jobs-16x16.png">COM_JOBS</menu>
        <!-- Kopieranweisungen für das Backend -->
        <files folder="admin">
            <filename>config.xml</filename>
            <filename>access.xml</filename>
            <filename>jobs.php</filename>
            <filename>controller.php</filename>
            <folder>sql</folder>
            <folder>tables</folder>
            <folder>models</folder>
            <folder>views</folder>
            <folder>controllers</folder>
            <folder>helpers</folder>
        </files>

        <languages folder="admin">
            <language tag="de-DE">language/de-DE/de-DE.com_jobs.ini</language>
            <language tag="de-DE">language/de-DE/de-DE.com_jobs.sys.ini</language>
        </languages>
    </administration>

    <!-- UPDATESERVER DEFINITION -->
    <updateservers>
        <server type="extension" priority="1" name="Jobs Update Site">http://yourdomain.com/update/jobs-update.xml</server>
    </updateservers>

</extension>
17.9 script.php
<?php
defined('_JEXEC') or die;

/**
 * Installation class to perform additional changes during install/uninstall/update
 *
 * @since  0.0.1
 */
class Com_JobsInstallerScript
{
    /**
     * Function to perform changes during install
     *
     * @param   JInstallerAdapterComponent  $parent  The class calling this method
     *
     * @return  void
     */
    public function install($parent)
    {
        // Initialize a new category
        /** @type  JTableCategory  $category  */
        $category = JTable::getInstance('Category');

        // Check if the Uncategorised category exists before adding it
        if (!$category->load(array('extension' => 'com_jobs', 'title' => 'Uncategorised')))
        {
            $category->extension = 'com_jobs';
            $category->title = 'Uncategorised';
            $category->description = '';
            $category->published = 1;
            $category->access = 1;
            $category->params = '{"category_layout":"","image":""}';
            $category->metadata = '{"author":"","robots":""}';
            $category->metadesc = '';
            $category->metakey = '';
            $category->language = '*';
            $category->checked_out_time = JFactory::getDbo()->getNullDate();
            $category->version = 1;
            $category->hits = 0;
            $category->modified_user_id = 0;
            $category->checked_out = 0;

            // Set the location in the tree
            $category->setLocation(1, 'last-child');

            // Check to make sure our data is valid
            if (!$category->check())
            {
                JFactory::getApplication()->enqueueMessage($category->getError());

                return;
            }

            // Now store the category
            if (!$category->store(true))
            {
                JFactory::getApplication()->enqueueMessage($category->getError());

                return;
            }

            // Build the path for our category
            $category->rebuildPath($category->id);
        }
    }

    /**
     * method to uninstall the component
     *
     * @param   JInstallerAdapterComponent  $parent  The class calling this method
     *
     * @return void
     */
    public function uninstall($parent)
    {
        // $parent is the class calling this method
        echo '<p>' . JText::_('COM_JOBS_UNINSTALL_TEXT') . '</p>';
    }

    /**
     * method to update the component
     *
     * @param   JInstallerAdapterComponent  $parent  The class calling this method
     *
     * @return void
     */
    public function update($parent)
    {
        // $parent is the class calling this method
        echo '<p>' . JText::_('COM_JOBS_UPDATE_TEXT') . '</p>';
    }

    /**
     * method to run before an install/update/uninstall method
     *
     * @param   string                      $type    process type
     * @param   JInstallerAdapterComponent  $parent  The class calling this method
     *
     * @return void
     */
    public function preflight($type, $parent)
    {
        // $parent is the class calling this method
        // $type is the type of change (install, update or discover_install)
        echo '<p>' . JText::_('COM_JOBS_PREFLIGHT_' . $type . '_TEXT') . '</p>';
    }

    /**
     * method to run after an install/update/uninstall method
     *
     * @param   string                      $type    process type
     * @param   JInstallerAdapterComponent  $parent  The class calling this method
     *
     * @return void
     */
    public function postflight($type, $parent)
    {
        // $parent is the class calling this method
        // $type is the type of change (install, update or discover_install)
        echo '<p>' . JText::_('COM_JOBS_POSTFLIGHT_' . $type . '_TEXT') . '</p>';
    }
}
17.10 install.mysql.utf8.sql
DROP TABLE IF EXISTS `#__jobs`;

CREATE TABLE `#__jobs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(25) NOT NULL,
  `description` mediumtext NOT NULL,
  `catid` int(11) NOT NULL DEFAULT '0',
  `params` TEXT NOT NULL DEFAULT '',
   PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
17.11 uninstall.mysql.utf8.sql
DROP TABLE IF EXISTS `#__jobs`;
17.12 Backend-Dispatcher jobs.php
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// Access check.
if (!JFactory::getUser()->authorise('core.manage', 'com_jobs'))
{
    new RuntimeException(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}

// Require helper file
JLoader::register('JobsHelper', dirname(__FILE__) . '/helpers/jobs.php');

// Import joomla controller library
jimport('joomla.application.component.controller');

// Get an instance of the controller prefixed by Jobs
$controller = JControllerLegacy::getInstance('Jobs');

// Perform the Request task
$controller->execute(JFactory::getApplication()->input->get('task', '', 'CMD'));

// Redirect if set by the controller
$controller->redirect();
17.13 Backend-Controller controller.php
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
 * General Controller of Jobs component
 *
 * @since  0.0.1
 */
class JobsController extends JControllerLegacy
{
    /**
     * The generic display task
     *
     * @param   bool   $cachable   is this view a cachabel one
     * @param   array  $urlparams  url parameters
     *
     * @return  void
     */
    public function display($cachable = false, $urlparams = array())
    {
        $input =& JFactory::getApplication()->input;

        // Set default view if not set
        $input->set('view', $input->get("view", "Jobs", "CMD"));

        // Call parent behavior
        parent::display($cachable, $urlparams);
    }
}
17.14 Listen-Controller jobs.php
<?php
/**
 * @package    ComJobs
 * @copyright  2017 David Jardin
 * @license    GNU GPLv2 <http://www.gnu.org/licenses/gpl.html>
 * @link       http://www.djumla.de
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
 * Jobs Controller
 *
 * @since  0.0.1
 */
class JobsControllerJobs extends JControllerAdmin
{
    /**
     * Description
     *
     * @param   string  $name    model name
     * @param   string  $prefix  model prefix
     *
     * @return bool|JModelLegacy
     */
    public function getModel($name = 'Job', $prefix = 'JobsModel')
    {
        $model = parent::getModel($name, $prefix, array('ignore_request' => true));

        return $model;
    }
}
17.15 Eintrags-Controller job.php
<?php
/**
 * @package    ComJobs
 * @copyright  2017 David Jardin
 * @license    GNU GPLv2 <http://www.gnu.org/licenses/gpl.html>
 * @link       http://www.djumla.de
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
 * Job Controller
 *
 * @since  0.0.1
 */
class JobsControllerJob extends JControllerForm
{
}
17.16 Listen-Model jobs.php
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
 * JobsList Model
 *
 * @since  0.0.1
 */
class JobsModelJobs extends JModelList
{
    /**
     * Method to build an SQL query to load the list data.
     *
     * @return  string  An SQL query
     */
    protected function getListQuery()
    {
        // Create a new query object.
        $db = JFactory::getDBO();
        $query = $db->getQuery(true);

        // Select some fields
        $query->select('*');

        // From the jobs table
        $query->from('#__jobs');

        // Filter by category.
        $categoryId = $this->getState('filter.category_id');

        if (is_numeric($categoryId))
        {
            $query->where('catid = ' . (int) $categoryId);
        }

        // Add the list ordering clause.
        $orderCol = $this->state->get('list.ordering');
        $orderDirn = $this->state->get('list.direction');

        $query->order($db->escape($orderCol . ' ' . $orderDirn));

        return $query;
    }

    /**
     * Method to auto-populate the model state.
     *
     * @param   string  $ordering   name if column that should be used for order
     * @param   string  $direction  ordering direction
     *
     * @return  void
     *
     * @note    Calling getState in this method will result in recursion.
     */
    protected function populateState($ordering = null, $direction = null)
    {
        // Load the filter state.
        $categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id', '');
        $this->setState('filter.category_id', $categoryId);

        // List state information.
        parent::populateState('title', 'asc');
    }
}
17.17 Eintrags-Models job.php
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
 * Job Model
 *
 * @since  0.0.1
 */
class JobsModelJob extends JModelAdmin
{
    /**
     * Returns a reference to the a Table object, always creating it.
     *
     * @param   string  $type    The table type to instantiate
     * @param   string  $prefix  A prefix for the table class name. Optional.
     * @param   array   $config  Configuration array for model. Optional.
     *
     * @return  JTable  A database table object
     */
    public function getTable($type = 'Jobs', $prefix = 'JobsTable', $config = array())
    {
        return JTable::getInstance($type, $prefix, $config);
    }

    /**
     * Method to get the record form.
     *
     * @param   array    $data      Data for the form.
     * @param   boolean  $loadData  True if the form is to load its own data (default case), false if not.
     *
     * @return  mixed   A JForm object on success, false on failure
     */
    public function getForm($data = array(), $loadData = true)
    {
        // Get the form.
        $form = $this->loadForm('com_jobs.job', 'job', array('control' => 'jform', 'load_data' => $loadData));

        if (empty($form))
        {
            return false;
        }

        return $form;
    }

    /**
     * Method to get the data that should be injected in the form.
     *
     * @return  mixed  The data for the form.
     */
    protected function loadFormData()
    {
        // Check the session for previously entered form data.
        $data = JFactory::getApplication()->getUserState('com_jobs.edit.job.data', array());

        if (empty($data))
        {
            $data = $this->getItem();

            // Prime some default values.
            if ($this->getState('job.id') == 0)
            {
                $app = JFactory::getApplication();
                $data->set('catid', $app->input->get('catid', $app->getUserState('com_jobs.jobs.filter.category_id'), 'int'));
            }
        }

        $this->preprocessData('com_jobs.job', $data);

        return $data;
    }
}
17.18 job.xml XML-Definition des Formulars für die Validierung mittels JForm
<?xml version="1.0" encoding="utf-8"?>
<form
        addrulepath="/administrator/components/com_jobs/models/rules"
        >
    <fieldset name="details">
        <field
                name="id"
                type="hidden"
                />
        <field
                name="title"
                type="text"
                label="COM_JOBS_JOB_FIELD_TITLE_LABEL"
                description="COM_JOBS_JOB_FIELD_TITLE_DESC"
                size="40"
                class="inputbox validate-title"
                validate="title"
                required="true"
                default=""
                />
        <field
                name="description"
                type="editor"
                label="COM_JOBS_JOB_FIELD_DESCRIPTION_LABEL"
                description="COM_JOBS_JOB_FIELD_DESCRIPTION_DESC"
                required="true"
                filter="JComponentHelper::filterText"
                />
        <field
                name="catid"
                type="category"
                extension="com_jobs"
                class="inputbox"
                default=""
                label="COM_JOBS_JOB_FIELD_CATID_LABEL"
                description="COM_JOBS_JOB_FIELD_CATID_DESC"
                required="true"
                >
            <option value="0">JOPTION_SELECT_CATEGORY</option>
        </field>
    </fieldset>
    <fields name="params">
        <fieldset
                name="params"
                label="JGLOBAL_FIELDSET_DISPLAY_OPTIONS"
        >
            <field
                    name="show_title"
                    type="list"
                    label="COM_JOBS_JOB_FIELD_SHOW_TITLE_LABEL"
                    description="COM_JOBS_JOB_FIELD_SHOW_TITLE_DESC"
                    default=""
                    >
                <option value="0">JHIDE</option>
                <option value="1">JSHOW</option>
            </field>
            <field
                    name="show_category"
                    type="list"
                    label="COM_JOBS_JOB_FIELD_SHOW_CATEGORY_LABEL"
                    description="COM_JOBS_JOB_FIELD_SHOW_CATEGORY_DESC"
                    default=""
                    >
                <option value="0">JHIDE</option>
                <option value="1">JSHOW</option>
            </field>
        </fieldset>
    </fields>
</form>
17.19 title.php Validierungsregel zur serverseitigen Validierung
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
 * Form Rule class for the Joomla Framework.
 *
 * @since  0.0.1
 */
class JFormRuleTitle extends JFormRule
{
    /**
     * The regular expression.
     *
     * @access  protected
     * @var     string
     * @since   1.6
     */
    protected $regex = '^[^0-9]+$';
}
17.20 Table-Klasse für die Jobs-Tabelle
<?php
// No direct access
defined('_JEXEC') or die('Restricted access');

/**
 * Jobs Table class
 *
 * @since  0.0.1
 */
class JobsTableJobs extends JTable
{
    /**
     * Ensure the params and metadata in json encoded in the bind method
     *
     * @var    array
     */
    protected $_jsonEncode = array('params');

    /**
     * Constructor
     *
     * @param   JDatabaseDriver  &$db  connector object
     */
    public  function __construct(&$db)
    {
        parent::__construct('#__jobs', 'id', $db);
    }
}
17.21 Listenansicht im Backend
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
 * Jobs View
 *
 * @since  1.0.0
 */
class JobsViewJobs extends JViewLegacy
{
    protected $items;

    protected $pagination;

    protected $state;

    /**
     * Jobs view display method
     *
     * @param   string  $tpl  templae name
     *
     * @return void
     */
    public function display($tpl = null)
    {
        // Get data from the model
        $this->items = $this->get('Items');
        $this->pagination = $this->get('Pagination');
        $this->state = $this->get('State');

        // Check for errors.
        if (count($errors = $this->get('Errors')))
        {
            throw new RuntimeException(implode('<br />', $errors), 500);
        }

        // Set the toolbar
        JobsHelper::addSubmenu('jobs');

        $this->addToolBar();
        $this->sidebar = JHtmlSidebar::render();

        // Add CSS for icon
        JFactory::getDocument()->addStyleDeclaration('.icon-jobs {background:url(../media/com_jobs/images/jobs-16x16.png)}');

        // Display the template
        parent::display($tpl);
    }

    /**
     * Setting the toolbar
     *
     * @return void
     */
    protected function addToolBar()
    {
        $state = $this->get('State');
        $canDo = JHelperContent::getActions('com_jobs', 'category', $state->get('filter.category_id'));
        $user  = JFactory::getUser();

        JToolBarHelper::title(JText::_('COM_JOBS_MANAGER_JOBS'), 'jobs');

        if ($canDo->get('core.create'))
        {
            JToolBarHelper::addNew('job.add');
        }

        if ($canDo->get('core.edit'))
        {
            JToolBarHelper::editList('job.edit');
        }

        if ($canDo->get('core.delete'))
        {
            JToolBarHelper::deleteList('', 'jobs.delete');
        }

        if ($user->authorise('core.admin', 'com_jobs') || $user->authorise('core.options', 'com_jobs'))
        {
            JToolBarHelper::divider();
            JToolBarHelper::preferences('com_jobs');
        }

        JHtmlSidebar::setAction('index.php?option=com_jobs&view=jobs');

        JHtmlSidebar::addFilter(
            JText::_('JOPTION_SELECT_CATEGORY'),
            'filter_category_id',
            JHtml::_('select.options', JHtml::_('category.options', 'com_jobs'), 'value', 'text', $state->get('filter.category_id'))
        );
    }
}
17.22 Backend-Template für die Listenansicht default.php
<?php
/**
 * @package    ComJobs
 * @copyright  2017 David Jardin
 * @license    GNU GPLv2 <http://www.gnu.org/licenses/gpl.html>
 * @link       http://www.djumla.de
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted Access');

// Load tooltip behavior
JHtml::_('behavior.tooltip');
JHtml::_('formbehavior.chosen', 'select');
?>
<form action="<?php echo JRoute::_('index.php?option=com_jobs&view=jobs'); ?>" method="post" name="adminForm" id="adminForm">
    <div id="j-sidebar-container" class="span2">
        <?php echo $this->sidebar; ?>
    </div>
    <div id="j-main-container" class="span10">
        <?php if (empty($this->items)): ?>
            <div class="alert alert-no-items">
                <?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
            </div>
        <?php else: ?>
            <table class="table table-striped" id="jobList">
                <thead>
                    <?php echo $this->loadTemplate('head'); ?>
                </thead>
                <tfoot>
                    <?php echo $this->loadTemplate('foot'); ?>
                </tfoot>
                <tbody>
                    <?php echo $this->loadTemplate('body'); ?>
                </tbody>
            </table>
        <?php endif; ?>

        <input type="hidden" name="task" value="" />
        <input type="hidden" name="boxchecked" value="0" />
        <input type="hidden" name="filter_order" value="<?php echo $this->escape($this->state->get('list.ordering')); ?>" />
        <input type="hidden" name="filter_order_Dir" value="<?php echo $this->escape($this->state->get('list.direction')); ?>" />
        <?php echo JHtml::_('form.token'); ?>
    </div>
</form>
17.23 Listenkopf default_head.php
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');

$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
?>
<tr>
    <th width="1%" class="hidden-phone center">
        <?php echo JHtml::_('grid.checkall'); ?>
    </th>
    <th class="title">
        <?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'title', $listDirn, $listOrder); ?>
    </th>
    <th width="1%" class="nowrap center hidden-phone">
        <?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'id', $listDirn, $listOrder); ?>
    </th>
</tr>
17.24 Listenfooter default_foot.php
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
?>
<tr>
    <td colspan="3"><?php echo $this->pagination->getListFooter(); ?></td>
</tr>
17.25 Listenbody default_body.php
<?php
/**
 * @package    ComJobs
 * @copyright  2017 David Jardin
 * @license    GNU GPLv2 <http://www.gnu.org/licenses/gpl.html>
 * @link       http://www.djumla.de
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted Access');

$user = JFactory::getUser();
?>
<?php foreach ($this->items as $i => $item):
    $canEdit = $user->authorise('core.edit', 'com_jobs.category.' . $item->catid);
    ?>
    <tr class="row<?php echo $i % 2; ?>">
        <td class="center hidden-phone">
            <?php echo JHtml::_('grid.id', $i, $item->id); ?>
        </td>
        <td class="nowrap has-context">
            <?php if ($canEdit): ?>
                <a href="<?php echo JRoute::_('index.php?option=com_jobs&task=job.edit&id='.(int) $item->id); ?>">
                    <?php echo $this->escape($item->title); ?></a>
            <?php else: ?>
                <?php echo $this->escape($item->title); ?>
            <?php endif; ?>
        </td>
        <td class="center hidden-phone">
            <?php echo (int) $item->id; ?>
        </td>
    </tr>
<?php endforeach; ?>
17.26 Formular-View
<?php
/**
 * @package    ComJobs
 * @copyright  2017 David Jardin
 * @license    GNU GPLv2 <http://www.gnu.org/licenses/gpl.html>
 * @link       http://www.djumla.de
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
 * Job View
 *
 * @since  0.0.1
 */
class JobsViewJob extends JViewLegacy
{
    protected $state;

    protected $item;

    protected $form;

    /**
     * display method of Job view
     *
     * @param   string  $tpl  template name
     *
     * @return void
     */
    public function display($tpl = null)
    {
        // Get the Data
        $this->form = $this->get('Form');
        $this->item = $this->get('Item');
        $this->state = $this->get('State');

        // Check for errors.
        if (count($errors = $this->get('Errors')))
        {
            throw new RuntimeException(implode('<br />', $errors), 500);
        }

        // Set the toolbar
        $this->addToolBar();

        // Add CSS for icon
        JFactory::getDocument()->addStyleDeclaration('.icon-jobs {background:url(../media/com_jobs/images/jobs-16x16.png)}');

        // Display the template
        parent::display($tpl);
    }

    /**
     * Setting the toolbar
     *
     * @return  void
     */
    protected function addToolBar()
    {
        JFactory::getApplication()->input->set('hidemainmenu', true);

        $user       = JFactory::getUser();
        $isNew = $this->item->id == 0;
        $canDo = JHelperContent::getActions('com_jobs', 'category', $this->item->catid);

        JToolBarHelper::title($isNew ? JText::_('COM_JOBS_MANAGER_JOB_NEW') : JText::_('COM_JOBS_MANAGER_JOB_EDIT'), 'jobs');

        // If not checked out, can save the item.
        if ($canDo->get('core.edit')||(count($user->getAuthorisedCategories('com_jobs', 'core.create'))))
        {
            JToolbarHelper::apply('job.apply');
            JToolbarHelper::save('job.save');
        }

        if (count($user->getAuthorisedCategories('com_jobs', 'core.create')))
        {
            JToolbarHelper::save2new('job.save2new');
        }

        // If an existing item, can save to a copy.
        if (!$isNew && (count($user->getAuthorisedCategories('com_jobs', 'core.create')) > 0))
        {
            JToolbarHelper::save2copy('job.save2copy');
        }

        JToolbarHelper::cancel('job.cancel');
    }
}
17.27 Formular-Template edit.php
<?php
/**
 * @package    ComJobs
 * @copyright  2017 David Jardin
 * @license    GNU GPLv2 <http://www.gnu.org/licenses/gpl.html>
 * @link       http://www.djumla.de
 */
defined('_JEXEC') or die('Restricted access');

JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');

JFactory::getDocument()->addScriptDeclaration("
    Joomla.submitbutton = function(task)
    {
        if (task == 'job.cancel' || document.formvalidator.isValid(document.getElementById('job-form'))) {
            " . $this->form->getField('description')->save() . "
            Joomla.submitform(task, document.getElementById('job-form'));
        }
    };
");

$params = $this->form->getFieldsets('params');
?>

<form action="<?php echo JRoute::_('index.php?option=com_jobs&layout=edit&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="job-form" class="form-validate">
    <?php echo JLayoutHelper::render('joomla.edit.title_alias', $this); ?>

    <div class="form-horizontal">
        <?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'details')); ?>

        <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'details', JText::_('COM_JOBS_JOB_DETAILS', true)); ?>

        <?php echo $this->form->getControlGroup('catid'); ?>
        <?php echo $this->form->getControlGroup('description'); ?>

        <?php echo JHtml::_('bootstrap.endTab'); ?>
        <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'params', JText::_('COM_JOBS_JOB_PARAMS', true)); ?>

        <?php foreach ($this->form->getGroup('params') as $field) : ?>
            <?php echo $field->getControlGroup(); ?>
        <?php endforeach; ?>

        <?php echo JHtml::_('bootstrap.endTabSet'); ?>

    </div>

    <input type="hidden" name="task" value="" />
    <?php echo JHtml::_('form.token'); ?>
</form>
17.28 config.xml
<?xml version="1.0" encoding="utf-8"?>
<config>
    <fieldset
        name="title"
        label="COM_JOBS_CONFIG_TITLE_SETTINGS_LABEL"
        description="COM_JOBS_CONFIG_TITLE_SETTINGS_DESC"
    >
        <field
                name="show_title"
                type="radio"
                label="COM_JOBS_JOB_FIELD_SHOW_TITLE_LABEL"
                description="COM_JOBS_JOB_FIELD_SHOW_TITLE_DESC"
                default="1"
                >
            <option value="0">JHIDE</option>
            <option value="1">JSHOW</option>
        </field>
        <field
            name="show_category"
            type="radio"
            label="COM_JOBS_JOB_FIELD_SHOW_CATEGORY_LABEL"
            description="COM_JOBS_JOB_FIELD_SHOW_CATEGORY_DESC"
            default="0"
        >
            <option value="0">JHIDE</option>
            <option value="1">JSHOW</option>
        </field>
    </fieldset>
    <fieldset
        name="permissions"
        label="JCONFIG_PERMISSIONS_LABEL"
        description="JCONFIG_PERMISSIONS_DESC"
    >
        <field
            name="rules"
            type="rules"
            label="JCONFIG_PERMISSIONS_LABEL"
            class="inputbox"
            validate="rules"
            filter="rules"
            component="com_jobs"
            section="component"
        />
    </fieldset>
</config>
17.29 access.xml
<?xml version="1.0" encoding="utf-8" ?>
<access component="com_jobs">
    <section name="component">
        <action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
        <action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
        <action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
        <action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
        <action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
    </section>
</access>
17.30 Jobs-Helper
<?php
// No direct access to this file
defined('_JEXEC') or die;

/**
 * Class JobsHelper
 *
 * @since  0.0.1
 */
abstract class JobsHelper
{
    /**
     * Configure the Linkbar.
     *
     * @param   string  $vName  The name of the active view.
     *
     * @return  void
     */
    public static function addSubmenu($vName = 'jobs')
    {
        JHtmlSidebar::addEntry(
            JText::_('COM_JOBS_SUBMENU_MESSAGES'),
            'index.php?option=com_jobs',
            $vName == 'jobs'
        );

        JHtmlSidebar::addEntry(
            JText::_('COM_JOBS_SUBMENU_CATEGORIES'),
            'index.php?option=com_categories&extension=com_jobs',
            $vName == 'categories'
        );
    }
}
17.31 System-Sprachdatei
COM_JOBS="Jobsverwaltung"
COM_JOBS_DESCRIPTION="Dies ist die Jobsverwaltung"
COM_JOBS_JOB_VIEW_DEFAULT_DESC="Diese Ansicht zeigt ein Jobangebot an"
COM_JOBS_JOB_VIEW_DEFAULT_TITLE="Jobangebot"
COM_JOBS_INSTALL_TEXT="Jobs - Installations Skript"
COM_JOBS_MENU="Jobsverwaltung"
COM_JOBS_POSTFLIGHT_DISCOVER_INSTALL_TEXT="Jobs - Nach-Installationsprüfung bei Discover Installation"
COM_JOBS_POSTFLIGHT_INSTALL_TEXT="Jobs - Nach-Installationsprüfung bei Installation"
COM_JOBS_POSTFLIGHT_UNINSTALL_TEXT="Jobs - Nach-Installationsprüfung bei Deinstallation"
COM_JOBS_POSTFLIGHT_UPDATE_TEXT="Jobs - Nach-Installationsprüfung bei Update"
COM_JOBS_PREFLIGHT_DISCOVER_INSTALL_TEXT="Jobs - Vor-Installationsprüfung bei Discover Installation"
COM_JOBS_PREFLIGHT_INSTALL_TEXT="Jobs - Vor-Installationsprüfung bei Installation"
COM_JOBS_PREFLIGHT_UNINSTALL_TEXT="Jobs - Vor-Installationsprüfung bei Deinstallation"
COM_JOBS_PREFLIGHT_UPDATE_TEXT="Jobs - Vor-Installationsprüfung bei Update"
COM_JOBS_UNINSTALL_TEXT="Jobs - Deinstallations Skript"
COM_JOBS_UPDATE_TEXT="Jobs - Update Skript"
17.32 Komponenten-Sprachdatei im Backend
COM_JOBS="Jobverwaltung"
COM_JOBS_ADMINISTRATION="Jobs - Administration"
COM_JOBS_ADMINISTRATION_CATEGORIES="Jobs - Kategorien"
COM_JOBS_JOB_CREATING="Job - Hinzufügen"
COM_JOBS_JOB_DETAILS="Details"
COM_JOBS_JOB_PARAMS="Parameter"
COM_JOBS_JOB_EDITING="Job - Bearbeiten"
COM_JOBS_JOB_ERROR_UNACCEPTABLE="Bitte prüfen Sie ihre Eingaben"
COM_JOBS_JOB_FIELD_CATID_DESC="Die Kategorie des Jobangebots"
COM_JOBS_JOB_FIELD_CATID_LABEL="Kategorie"
COM_JOBS_JOB_FIELD_TITLE_DESC="Titel des Jobangebot"
COM_JOBS_JOB_FIELD_TITLE_LABEL="Titel"
COM_JOBS_JOB_FIELD_DESCRIPTION_DESC="Beschreibung des Jobangebot"
COM_JOBS_JOB_FIELD_DESCRIPTION_LABEL="Beschreibung"
COM_JOBS_JOB_FIELD_SHOW_TITLE_LABEL="Zeige Titel"
COM_JOBS_JOB_FIELD_SHOW_TITLE_DESC="Zeigt den Titel des jeweiligen Jobangebots."
COM_JOBS_JOB_FIELD_SHOW_CATEGORY_LABEL="Zeige Kategorie"
COM_JOBS_JOB_FIELD_SHOW_CATEGORY_DESC="Zeigt die Kategorie des jeweiligen Jobangebots."
COM_JOBS_JOB_HEADING_TITLE="Titel"
COM_JOBS_JOB_HEADING_ID="ID"
COM_JOBS_MANAGER_JOB_EDIT="Jobs Manager: Bearbeite Job"
COM_JOBS_MANAGER_JOB_NEW="Jobs Manager: Neuen Job"
COM_JOBS_MANAGER_JOBS="Jobs Manager"
COM_JOBS_N_ITEMS_DELETED_1="Einen Job gelöscht"
COM_JOBS_N_ITEMS_DELETED_MORE="%d Jobs gelöscht"
COM_JOBS_SUBMENU_MESSAGES="Jobs"
COM_JOBS_SUBMENU_CATEGORIES="Kategorien"
COM_JOBS_CONFIGURATION="Jobs Konfiguration"
COM_JOBS_CONFIG_TITLE_SETTINGS_LABEL="Job Einstellungen"
COM_JOBS_CONFIG_TITLE_SETTINGS_DESC="Einstellungen, welche standardmäßig auf alle Jobs angewendet werden"
17.33 Frontend-Dispatcher
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// Get an instance of the controller prefixed by HelloWorld
$controller = JControllerLegacy::getInstance('Jobs');

// Perform the Request task
$controller->execute(JFactory::getApplication()->input->get('task', '', 'CMD'));

// Redirect if set by the controller
$controller->redirect();
17.34 Frontend-Controller
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
 * Jobs Component Controller
 *
 * @since  0.0.1
 */
class JobsController extends JControllerLegacy
{
}
17.35 Frontend-Model
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
 * Job Model
 *
 * @since  1.0.0
 */
class JobsModelJob extends JModelItem
{
    protected $item;

    /**
     * populate internal state
     *
     * @return void
     */
    protected function populateState()
    {
        $app = JFactory::getApplication();

        // Get the job id
        $id = $app->input->get('id', '', 'INT');
        $this->setState('job.id', $id);

        // Load the parameters.
        $params = $app->getParams();
        $this->setState('params', $params);

        parent::populateState();
    }

    /**
     * Returns a reference to the a Table object, always creating it.
     *
     * @param   string  $type    The table type to instantiate
     * @param   string  $prefix  A prefix for the table class name. Optional.
     * @param   array   $config  Configuration array for table. Optional.
     *
     * @return  JTable A database object
     */
    public function getTable($type = 'Jobs', $prefix = 'JobsTable', $config = array())
    {
        return JTable::getInstance($type, $prefix, $config);
    }

    /**
     * Get the job
     *
     * @return object The job to be displayed to the user
     */
    public function getItem()
    {
        if (!isset($this->item))
        {
            $db = JFactory::getDbo();
            $id = $this->getState('job.id');

            $query = $db->getQuery(true)->from('#__jobs as j')
                ->leftJoin('#__categories as c ON j.catid=c.id')
                ->select('j.title AS title, j.params, j.description, c.title as category')
                ->where('j.id=' . (int) $id);

            $db->setQuery($query);

            $this->item = $db->loadObject();

            // Load the JSON encoded params
            $params = new \Joomla\Registry\Registry;
            $params->loadString($this->item->params, 'JSON');

            $this->item->params = $params;

            // Merge global params with item params
            $params = clone $this->getState('params');
            $params->merge($this->item->params);

            $this->item->params = $params;
        }

        return $this->item;
    }
}
17.36 Frontend-View
<?php
/**
 * @package    ComJobs
 * @copyright  2017 David Jardin
 * @license    GNU GPLv2 <http://www.gnu.org/licenses/gpl.html>
 * @link       http://www.djumla.de
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// Import Joomla view library
jimport('joomla.application.component.view');

/**
 * HTML View class for the Jobs Component
 *
 * @since  0.0.1
 */
class JobsViewJob extends JViewLegacy
{
    /**
     * Display job item
     *
     * @param   string  $tpl  template name
     *
     * @return void
     */
    public function display($tpl = null)
    {
        // Assign data to the view
        $this->item = $this->get('Item');

        // Check for errors.
        if (count($errors = $this->get('Errors')))
        {
            throw new RuntimeException(implode('<br />', $errors), 500);
        }

        // Display the view
        parent::display($tpl);
    }
}
17.37 Frontend-Template
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<?php if($this->item->params->get('show_title')): ?>
    <h1>
           <?php echo $this->item->title.(($this->item->params->get('show_category')) ? (' ('.$this->item->category.')') : ''); ?>
    </h1>
<?php endif; ?>
<?php echo $this->item->description ?>
17.38 Parameter des Frontend-Layouts
<?xml version="1.0" encoding="utf-8"?>
<metadata>
    <layout title="COM_JOBS_JOB_VIEW_DEFAULT_TITLE">
        <message>COM_JOBS_JOB_VIEW_DEFAULT_DESC</message>
    </layout>
    <fields
        name="request"
        addfieldpath="/administrator/components/com_jobs/models/fields"
    >
        <fieldset name="request">
            <field
                name="id"
                type="job"
                label="COM_JOBS_JOB_FIELD_TITLE_LABEL"
                description="COM_JOBS_JOB_FIELD_TITLE_DESC"
            />
        </fieldset>
    </fields>
</metadata>
17.39 Selbstdefiniertes Formularfeld für die Auswahl des Jobangebots
<?php
// No direct access to this file
defined('_JEXEC') or die;

JFormHelper::loadFieldClass('list');

/**
 * Job Form Field class for the Jobs component
 *
 * @since  0.0.1
 */
class JFormFieldJob extends JFormFieldList
{
    /**
     * The field type.
     *
     * @var     string
     */
    protected $type = 'Job';

    /**
     * Method to get a list of options for a list input.
     *
     * @return  array       An array of JHtml options.
     */
    protected function getOptions()
    {
        $db = JFactory::getDBO();

        $query = $db->getQuery(true);
        $query->select('#__jobs.id as id, #__jobs.title as title, #__categories.title as category,catid');
        $query->from('#__jobs');
        $query->leftJoin('#__categories on catid=#__categories.id');

        $db->setQuery((string) $query);

        $jobs = $db->loadObjectList();

        $options = array();

        if ($jobs)
        {
            foreach ($jobs as $job)
            {
                $options[] = JHtml::_('select.option', $job->id, $job->title . ($job->catid ? ' (' . $job->category . ')' : ''));
            }
        }

        $options = array_merge(parent::getOptions(), $options);

        return $options;
    }
}
17.40 Frontend-Sprachdatei
COM_JOBS="Jobverwaltung"
COM_JOBS_DESCRIPTION="Dies ist die Jobverwaltung"
17.41 datedisplay.xml
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.7" type="plugin" group="content">
    <name>Date-Display</name>
    <author>David Jardin</author>
    <creationDate>March 2017</creationDate>
    <copyright>Copyright (C) 2017 David Jardin. All rights reserved.­</copyright>
    <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
    <authorEmail>info@djumla.de</authorEmail>
    <authorUrl>www.djumla.de</authorUrl>
    <version>1.0.0</version>
    <description>Zeigt das aktuelle Abrufdatum des Beitrags an</description>
    <files>
        <filename plugin="datedisplay">datedisplay.php</filename>
    </files>
</extension>
17.42 datedisplay.php
<?php
// No direct access.
defined('_JEXEC') or die;

class plgContentDatedisplay extends JPlugin
{
    public function onContentPrepare($context, &$row, &$params, $page = 0)
    {
        $canProceed = $context == 'com_content.article';

        if (!$canProceed) {
            return;
        }

        $date = JFactory::getDate();

        $row->text = "<p>Sie betrachten diesen Inhalt am "
        . $date->format("d.m.y") . "</p>"
        . $row->text;
    }
}
17.43 Beispiel-App für die CLI-Schnittstelle
<?php
// Initialize Joomla framework
const _JEXEC = 1;

// Load system defines
if (file_exists(dirname(__DIR__) . '/defines.php'))
{
    require_once dirname(__DIR__) . '/defines.php';
}

if (!defined('_JDEFINES'))
{
    define('JPATH_BASE', dirname(__DIR__));
    require_once JPATH_BASE . '/includes/defines.php';
}

// Get the framework.
require_once JPATH_LIBRARIES . '/import.legacy.php';

// Bootstrap the CMS libraries.
require_once JPATH_LIBRARIES . '/cms.php';

class SetPassword extends JApplicationCli
{
    public function __construct()
    {
        parent::__construct();

        $this->loadConfiguration($this->fetchConfigurationData("../­configuration.php"));
    }

    //Set Password
    public function set_password( $username, $password )
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select("id")->from("#__users")->where("username = " . $db->quote($username));
        $db->setQuery($query);
        $userid = $db->loadResult();
        $user = JUser::getInstance($userid);

        if($user->id)
        {
            $password   = JUserHelper::hashPassword($password);

            $query = $db->getQuery(true);
            $query->update("#__users")->set("password = ".$db->quote($password))->where("id = ".$user->id);
            $db->setQuery($query)->query();
            return true;
        }
        else
        {
            return false;
        }
    }


    public function execute()
    {
        $this->out( 'What is your username?' );
          $username = $this->in( );

          $this->out( 'Enter your new password?' );
          $password = $this->in( );

        if($this->set_password( $username, $password ))
        {
            $this->out( "Password successfully changed" );
        }
        else
        {
            $this->out( "Invalid Username" );
        }
    }


}

JCli::getInstance('SetPassword')->execute();

Kapitel 19

19.1 pfadfinder.php
<?php echo dirname(__FILE__); ?>
19.2 Relevante Einträge in der configuration.php
<?php
class JConfig {
    [...]
    public $host = 'DATENBANKSERVER';
    public $user = 'DATENBANKBENUTZER';
    public $password = 'DATENBANKPASSWORT';
    public $db = 'DATENBANKNAME';
    [...]
    public $log_path = 'AUSGABE VON PFADFINDER/logs';
    public $tmp_path = 'AUSGABE VON PFADFINDER/tmp';