Forums

How to use hmtl5 audioplayer in autocreate joomla article ?

Henocq 28 Jun, 2016
Hi,
I've created a form to upload an audio file and autocreate an joomla article. I want to insert a html5 audio player in the article with only this file.

<audio controls>
<source src="audio/lastupload.wav" type="audio/wav">
</audio>

How can I do that ?

Thanks a lot,

Julien Henocq
GreyHead 28 Jun, 2016
Hi Julien,

you should be able to add the file name using {input_name} but with the name of your File upload element so you would add something like this to the article body
<audio controls>
<source src="audio/{input_name}" type="audio/wav">
</audio>

Bob
Henocq 28 Jun, 2016
Hi,
thanks for your answer.
I created a custom code module, with this code :

<?php
$form->data['new_player'] = "
<audio controls>
<source src="/audio/{file_upload}" type="audio/wav">
</audio>
";
?>

I put 'new_player' in the full text field of the joomla article,

and i have an error :
Parse error: syntax error, unexpected '{' in /home/users4/h/henocqjulien/www/soundbank/administrator/components/com_chronoforms5/chronoforms/actions/custom_code/custom_code.php(20) : eval()'d code on line 6

what's wrong ?

thanks
GreyHead 28 Jun, 2016
Hi Henocq,

You can’t use the {input_name} syntax in PHP :-( (or have "" inside ""). Please try
<?php
$form->data['new_player'] = "
<audio controls>
<source src='/audio/{$form->data['file_upload']}' type='audio/wav' />
</audio>
";
?>

Bob
Henocq 28 Jun, 2016
Yeaaaa !!!!
It's work fine !!!
Thank you very much !!!
This topic is locked and no more replies can be posted.