Logo of SermonSpeaker Extension Claim

Login Form

When you created your first own layouts, you may have noticed some helper functions. I want to explain those a bit here:

SermonspeakerHelperPlayer

The most important helper function is the player helper. It will take care of the Flash player for you creating all the needed javascript and html calls. The code is located in

/components/com_sermonspeaker/helpers/player.php

The easiest call is to just use

$player = SermonspeakerHelperSermonspeaker->getPlayer($this->items);

This will create a "$player" object containing all the needed code.

Properties:

The object contains properties which may be used in your layout. The two bold ones are the important ones.

$player->mspace
Contains the html-tag, which will be overwritten by Flash. Most important here is the "id" of this tag.
$player->script
Contains the javascript code. This code will load the Flash player and controls it.
$player->toggle
Set to true if both an audio and video file is present and the parameter is enabled.
$player->player
Contains the name of the player that will be loaded. Can be JWPlayer, FlowPlayer, PixelOut, MediaPlayer or Vimeo.
$player->playlist
Contains the playlist in a format suitable for the player.
$player->popup
Contains the calculated height and width for the popup window.
$player->file
Contains the loaded file in case the player has no playlist.
$player->mode
Contains the player status. Can be playlist, audio or video.
$player->error
Only set in case of an error.

Arguments

The first argument for the player helper has to be an array of sermon objects or a single sermon object. This usually is $this->items or $this->item in the layouts.
The helper also takes a second argument which is optional. It allows some minor customization. The second argument has to be an array of (optional) config options. The call then looks something like this:

$config = array('count' => 1, 'alt_player' => 1);
$player = SermonspeakerHelperSermonspeaker->getPlayer($this->items, $config);

The available options are:

count
The unique id of your player, used if you have more than one player on your page. This will also be added to the id of the html tag for the player.
type
Forces the player to show the audio- or videofile. By default the player selects the file based on availability and the priority parameter. Valid values are 'audio', 'video' and 'auto' (default).
autostart
Used to force autostart off. Usefull if you have multiple players in the layout to avoid all of them playing. Values are 0 for off and 1 for on.
alt_player
Forces a specific player. May be 0 for JWPlayer, 1 for PixelOut and 2 for FlowPlayer. Overrides the default player parameter.
awidth, aheight, vwidth, vheight
Allows you to set custom width and height for audio and video playback. By default it takes fixed values based on the selected player.

SermonspeakerHelperSermonspeaker

This helper class contains various functions which are usefull now and then. You already used this to get the playerclass. The code is located in

/components/com_sermonspeaker/helpers/sermonspeaker.php

To call them use something like:

echo SermonspeakerHelperSermonspeaker::makelink($path);

Functions

SpeakerTooltip($id, $pic, $name)
Creates the speaker tooltip. $id is the id of the speaker, $pic contains his picture and $name is the name of the speaker.
insertAddfile($addfile, $addfileDesc, $show_icon)
Will create a valid link to the additional file. If the description is empty, it will show the filename instead. The third argument is optional and will show a small icon in front of the link if set.
makelink($path, $abs = false)
Generic function to make a valid path. Basically adds the Joomla root to the filepath.
insertdlbutton($id, $type = 'audio', $mode = 0)
Returns a button to download the sermon file. $id is the id of the sermon, the $type is optional and defaults to 'audio', may also be 'video'. The $mode parameter decides if the link will be showed as button or icon and if it's built in Joomla 3.0 (bootstrap) style or classic.
insertPopupButton($id, $player)
Returns a button for the popup window. $id is the id of the sermon, $player is the player object (used for the popup dimension)
insertTime($time)
Formats the $time to a format like hrs:min:sec or min:sec.
insertSermonTitle($i, $item, $player, $icon = true)
Returns the "play" icon and the sermon title. The links are generated depending on the settings and may go to the detailpage, file, popup window or control the player. $i is the index of the sermon, used for controlling the player. $item is the actual sermon object, $player is the player object (used for popup dimensions). $icon will set if the play icon is shown or not.
insertSearchTags($item, $separator = ', ')
Creates searchtags for each metakey found. $item is the whole itemobject or a string of coma separated words. The generated links will call the Joomla search with the tag. Depending on the settings the tags will be included or not. $separator allows you to specify how the links will be separated.
insertScriptures($scripture, $between, $addTag = true)
Builds the scripture and inserts them into your layout. $scripture is the database string which holds the scripture info. By itself it's just a lot of numbers. In most layouts it's stored in $item->scripture. $between is a string which tells the function how to join the scriptures if there is more than one. Common values could be '<br />' or '; ' depending if you want them on a single line or put below eachother. Finally the optional parameter $addTag defines if the scripture should be wrapped with the plugin tags.
insertPicture($item, $makeLink = 0)
Will return a picture for the sermon, falling back to the series picture and the speaker picture if not found. $makeLink decides if the returned link is already passed through the makelink function.

Joomla functions

Of course Joomla has a lot of own functions which you can use as well. The documentation for those is on docs.joomla.org.

For layouts probably the most important section is the HTML Package

PHP functions

Last but not least, you will use some PHP functions. Documentation about those can be found on www.php.net.

You will probably need some control structures like 'if', 'else' and 'foreach'. And of course the string function 'echo'.