私は同様のトピックを調べようとしましたが、解決策を見つけることができず、学んだことはすべて実行しましたが、常に同じエラーが発生しました。コードは次のとおりです。
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#example').dataTable();
} ); //this is where its pointing for error
</script>
何かが足りないとは思いませんが、他に間違いがあるはずです...誰か指摘してもらえますか?
これはエラーの詳細です:
解析エラー:構文エラー、予期しない'}'、予期する'、'、または';' /var/www/vhosts/tradeglobus.com/httpdocs/companies_list.phpの41行目
@Alex:これが完全なコードです
$isSeller = ((isset($PageType) && $PageType == "sellers") ? "1" : "0");
if(isset($searchType) && $searchType == "companies")
{
//--------- Show Products Here -----------//
$Query = clsCompanies::searchCompany($keyword, $Limit, $Offset, $countryID);
$companies_list = $objDatabase->runStoredProcedure($Query);
//----------------------------------------//
}
else
{
//--------- Show Products Here -----------//
$Query = clsCompanies::getCompaniesForDetailPages($IndustryId, $isSeller, $Limit, $Offset);
$companies_list = $objDatabase->runStoredProcedure($Query);
//----------------------------------------//
}
if(count($companies_list))
{
$Cnt = 0;
foreach($companies_list as $company)
{
$Cnt++;
echo '<tr>
<td ' . ((($Cnt % 2) == 0) ? "class='Even'" : "class='Odd'") . ' ">
<style type="text/css" title="currentStyle">
@import "http://www.tradeglobus.com/search/demo_page.css";
@import "http://www.tradeglobus.com/search/demo_table.css";
</style>
<script type="text/javascript" language="javascript" src="http://www.tradeglobus.com/search/jquery.js"></script>
<script type="text/javascript" language="javascript" src="http://www.tradeglobus.com/search/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#example').dataTable();
} );
</script>
<body id="dt_example">
<div id="container">
<div id="demo">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr>
<th>Company</th>
<th>Description</th>
<th>Membership Status</th>
<th>Country</th>
</tr>
</thead>
<tbody>
<tr class="gradeX">
<!-- TD for Company Logo STARTS -->
<td rowspan="3" valign="top" width="75px" valign="middle" align="center">
<img src="' . clsPresent::checkImageExistance(BASE_HOST . DEFAULT_COMPANY_LOGO_PATH . $company['company_logo_thumb']) . '" width="75px" height="75px" alt="productImage" />
</td>
<!-- TD for Company Logo ENDS -->
<!-- TD for Company Name & Description STARTS -->
<td rowspan="2" width="450px" align="left" style="line-height: 15px;">
<h4 ><a style="font-size:16px;" href="' . BASE_HOST . 'companies_details/' . $company['MemberID'] . '/' . clsPresent::removeSpecialChars($company['company_name']) . '.htm">' . $company['company_name'] . '
</a></h4><br/>' . ((strlen($company['company_introduction']) > 165) ? substr(strip_tags($company['company_introduction']), 0, 162) . '...' : $company['company_introduction']) .'
</td>
<!-- TD for Company Name & Description ENDS -->
<!-- TD for Company Flag & Package STARTS -->
<td valign="top" >
<div style="float: left; line-height: 25px;"><div class="flags f_' . $company['CountryID'] . '"></div> ' . $company['Country'] .'</div><br/>
</td>
<!-- TD for Company Flag & Package ENDS -->
<td class="center"><img src="' . BASE_HOST . DEFAULT_PACKAGE_IMAGE_PATH . $company['imagePath'] . '" alt="Package Image" width="101px" height="24px" /></td>
</tr>
</table>
<tr>
<td valign="top" style="line-height: 15px;">
<div>';?>
<?php
if(isset($_SESSION['userID']) && $_SESSION['userID'] != ""){ ?>
<a style="vertical-align: top;" class="contactNow" href="<?php echo BASE_HOST; ?>contactmember.php?to=<?php echo $company['MemberID']; ?>&from=<?php echo $_SESSION['userID']; ?>&subject=Contact Request"></a>
<?php } else { ?>
<a style="vertical-align: top;" class="contactNowB" href="<?php echo BASE_HOST; ?>signin.php"></a>
<?php }
echo '</div>
</td>
</tr>
</table>
</td>
</tr>';
}
echo '<tfoot>
<tr>
<th>';
if(isset($PageType) && $PageType != ""){
echo' <span style="float: left; padding-left: 10px;">' . (( $PageNo > 1 ) ? '<a href="' . BASE_HOST . $PageType . '/' . $IndustryId . '/' . ( $PageNo - 1 ) . '/' . $CategoryName . '.htm"><-- Back</a>' : "" ) . '</span>
<span style="float: right; padding-right: 10px;"><a href="' . BASE_HOST . $PageType . '/' . $IndustryId . '/' . ( $PageNo + 1 ) . '/' . $CategoryName . '.htm">Next --></a></span>';
}else{
echo' <span style="float: left; padding-left: 10px;">' . (( $PageNo > 1 ) ? '<a href="' . BASE_HOST . 'search/companies/' . (($countryID != "") ? $countryID : "0") . '/' . ( $PageNo - 1 ) . '/' . $keyword . '.htm"><-- Back</a>' : "" ) . '</span>
<span style="float: right; padding-right: 10px;"><a href="' . BASE_HOST . 'srch/companies/' . (($countryID != "") ? $countryID : "0") . '/' . ( $PageNo + 1 ) . '/' . $keyword . '.htm">Next --></a></span>';
}
echo ' </th>
</tr>
</tfoot>';
}
else
{
echo '<tr>
<td align="center" valign="top">
<h1 style="font-size: 16px; color: #003466;">No companies were found for this category.</h1>
</d>
</tr>';
}
?>