2013-06-02 3 views
-2

저는 PHP 전문가가 아닙니다. 별 등급 스크립트를 구현하고 싶습니다. 따라서 평가를 위해 페이지 시작 부분에 구현하고자합니다.이 코드를 구현하는 방법은 무엇입니까?

<?php require_once("ratings.php"; $rr = new RabidRatings(); ?> 

그러나 이것은 서버 오류입니다.

이 (필자는 성급 호텔 인 스크립트를 impelement하고자하는 페이지) 여는 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"); ?> 

내 페이지에이를 추가하면 페이지에 아무 것도 표시되지 않고 페이지가 절반 만로드됩니다.

어떻게 정리하고 작동시킬 수 있습니까?

<?php require_once("ratings.php"; $rr = new RabidRatings(); ?> 

<?php require_once("ratings.php"); $rr = new RabidRatings(); ?> 
//       ^ forgot to close this 

당신은() 당신은 require_once를 한 후 닫는 중괄호를 forgt require_once("ratings.php")

+0

코드를 들여 씁니다. http://www.youtube.com/watch?v=EsF2Sb3pf6w – mzedeler

+1

'require_once'는 닫는 괄호가 필요합니다. –

답변

2

구문 오류가 있습니다.

구문 및 오류 강조 표시가있는 편집기/IDE를 사용하는 경우에는 이러한 상황이 발생할 수 없습니다. 괜찮은 편집기는 오류 코드를 즉시 강조해야합니다. 이러한 기능을 갖춘 무료 편집자는 Notepad ++, Netbeans, Eclipse (학습 곡선에서 쉽게 배우기 쉽도록 정렬되었습니다 - 틀림없이.)

2

을 닫습니다 잊어해야한다 :

관련 문제