我正在建立一个水平滚动的网站,有索引展示。其中一个部分需要有一个视频,我不能在indexhibit cms后端设置(在那里它将添加到wide div的宽度),所以我需要将其添加到php生成文件中。基本上,它需要检查具有ID的元素
vid
是存在的。如果是这样,它应该添加
vid_width
和
vid_right_padding
到最后的宽度,
final_img_container
. 如果没有,就应该忽略不计。视频网站可以在这里找到:
http://www.allisonnavon.com/index.php?/projects/the-alka-seltzer-challenge/
正如您在这里看到的,宽度是完美的,但是当加载其他页面时,在每个项目的右端有一个额外的800像素。
代码如下:
/**
* Horizontal Format
*
* Exhbition format
* Originally created for SharoneLifschitz.com
*
* @version 1.1
* @author Vaska
*/
$DO = new Horizontally;
$exhibit['exhibit'] = $DO->createExhibit();
$exhibit['dyn_css'] = $DO->dynamicCSS();
class Horizontally
{
// PADDING AND TEXT WIDTH ADJUSTMENTS UP HERE!!!
var $picture_block_padding_right = 25;
var $text_width = 250;
var $text_padding_right = 75;
var $vid_width = 800;
var $vid_padding_right = 25;
var $final_img_container = 0; // do not adjust this one
function createExhibit()
{
$OBJ =& get_instance();
global $rs;
$pages = $OBJ->db->fetchArray("SELECT *
FROM ".PX."media, ".PX."objects_prefs
WHERE media_ref_id = '$rs[id]'
AND obj_ref_type = 'exhibit'
AND obj_ref_type = media_obj_type
ORDER BY media_order ASC, media_id ASC");
if (!$pages) return $rs['content'];
$s = ''; $a = ''; $w = 0;
$this->final_img_container = ($rs['content'] != '') ? ($this->text_padding_right + $this->text_width + $this->vid_padding_right + $this->vid_width) : 0;
foreach ($pages as $go)
{
$title = ($go['media_title'] == '') ? '' : "
$title .= ($go['media_caption'] == '') ? '' : "
";$temp_x = $go['media_x'] + $this->picture_block_padding_right;
$this->final_img_container += ($go['media_x'] + $this->picture_block_padding_right);
$a .= "
$a .= "
$a .= "\n";
$a .= "
\n";$a .= "
$a .= "
}
$s .= "
\n";return $s;
}
function dynamicCSS()
{
return "#img-container { width: " . ($this->final_img_container + 1) . "px; }
#img-container #text { float: left; width: " . ($this->text_width + $this->text_padding_right) . "px; }
#img-container #text p { width: " . $this->text_width . "px; }
#img-container #vid { float: left; width: " . ($this->vid_width + $this->vid_padding_right) . "px; }
#img-container #vid p { width: " . $this->vid_width . "px; }
#img-container .picture_holder { float: left; }
#img-container .picture { /* padding-top: 10px; */ }
#img-container .captioning .title { margin-top: 12px; font-weight: bold; }
#img-container .captioning .caption { font-family:PerspectiveSansItalic;
font-size:11px; color: #444; padding-top: 10px;}";
}
}