Hi,

I'm trying to use the base url in my custom fromatter (advanced mode) it would be easy in basic with the [site-url] token.

I tried :
global $base_path
$base path
base_path()
''

but non worked, then I ended to use :

$_SERVER['HTTP_HOST']

Is that ok ?

My formatter (to play quicktime video in 480p) :


$output = '';

    if ($element['#item']['filepath'])
    { 
     $output = '
      <div class="field-video-quicktime-480"> 
    
       <object id="IEQT" 
         classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
         width="853"
         height="480">
        <param name="src" value="http://'.$_SERVER['HTTP_HOST'].''.$element['#item']['filepath'].'"/>
        <param name="autoplay" value="true"/>
        <param name="controller" value="true"/>
       
         <!--[if !IE]> <-->
       
        <object id="NonIEQT"
          data="http://'.$_SERVER['HTTP_HOST'].''.$element['#item']['filepath'].'"
          type="video/quicktime"
          width="853"
          height="496">
           <param name="autoplay" value="true"/>
           <param name="controller" value="true"/>
        </object>
       
         <!--> <![endif]-->
       </object>
      </div> ';
    }

return $output;

By the way thank you for this excellent module, I was stuck with views and panels formatters for video, as the video module formatter for quicktime has a bug http://drupal.org/node/750596

Comments

Jerome F’s picture

Oops forgot the slash : '.$_SERVER['HTTP_HOST'].'/'.$element['#item']['filepath'].'

height="480"> has to be 496 as well

Jerome F’s picture

This works. I guess that's fine.

Just curious to know what you think about it.

deciphered’s picture

I suspect I know the cause of this, hopefully I'll have some time to look into it in the neat future.

Cheers,
Deciphered.

deciphered’s picture

Status: Active » Fixed

The better approach would be to use the following format:

url($element['#item']['filepath'], array('absolute' => TRUE));
Jerome F’s picture

Status: Fixed » Closed (fixed)

Thank you! I'll change that.

deciphered’s picture

P.S., Sorry for the 1 year delay in response, been and continues to be a busy time in my life.