Skip to content

Latest commit

 

History

History
58 lines (42 loc) · 1.27 KB

source.md

File metadata and controls

58 lines (42 loc) · 1.27 KB

HAPEL Core Method Reference


<source ...>

Description

Creates a <source> html tag.

source($src, $type, $media, $scrset, $sizes, $attr);

Parameters

Parameter Required Default
$src no null
$type no null
$media no null
$srcset no null
$sizes no null
$attr no null

Depending on the type of source tag you are creating, (picture, audio, video, etc.), the attributes that you use will vary.

Return Values

string

Example

To create an audio source:

Usage:

echo source('podcast.mp3', 'audio/mpeg');

Result:

<source src="podcast.mp3" type="audio/mpeg">

To create a picture source:

Usage:

echo source(null, null, 'min-width:1200px', 'flower_lg.jpg');
echo source(null, null, 'min-width:100px', 'flower_sm.jpg');

Result:

<source srcset="flower_lg.jpg" media="min-width:1200px">
<source srcset="flower_sm.jpg" media="min-width:100px">