謝謝樓上,那些我都看過,不過和我問題不一樣。
我用了cpmfetch
http://cpmfetch.fistfullofcode.com/, 並在網站根目錄生成了seeclip.php 文件調用cpmfetch文檔,代碼如下:
<?php
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/album");
$objCpm->cpm_viewRandomMedia(2,5);
$objCpm->cpm_close();
?>
第一行是cpmfetch安裝目錄,第二行指CPG所安裝目錄,第三行Syntax: cpm_viewRandomMedia( # rows, # cols); 表示顯示結果2行rows 5列column.
或者更詳細的按瀏覽多少排列顯示最多瀏覽:
$styleguide = array(
"linkstyle" => "photoclip",
"alttag" => "views: %h",
"subtitle" => "views: %h",
"imagestyle" => "photoclip",
"imagesize" => 'thumb');
$objCpm->cpm_setReturnType('print');
$data = $objCpm->cpm_viewRandomMostViewedMediaFrom ("", 1, 5, $styleguide);
這裏Syntax: cpm_viewRandomMostViewedMediaFrom($source, $rows, $columns, $options);
但是打算在網站首頁調用這個seeclip.php 的顯示結果卻一直沒有成功,在首頁代碼相應位置嵌入了
<script src=seeclip.php></script>
或者
<?php include("http://www.xxx.com/seealbum.php"); ?>
或者
<script language="Javascript">
<!--
var x1;
x1 = createRequestObject();
function createRequestObject() {
var x = false;
try {
x = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
x = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
x = false;
}
}
if (!x && typeof XMLHttpRequest != "undefined") {
x = new XMLHttpRequest();
}
return x;
}
function getPhotos() {
x1.open('get','seealbum.php'); //Replace random.php with whatever php script you are using to fetch photos
x1.onreadystatechange = function() {
if (x1.readyState == 4) {
document.getElementById("photos").innerHTML = x1.responseText;
}
}
x1.send(null);
}
//-->
</script>
<script language="Javascript">
<!--
getPhotos();
//-->
</script>
根本不起作用。後來乾脆用了<iframe>標簽,如下
<iframe src="http://www..xxx.com/seeclip.php"
framespacing="0" frameborder="no" scrolling="no" width="100%"
height="20%"></iframe>
。可以調用,但是點擊圖片后新窗口只在定義的FRAME框中打開。很不方便。
哪位知道如何其他非Iframe方式調用這個seeclip.php程式?