我有以下工作代码,我想更改课程代码,所以我使用 MS Word 并将批量搜索替换为 00" 为 00b"
但我最终遇到了错误:语法错误,意外的''(T_ENCAPSED_AND_WHITESPACE),期待'-'或标识符(T_STRING)或变量(T_VARIABLE)或数字(T_NUM_STRING)
即使现在,如果我尝试将 00b" 切换回 00",它仍然不起作用
这是代码,你能帮帮我吗?感谢:
<script type="text/javascript">
function rowHighlight() {
for (i=0; i < document.getElementById("display-section1").CourseSelection.length; i++) {
if (document.getElementById("CourseSelection" + i).checked == true) {
document.getElementById("CourseSelection" + i).parentNode.className = 'highlight';
} else {
document.getElementById("CourseSelection" + i).parentNode.className = '';
}
}
}
</script>
<style>
.highlight {
background-color: lightyellow;
}
</style>
<?
if ( isset($_REQUEST['DEBUG']) && strlen($_REQUEST['DEBUG'])>0 ) {
echo "Debug Information: Requested course ID: ".$_REQUEST['CourseID']."</pre>";
}
$app =& JFactory::getApplication();
$app->allowCache(false);
$reqID = 0;
$reqCode = "";
$courseTitle = "";
$noneOfTheAboveText = "None of these courses match my availability...";
if ( isset($_REQUEST['CourseID']) && strlen($_REQUEST['CourseID'])>0 ) {
$reqID = $_REQUEST['CourseID'];
}
if ( isset($_REQUEST['CourseCode']) && strlen($_REQUEST['CourseCode'])>0 ) {
$reqCode = $_REQUEST['CourseCode'];
}
if ( isset($_REQUEST['DEBUG']) && strlen($_REQUEST['DEBUG'])>0 ) {
echo "<pre>Referrer: ".$_SERVER['HTTP_REFERER']."\n";
echo "RequestedID: ".$reqID."\n";
echo "Requested Code: ".$reqCode ."\n";
}
if( $reqID == 0 && $reqCode == "" && $_SERVER['HTTP_REFERER']!="" ) {
//try to get course code from referring page
if (stristr($_SERVER['HTTP_REFERER'],"secrets")) { $reqCode="!GT100”; }
if (stristr($_SERVER['HTTP_REFERER'],"gem-identification")) { $reqCode="!GT200”; }
if (stristr($_SERVER['HTTP_REFERER'],"epic")) { $reqCode="!FT100”; }
if (stristr($_SERVER['HTTP_REFERER'],"future-trends")) { $reqCode="!FT200”; }
if (stristr($_SERVER['HTTP_REFERER'],"creative-drawing")) { $reqCode="!JD100”; }
if (stristr($_SERVER['HTTP_REFERER'],"technical-drawing")) { $reqCode="!JD200”; }
if (stristr($_SERVER['HTTP_REFERER'],"jewellery-illustration")) { $reqCode="!JD300”; }
if (stristr($_SERVER['HTTP_REFERER'],"layout-of-jewellery")) { $reqCode="!JD400”; }
if (stristr($_SERVER['HTTP_REFERER'],"fundamentals-of-digital")) { $reqCode="!DD100”; }
if (stristr($_SERVER['HTTP_REFERER'],"intermediate-3d-modelling")) { $reqCode="!DD200”; }
if (stristr($_SERVER['HTTP_REFERER'],"advanced-3d-modelling")) { $reqCode="!DD300”; }
if (stristr($_SERVER['HTTP_REFERER'],"modelling-with-non-jewellery")) { $reqCode="!DD400”; }
if (stristr($_SERVER['HTTP_REFERER'],"silver-modelling")) { $reqCode="!NM100”; }
if (stristr($_SERVER['HTTP_REFERER'],"sculptural-design")) { $reqCode="!NM200”; }
if (stristr($_SERVER['HTTP_REFERER'],"moulds-to-gold")) { $reqCode="!NM300”; }
if (stristr($_SERVER['HTTP_REFERER'],"metallurgy-masterclass")) { $reqCode="!NM400”; }
if (stristr($_SERVER['HTTP_REFERER'],"metalwork")) { $reqCode="!MS100”; }
if (stristr($_SERVER['HTTP_REFERER'],"and-stone-setting")) { $reqCode="!MS200”; }
if (stristr($_SERVER['HTTP_REFERER'],"basic-stone-settings")) { $reqCode="!MS300”; }
if (stristr($_SERVER['HTTP_REFERER'],"casting-metals")) { $reqCode="!MS400”; }
if (stristr($_SERVER['HTTP_REFERER'],"fashion-jewellery-knowledge")) { $reqCode="!FJ100”; }
if (stristr($_SERVER['HTTP_REFERER'],"versatile-fashion")) { $reqCode="!FJ200”; }
if (stristr($_SERVER['HTTP_REFERER'],"effectiveness-for-fashion")) { $reqCode="!FJ300”; }
if (stristr($_SERVER['HTTP_REFERER'],"master-fashion")) { $reqCode="!FJ400”; }
if (stristr($_SERVER['HTTP_REFERER'],"fine-jewellery-design-diploma")) { $reqCode="!DipFJD"; }
if (stristr($_SERVER['HTTP_REFERER'],"precious-metal-arts-diploma")) { $reqCode="!!DipPMA"; }
if (stristr($_SERVER['HTTP_REFERER'],"fashion-jewellery-arts-diploma")) { $reqCode="!!DipFJA"; }
if (stristr($_SERVER['HTTP_REFERER'],"marketing")) { $reqCode="!MK100”; }
if (stristr($_SERVER['HTTP_REFERER'],"merchandising")) { $reqCode="!ME100”; }
if (stristr($_SERVER['HTTP_REFERER'],"entrepreneurship-certificate")) { $reqCode="!EN100”; }
if (stristr($_SERVER['HTTP_REFERER'],"operations-management-certificate")) { $reqCode="!RE100”; }
}
if ( isset($_REQUEST['DEBUG']) && strlen($_REQUEST['DEBUG'])>0 ) {
echo "Interpreted Request Code: ".$reqCode ."</pre>";
}
if( $reqID == 0 && $reqCode == "") { $reqCode="!GT100”; }
$database =& JFactory::getDBO();
$anSQLClause = "SELECT ScheduledEventID, ScheduledEventName, " .
" ScheduledEventTimeCode, ScheduledEventTime, " .
" ScheduledEventInstructor, ScheduledEventPart, " .
" ScheduledEventDate, ScheduledEventCode, ScheduledEventShortName, " .
" ProductID, ShortName, Title, Description, BGColor, FGColor, URL, MaxPax, Hours " .
" FROM j30_coursecalendar INNER JOIN j30_coursecalendar_descriptions ON j30_coursecalendar.ScheduledEventCode=j30_coursecalendar_descriptions.ProductID";
$orderbyClause = " ORDER BY ScheduledEventID, ScheduledEventPart";
$whereClause = " WHERE ScheduledEventDate >= CURRENT_DATE() ";
if ($reqID>0 && $reqCode=="") {
$whereClause .= " AND ScheduledEventID=".$reqID;
} else {
$whereClause .= " AND LCASE(ProductID)=\"". strtolower($reqCode)."\"";
}
$Courses=array();
$database->setQuery($anSQLClause.$whereClause.$orderbyClause);
if ( isset($_REQUEST['DEBUG']) && strlen($_REQUEST['DEBUG'])>0 ) {
echo "<pre>".$anSQLClause.$whereClause.$orderbyClause."</pre>";
}
$rows = $database->loadObjectList();
if(count($rows)>0) {
foreach ($rows as $row) {
if ( array_key_exists($row->ScheduledEventID,$Courses) ) {
$anEvnt = $Courses[$row->ScheduledEventID];
$anEvnt->AddPart($row->ScheduledEventPart, strtotime($row->ScheduledEventDate));
} elseif ($row->ScheduledEventPart=="1") {
$anEvnt = new CalendarEvent( $row->ScheduledEventID,
$row->ScheduledEventName,
$row->ScheduledEventTimeCode,
$row->ScheduledEventTime,
$row->ScheduledEventInstructor,
$row->ScheduledEventCode,
$row->ScheduledEventShortName,
$row->ProductID,
$row->Title,
$row->Description,
$row->BGColor,
$row->FGColor,
$row->URL,
$row->MaxPax,
$row->Hours);
$anEvnt->AddPart($row->ScheduledEventPart, strtotime($row->ScheduledEventDate));
$Courses[$row->ScheduledEventID] = $anEvnt;
$courseTitle = $row->ScheduledEventName;
$reqCode = $row->ProductID;
}
} // end for over each row
}
if ($courseTitle == "") {
$noneOfTheAboveText = "The next schedules of this Blended-learning course may start as early as end of March/ early April 2023. To join the waitlist and be the first to be offered a slot in our new Bugis campus, please submit the form below.";
if ($reqCode!="") {
$anSQLClause = "SELECT Title FROM j30_coursecalendar_descriptions WHERE LCASE(ProductID)='".strtolower($reqCode)."'";
$database->setQuery($anSQLClause);
$rows = $database->loadObjectList();
if (sizeOf($rows)>0) {
$row=$rows[0];
$courseTitle=$row->Title;
} else {
$courseTitle = "JDMIS Courses";
}
}
if ($courseTitle == "") {
$courseTitle = "JDMIS Courses";
}
}
if ( isset($_REQUEST['DEBUG']) && strlen($_REQUEST['DEBUG'])>0 ) {
echo"<pre>";
print_r($Courses);
echo"referrer:".$_SERVER['HTTP_REFERER'];
echo"</pre>";
}
class calendarEvent {
var $ID = null;
var $Name = null;
var $TimeCode = null;
var $EventTime = null;
var $Instructor = null;
var $ProductCode = null;
var $Parts = array();
var $ShortName = null;
var $ProductID = null;
var $Title = null;
var $Description = null;
var $BGColor = null;
var $FGColor = null;
var $URL = null;
var $MaxPax = null;
var $Hours = null;
function __construct($anID, $aName, $aTimeCode, $aTime, $anInstructor, $aProductCode, $aShortName, $aProductID, $aTitle, $aDescription, $aBGColor, $aFGColor, $aURL, $aMaxPax, $aHours){
$this->ID = $anID;
$this->Name = $aName;
$this->TimeCode = $aTimeCode;
$this->EventTime = $aTime;
$this->Instructor = $anInstructor;
$this->ProductCode = $aProductCode;
$this->ShortName = $aShortName;
$this->ProductID = $aProductID;
$this->Title = $aTitle;
$this->Description = $aDescription;
$this->BGColor = $aBGColor;
$this->FGColor = $aFGColor;
$this->URL = $aURL;
}
function GetPartNumber($aDate){
if ( array_key_exists(getDateKey($aDate),$this->Parts)==true ) {
return $this->Parts[getDateKey($aDate)]->PartNumber;
} else {
return 0;
}
}
function AddPart($aPart, $aDate) {
if ( array_key_exists( getDateKey($aDate), $this->Parts) ) {
echo "<!--H1><font color=red>WARNING Duplicate Event Date Found! ".date("j/M/y",$aDate)."<FONT></H1-->";
} else {
$anEventPart = new EventPart($aPart, $aDate);
$this->Parts[getDateKey($aDate)] = &$anEventPart;
}
}
}
class EventPart {
var $PartNumber = null;
var $PartDate = null;
function __construct($pn, $pd){
$this->PartNumber = $pn;
$this->PartDate = $pd;
}
}
function getDateKey($aDate) {
return "DTE:".date("j/M/y",$aDate);
}
$user = &JFactory::getUser();
?>
<td width="100%" style="padding:5px; border-bottom:1px solid #e2e2e2;">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr style="background-color:#fafafb">
<td style="padding:7px;"><strong>Your Preferred Course Selection:</strong></td>
</tr>
<tr>
<td style="padding:7px;">
<?
$strOut="";
$radioCount=0;
foreach ($Courses as $anEvent) {
$hideThisModuleWithinDip=false;
if (stristr($anEvent->ProductID, '!!')) {
//Ignore - this is a request for a diploma course
} else {
if (stristr($anEvent->ShortName, 'dip') && stristr($anEvent->ShortName, ':') ) {
$hideThisModuleWithinDip=true;
}
}
if (!$hideThisModuleWithinDip && ($radioCount<7 || $anEvent->ID==$reqID)) {
$radioCount++;
foreach($anEvent->Parts as $aPart) {
$PartOneDate = $aPart->PartDate;
break;
}
$checkedString="";
$highlightClass="";
if ($reqID==$anEvent->ID) { $checkedString="CHECKED"; $highlightClass=" highlight";}
$strOut.= '<div class="'.$highlightClass.'"><INPUT TYPE="radio" '.$checkedString.' id="CourseSelection'.$radioCount.'" NAME="CourseSelection" onClick="rowHighlight();" VALUE="'. $anEvent->Name . ' starting on ' . date("D, j M y", $PartOneDate ) . ' between ' . $anEvent->EventTime .' (' . $anEvent->ID . ')"> ';
$strOut.= "<span class=\"coursename\"> ". $anEvent->Name ."</SPAN><br>";
$strOut.= "<span class=\"coursesubheader\"> ". " between " . $anEvent->EventTime . " Taught by ". $anEvent->Instructor ."</SPAN><br>";
foreach ($anEvent->Parts as $aPart) {
$strOut.= " Part " . $aPart->PartNumber . ": " . date("D, j M y", $aPart->PartDate ) . "<br>";
}
$strOut.= "</input></div><br>\n";
} //end loop to limit course count
} //End loop over courses
echo $strOut;
echo "<!-- INTERNAL: code='" . $reqCode . "' ID='" . $reqID ."' Referrer=". $_SERVER['HTTP_REFERER'] . " -->";
$checkedString="";
$highlightClass="";
if($reqID=="") { $checkedString="CHECKED"; $highlightClass="highlight";}
?>
<div class="<?=$highlightClass?>">
<INPUT TYPE="radio" id="CourseSelection0" NAME="CourseSelection" VALUE="None of these courses match my availability..." <?=$checkedString?> onClick="rowHighlight();" >
<span class="coursename">
<?=$noneOfTheAboveText?>
</span>
<div style="margin:0 0 0 35px">
So please let us know:<br>
When you would prefer to start:
<select name="LevelOfInterest" class="SmallTextBox">
<option selected="selected" value="in the next few days">in the next few days</option>
<option value="in 1-2 weeks">in 1-2 weeks</option>
<option value="in 2-4 weeks">in 2-4 weeks</option>
<option value="in 1-2 months">in 1-2 months</option>
<option value="after 2 or more months">after 2 or more months</option>
</select>
<br>What schedules suit you best...
<div style="margin:0 0 0 60px">
<input type="checkbox" name="Availability[]" value="WeekDays" checked="checked" /> Week Days (9/10am-5/6pm)<br>
<!--input type="checkbox" name="Availability[]" value="WeekNights" checked="checked" /> Week Nights (7pm-9/10pm)<br-->
<input type="checkbox" name="Availability[]" value="Weekends" checked="checked" /> Week Ends (11am-6/7pm)<br>
</div>
</div>
</input>
</div>
</td>
</tr>
</table>
</td>
<?php
$trackerresult="";
if (isset($_GET['utm_source'])) {
setcookie( "utm_source",
$_GET['utm_source'],
time()+(2 * 365 * 24 * 60 * 60), "/");
$trackerresult.=" Set Source: " . $_GET['utm_source'] ;
}
if (isset($_GET['utm_medium'])) {
setcookie( "utm_medium",
$_GET['utm_medium'],
time()+(2 * 365 * 24 * 60 * 60), "/");
$trackerresult.=" Set Medium: " . $_GET['utm_medium'] ;
}
if (isset($_GET['utm_campaign'])) {
setcookie( "utm_campaign",
$_GET['utm_campaign'],
time()+(2 * 365 * 24 * 60 * 60), "/");
$trackerresult.=" Set Campaign: " . $_GET['utm_campaign'] ;
}
if (isset($_GET['amb'])) {
setcookie( "amb",
$_GET['amb'],
time()+(30 * 24 * 60 * 60), "/");
$trackerresult.=" Set Campaign: " . $_GET['amb'] ;
}
if ($trackerresult == "") {
$trackerresult.="No UTM Data Found";
}
?>
<script>
console.log("UTMTracker Running - result: <?php echo $trackerresult; ?>");
</script>
<input name="utm_source" value="<?=$_COOKIE['utm_source']?>" type="hidden">
<input name="utm_medium" value="<?=$_COOKIE['utm_medium']?>" type="hidden">
<input name="utm_campaign" value="<?=$_COOKIE['utm_campaign']?>" type="hidden">
<input name="REFERER" value="<?=$_SERVER['HTTP_REFERER']?>" type="hidden">
我检查了我们的代码,错误是你的 $reqCode 语句没有正确关闭: 看看
if (stristr($_SERVER['HTTP_REFERER'],"secrets")) { $reqCode="!GT100”; }
这个:
$reqCode="!GT100”;
应该是
$reqCode="!GT100";
你正在使用 -> (”) 代替正确的双引号 -> (”)
您必须更正所有 if() 语句。
提示/建议: 避免使用 MICROSOFT WORD 进行编码。使用一些 IDE/文本编辑器,如 SUBLIME TEXT、VSCODE 等