Hi,

Frist of all I would like to thank you for your reply under http://drupal.org/node/1806932

I added the below code

<?php  
$node=menu_get_object(); 
$audiofile = file_create_url($node->field_audio['und'][0]['uri']);
  $info = pathinfo($audiofile);  $op = $info['extension'];  print audiofield_get_player($audiofile, $op);
?>

and I get an error:
Notice: Undefined property: stdClass::$field_audio in eval() (line 6 of public_html/modules/php/php.module(80) : eval()'d code).

I found a similar issue which talks about permissions and the locale module
http://drupal.org/node/1062072

thank you

Comments

tamerzg’s picture

Are you sure your field machine name is field_audio? You can see it under Content type->Structure->Edit your content type -> Manage fields

tbom’s picture

It took a newbie me a long time but finally I made it work.

1) you need to add the field_audio in the content type of your preferred content (e.g. in a Basic page) , my first mistake was that I added a new content type : Audio
2) then you need to add on the Manage display tab of the Content Type of your choice (e.g. basic page) the Audio field of machine name field_audio, filed type:File, widget Audio_upload.

After having that this you use in a basic page the code provided:

$node=menu_get_object(); $audiofile = file_create_url($node->field_audio['und'][0]['uri']); $info = pathinfo($audiofile); $op = $info['extension']; print audiofield_get_player($audiofile, $op);

and then I had two errors first undefined index when I realised that most probably I need to upload the audio file on that page (using the edit page) because the reference otherwise would not work, since in the expression $node->field_audio['und'][0]['uri'] there is no filename, I assumed that it needs to be referenced by the index on that page.
So I uploaded the mp3, and then I got two players the inline one and another one at the bottom.

Then I went in the manage display of the field type and changed everywhere for the Audio into . Only then I got the player inline in between the text and the second player disappeared.

Have I done something wrong above?

ws.agency’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)