Closed (fixed)
Project:
Custom Formatters
Version:
6.x-1.5-beta1
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
25 Mar 2010 at 22:59 UTC
Updated:
14 Apr 2011 at 09:46 UTC
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
Comment #1
Jerome F commentedOops forgot the slash : '.$_SERVER['HTTP_HOST'].'/'.$element['#item']['filepath'].'
height="480"> has to be 496 as well
Comment #2
Jerome F commentedThis works. I guess that's fine.
Just curious to know what you think about it.
Comment #3
deciphered commentedI suspect I know the cause of this, hopefully I'll have some time to look into it in the neat future.
Cheers,
Deciphered.
Comment #4
deciphered commentedThe better approach would be to use the following format:
Comment #5
Jerome F commentedThank you! I'll change that.
Comment #6
deciphered commentedP.S., Sorry for the 1 year delay in response, been and continues to be a busy time in my life.