Buy Now
Sign in

How to use hmtl5 audioplayer in autocreate joomla article ?

Henocq , June 28 2016, 10:21
H
Henocq 4
June 28 2016, 10:21 #360350
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 64
June 28 2016, 13:39 #360353
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
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
H
Henocq 4
June 28 2016, 14:40 #360356
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 64
June 28 2016, 14:57 #360357
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
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
H
Henocq 4
June 28 2016, 15:08 #360358
Yeaaaa !!!!
It's work fine !!!
Thank you very much !!!