我不是PHP專家。我想實現一個星級評級腳本。因此,我想在頁面開始處實施評級:如何實現此代碼?
<?php require_once("ratings.php"; $rr = new RabidRatings(); ?>
但是,這給我一個服務器錯誤。
這是打開HTML標記之前我的PHP代碼(在頁面上,我想教學貫徹星級評價腳本):
<?
include "admin/configuration/config.php";
include "admin/configuration/main_class.php";
function en_string($str)
{
return strtolower(str_replace(" ", "_", trim($str)));
}
function de_string($str)
{
return str_replace("_", " ", trim($str));
}
;
$id = en_string($_GET['id']);
$id2 = en_string($_GET['id2']);
;
$path = "../";
if($id2)
{
$sql = "SELECT * FROM fh_categories AS a JOIN fh_subcategories AS b ON a.fh_Cid=b.fh_Cid JOIN fh_software AS c ON b.fh_SCid=c.fh_SCid JOIN fh_version AS d ON d.fh_Sid=c.fh_Sid WHERE d.fh_Sid='$id' and d.fh_Vid='$id2' ";
$path = "../../";
}
else
{
$sql = "SELECT * FROM fh_categories AS a JOIN fh_subcategories AS b ON a.fh_Cid=b.fh_Cid JOIN fh_software AS c ON b.fh_SCid=c.fh_SCid JOIN fh_version AS d ON d.fh_Sid=c.fh_Sid WHERE d.fh_Vfront=1 and d.fh_Sid='$id'";
}
$query1 = mysql_query($sql);
$rec = mysql_fetch_array($query1);
$cid = $rec['fh_Cid'];
$scid = $rec['fh_SCid'];
$sid = $rec['fh_Sid'];
$description = $rec['fh_Sdescription'];
$technical = $rec['fh_Vtechnical'];
$changelog = $rec['fh_VchangeLog'];
$caption = $rec['fh_Sid'];
$company = $rec['fh_Scompany'];
$homepage = $rec['fh_Shomepage'];
$icon = $rec['fh_Sicon'];
$version = $rec['fh_Vcaption'];
$shot = $rec['fh_Vscreenshot'];
$size = $rec['fh_Vsize'];
$license = $rec['fh_Vlicense'];
$extension = $rec['fh_Vextension'];
$platform = $rec['fh_Vplatform'];
$did = $rec['fh_Did'];
$date = strftime("%d %b %Y", $rec['fh_Vdate']);
$language = "English";
$j = 1;
for($i = 0; $i < (strlen($shot)); $i++)
{
if($shot[$i] != ';')
{
$screenshot[$j] .=$shot[$i];
}
else
{
$j++;
}
}
?>
這是顯示含有評級<div>
啓動代碼:
<?php $rr->showStars("anotherGreatArticle"); ?>
當我將它添加到我的頁面時,它不會在頁面上顯示任何內容,並且該頁面僅在一半時加載。
我會如何整理和完成工作?
請縮進您的代碼。 http://www.youtube.com/watch?v=EsF2Sb3pf6w – mzedeler
'require_once'需要一個右括號。 –