473,471 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Parse errors after intalling JBook

3 New Member
I downloaded Jbook component and created link named " Extended Search" on my top menu, link type "component- Jbook" but when I click " Extended Search" button I am getting following error:

Parse error: syntax error, unexpected ';', expecting T_FUNCTION in C:\wamp\www\Joomla_1.0.12-Stable-Full_Package\components\com_jbook\jbook.html.php on line 188

What does it mean ?

jbook.html.php File:
Expand|Select|Wrap|Line Numbers
  1.  </td>
  2.       </tr>
  3.       <tr><td colspan=3>
  4.     <!-- Hack by ICS : delete HR
  5.     <HR> -->
  6.     </td></tr>
  7.           <?php    $k = 1 - $k; }} ?>                         <----- line 188
  8.         </table>
  9.  
  10. <!-- Hack by ICS : add return button for search task -->        
  11.  
[Please use CODE tags when posting source code. Thanks! --pbmods]

Also, after installing jbook component shouldn't the search by book title and authors name component appear on my site automatically without having it linked to my menu ?

I am using WAMP 5 and I have Joomla 1.0.12 site.
Pls help !!!
Thanks
Jun 27 '07 #1
6 1597
pbmods
5,821 Recognized Expert Expert
Changed thread title to better describe the problem (did you know that threads whose titles contain phrases such as 'need help' actually get FEWER responses?).
Jun 27 '07 #2
Atli
5,058 Recognized Expert Expert
Well, judging by that single line of PHP you gave us, Id try to remove the two '}' and see what happens.
Jun 28 '07 #3
lolamk
3 New Member
[CODE TAGS REMOVED DUE TO FORUM DISPLAY BUG]
MODERATOR

Well, judging by that single line of PHP you gave us, Id try to remove the two '}' and see what happens.
I removed two '}' as u suggested. Now, I am getting following error:

Parse error: syntax error, unexpected $end in C:\wamp\www\Joomla_1.0.12-Stable-Full_Package\components\com_jbook\jbook.html.php on line 494

<?php
/**
* Course HTML
*
* @ Copyright (C) 2005 Jan Schulz-Hofen
* @ All rights reserved
* @ Released under GNU/GPL License: http://www.gnu.org/copyleft/gpl.html
* @ This component is derived from the com_booklist component by Yann Bouan which is derived from the mambo com_weblinks component
**/

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

//require_once( "includes/HTML_toolbar.php" );

class HTML_Book {

function displaylist( &$categories, &$rows, $catid, &$currentcat ) {
global $Itemid, $mosConfig_live_site,$mosConfig_absolute_path,$dat abase,$mainframe;

?>

<table width="100%" cellpadding="4" cellspacing="0" border="0" align="center" class="contentpane">
<tr>
<td colspan="2">
<table border=0><tr><td width=40%>
<span class="componentheading">
<?php
if (($currentcat->title)<>''){
echo $currentcat->title;
} else {
echo _GENERIC_NAME;
}
?>
</span>
<?
echo "<p />"._CATEGORY.": ".categoryParentLI($catid,"index.php?option=com_jb ook","catid");
?>
</td>
<td width=40% valign=top><div align=right>
<form action=index.php>
<input type=hidden name=option value=com_jbook>
<input type=hidden name=Itemid value=<?=$Itemid?>>
<!-- Hack by ICS : was present twice (+reorder)
<input type=hidden name=option value=com_jbook>
-->
<input type=hidden name=task value=search>

<table><tr><td>
<input type=text name=phrase>
</td><td align=right>
<span align=right>
<input type=submit value='<? echo _SEARCH;?>'>
</span>
</td></tr>
<tr><td colspan=2>
<input type=radio name=mode value='0' checked><? echo _ONLY_TITLE;?>
<input type=radio name=mode value='1'><? echo _TITLE_AND_HTML;?>

</td></tr></table>

</form>
</span>
</td>
</tr>
</table>

</td>
<tr>
<td width="60%" valign="top" class="contentdescription" colspan="2">
<?php if (($currentcat->image)<>'') {
$img='stories/'.$currentcat->image;
$align=$currentcat->image_position;
} else {
$img='stories/courses.jpg';
$align='right';
}

?>

<?php if (($currentcat->description)<>'') {
echo $currentcat->description;
}
?>
</td>
</tr>
<?php

if (count( $categories )) {
foreach ($categories as $cat) {
?>
<tr>
<td valign="top" width="5"><img src="<?php echo $mosConfig_live_site;?>/images/M_images/arrow.png" alt="" />&nbsp;</td><td>
<a href="<?php echo sefRelToAbs("index.php?option=com_jbook&amp;Itemid =$Itemid&amp;catid=$cat->catid"); ?>" class="category">
<?php echo $cat->title;?></a>&nbsp;<span class="small">(<?php
if ($cat->numlinks==0) echo _BOOK_ZERO;
if ($cat->numlinks==1) echo _BOOK_ONE;
if ($cat->numlinks>1) echo $cat->numlinks._BOOK_MORE;

?>)</span><br /><? echo $cat->catdesc;?></td>
</tr>
<?php
}
?>
</table>
<?php
}

// Hack by ICS : add test on catid
if ($catid<>0){
HTML_Book::displaylistraw($rows );}

?>

<?php
// Hack by ICS : add test on catid
if ($catid=0){
echo "<br>";
echo "<b><a href='javascript:history.go(-1)'>"._BACK."</a></b>";
echo "<br>";
}
?>

<?php

}


function displaylistraw( &$rows , $showcat=0) {
global $Itemid, $mosConfig_live_site,$mosConfig_absolute_path,$dat abase,$mainframe;
?>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php
$tabclass = array("sectiontableentry1", "sectiontableentry2");
$k = 0;
$j=1;

if (sizeof($rows)==0) {
echo _NO_BOOK;
} else {
foreach ($rows as $row) {
if ($row->published==0) continue;
?>
<tr class="<?php echo $tabclass[$k]; ?>">

<td align="left" valign=top>
<?php echo $j++; ?>.
</td>
<td valign=top>
<a class="category" href="<?php echo sefRelToAbs("index.php?option=com_jbook&amp;task=v iew&amp;Itemid=$Itemid&amp;catid=$row->catid&amp;id=$row->id"); ?>">
<?
$cover_s=$mosConfig_live_site."/images/jbook_cover/".$row->id."_s.jpg";
$Abscover_s=$mosConfig_absolute_path."/images/jbook_cover/".$row->id."_s.jpg";
if (!file_exists($Abscover_s)) $cover_s=$mosConfig_live_site."/components/com_jbook/images/nocover.jpg";
echo "<img id=\"covers\" src=\"$cover_s\" border=0>";
?>
</a>
</td>
<td valign=top>
<a href="<?php echo sefRelToAbs("index.php?option=com_jbook&amp;task=v iew&amp;Itemid=$Itemid&amp;catid=$row->catid&amp;id=$row->id"); ?>"><?php echo $row->title; ?></a>
<?
$database->setQuery( "SELECT a.*"
. "\nFROM #__jbauthor AS a"
. "\nLEFT JOIN #__jbbookauth AS ba ON ba.idauth = a.id"
. "\nWHERE ba.idbook=$row->id"
. "\nORDER BY a.name"
);

$authorList = $database->loadObjectList();
if ($authorList) echo _BY_AUTH." ";
foreach ($authorList as $c=>$auth) {
?>
<a href="<?php echo sefRelToAbs("index.php?option=com_jbook&amp;task=v iewAuth&amp;Itemid=$Itemid&amp;catid=$row->catid&amp;id=$auth->id"); ?>"><?php echo $auth->name; ?></a><?php if ($c!=(sizeof($authorList)-1)) echo ", ";
}
?>
<br />
<?php echo substr($row->html,0,100);
if (strlen($row->html)>100) echo _OTHER_DETAIL;

if ($showcat) echo "<br>"._CATEGORY.": ".categoryParentLI($row->catid,"index.php?option=com_jbook","catid");
?>
</td>
</tr>
<tr><td colspan=3>
<!-- Hack by ICS : delete HR
<HR> -->
</td></tr>
<?php $k = 1 - $k; ?>
</table>

<!-- Hack by ICS : add return button for search task -->
<br>
<b><a href='javascript:history.go(-1)'><?php echo _BACK?></a></b>
<br>

<?php

}



function showItem( &$currItem ,&$currentcat ) {
global $Itemid, $mosConfig_live_site,$mosConfig_absolute_path,$dat abase,$my,
$conf_link_url,$conf_link_alt;
?>



<!-- Hack by ICS : New table structure -->
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="contentpaneopen">
<tr>
<td valign="top" colspan="2">
<span class="componentheading">
<?php echo $currItem->title; ?>
</span>
<?php
$database->setQuery( "SELECT a.*"
. "\nFROM #__jbauthor AS a"
. "\nLEFT JOIN #__jbbookauth AS ba ON ba.idauth = a.id"
. "\nWHERE ba.idbook=$currItem->id"
. "\nORDER BY a.name" );

$authorList = $database->loadObjectList();
if ($authorList) echo _BY_AUTH." ";
foreach ($authorList as $c=>$auth) {
?>
<a href="<?php echo sefRelToAbs("index.php?option=com_jbook&amp;task=v iewAuth&amp;Itemid=$Itemid&amp;catid=$row->catid&amp;id=$auth->id"); ?>"><?php echo $auth->name; ?></a><?php if ($c!=(sizeof($authorList)-1)) echo ", ";
}

echo "<br>"._CATEGORY.": ".categoryParentLI($currItem->catid,"index.php?option=com_jbook","catid");
echo "<br>&nbsp;<br>";
?>

</td>
</tr>
<tr>
<td valign="top" width="180px">
<?
$cover_l=$mosConfig_live_site."/images/jbook_cover/".$currItem->id."_l.jpg";
$Abscover_l=$mosConfig_absolute_path."/images/jbook_cover/".$currItem->id."_l.jpg";
if (!file_exists($Abscover_l)) $cover_l=$mosConfig_live_site."/components/com_jbook/images/nocover.jpg";
echo "<img id=\"coverl\" src=\"$cover_l\" border=0>";
?>
</td>
<td valign="top" class="contentdescription">
<?php $database->setQuery( "SELECT * FROM #__jbeditor WHERE id=$currItem->ideditor");
$editor = $database->loadObjectList();
// hack by ICS : added strong
if ($editor) echo "<p /><strong>".strtoupper(substr(_EDITOR,0,1)).substr( _EDITOR,1)." : ".$editor[0]->name."</strong>";
if ($currItem->pag) echo "<br /><strong>"._PAGES." : ".$currItem->pag."</strong>";
if ($currItem->price) echo "<br /><strong>"._PRICE." : ".$currItem->price."</strong>" ;
if ($currItem->isbn) echo "<br /><strong>ISBN : <a href='$conf_link_url".$currItem->isbn."' alt='$conf_link_alt'>".$currItem->isbn."</a></strong>";
echo "<br>";
echo $currItem->html;
?>
</td>
</tr>

</table>
<hr>


<!-- Hack by ICS : correct table structure / new table structure -->
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td nowrap="nowrap" valign="top">
<? if ($currItem->vote) {echo _VOTE."&nbsp;:&nbsp;";}?>
</td>
<td>
<?php
// display voting
for ($i=0;$i<$currItem->vote;$i++)
echo "<img src=\"components/com_jbook/images/star.gif\">";
for ($i=$currItem->vote;$i<5;$i++)
echo "<img src=\"components/com_jbook/images/greystar.gif\">";
// Hack by ICS - lang for votes and hits
echo " - ";
if ($currItem->numvote==0) echo _VOTE_ZERO;
if ($currItem->numvote==1) echo _VOTE_ONE;
if ($currItem->numvote>1) echo $currItem->numvote._VOTE_MORE;
echo " (";
if ($currItem->hits==0) echo _HITS_ZERO;
if ($currItem->hits==1) echo _HITS_ONE;
if ($currItem->hits>1) echo $currItem->hits._HITS_MORE;
echo ")";
?>
</td>
</tr>
<tr>
<td colspan="2">
<?php

if ($my->gid>0) {
// a faire : voir si l'appel à voting est correct ?
echo voting($currItem->id,$Itemid);
?>
<div id="newoption"></div>
<script language=javascript>
function hideShow (toShow) {
elem=document.getElementById('newoption');
if (toShow == 'newComment') {
elem.innerHTML="<div id='newcomment'><form><input type='hidden' name='option' value='com_jbook' /><input type='hidden' name='Itemid' value='<? echo $Itemid; ?>' /><input type='hidden' name='id' value='<? echo $currItem->id; ?>' /><input type='hidden' name='task' value='saveComment' /><textarea name='comment' rows='5' cols='50'></textarea><br><input class='button' type='submit' value='<?php echo _SEND_COMMENT; ?>'><input type='hidden' name='pop' value='0' /><input type='hidden' name='section' value='book' /></form></div>";
}
if (toShow == 'newEmailMessage') {
elem.innerHTML="<div id='newemailmessage'><form><?php echo _YOUR_QUESTION_HERE; ?><br><textarea name='comment' rows='5' cols='50'></textarea><br><input type='checkbox' name='sendcopy' value='1'> <?php echo _SEND_COPY; ?><br><input type='hidden' name='task' value='sendMessage' /><input type='hidden' name='pop' value='0' /><input type='hidden' name='option' value='com_jbook' /><input type='hidden' name='Itemid' value='<? echo $Itemid; ?>' /><input type='hidden' name='id' value='<? echo $currItem->id; ?>' /><input type='hidden' name='section' value='book' /><input type='hidden' name='catid' value='<?php echo $_GET['catid']; ?>'><input class='button' type='submit' value='<?php echo _SEND_MESSAGE; ?>'></form></div>";
}
}
</script>
<?
}
else {
echo _NO_RATE_USER;
}
?>
</td>
</tr>
</table>




<!-- Hack by ICS : correct table structure / new table structure -->
<table width="100%">
<tr>
<td>
<?
$sql="SELECT #__jbcomment.*,#__users.name,#__users.username FROM #__jbcomment "
. "\nLEFT JOIN #__users ON #__jbcomment.userid=#__users.id"
. "\nWHERE bookid=".$currItem->id;
$database->setQuery($sql);
$database->query();
$rows = $database->loadObjectList();
HTML_Book::showComment($rows);
?>
</td>
</tr>
</table>

<br>
<b><a href='javascript:history.go(-1)'><?php echo _BACK?></a></b>
<br>

<?php




}



function showAuth( &$currItem ) {
global $Itemid, $mosConfig_live_site,$mosConfig_absolute_path,$dat abase;

?>
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="contentpaneopen">
<tr>
<td valign="top">
<span class="componentheading">
<?php
echo $currItem->name;
?>
</span>
<p />
<?
if ($currItem->html) echo $currItem->html;
?>
<!-- Hack by ICS : add br -->
<br /> <br />
</td>
</tr>
<tr>
<td valign="top" class="contentdescription">
<?
$sql="SELECT * FROM #__jbbook LEFT JOIN #__jbbookauth ON #__jbbookauth.idbook=#__jbbook.id WHERE #__jbbookauth.idauth=".$currItem->id;
$database->setQuery($sql);
$rows = $database->loadObjectList();
if ($rows) {
// hack by ICS : add class
echo "<div class=\"contentheading\">"._OTHER_BOOKS_SAME_AUTH. "</div><p />";
HTML_Book::displaylistraw( $rows ,1);
}
else {
echo "<hr>"._NO_OTHER_BOOKS_SAME_AUTH."<p />";
}
?>
</td>
</tr>
</table>
<br />
<!-- Hack by ICS : duplicate
<b>
<a href='javascript:history.go(-1)'><?php echo _BACK?></a></b>
<br /> -->

<?php
}


// Hack by ICS : add table header, correct table structure
function showComment( $rows) {
global $Itemid, $mosConfig_live_site,$mosConfig_absolute_path,$dat abase,$mainframe,$my;
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">

<?php
$tabclass = array("sectiontableentry1", "sectiontableentry2");
$k = 0;
$j=1;

if (sizeof($rows)==0) {
echo _NO_COMMENT;
}
else {
?>
<tr>
<td class="sectiontableheader">
<?php echo _COMMENT_BY ?>
</td>
<td class="sectiontableheader">
<?php echo _COMMENTS ?>
</td>
</tr>

<?php
foreach ($rows as $row) {
if (($row->published==0) AND ($my->gid!=2))continue;
?>
<tr class="<?php echo $tabclass[$k]; ?>">
<td valign=top>
<?
if ($my->gid>=2) {
$img = $row->published ? 'tick.png' : 'publish_x.png';
$status=$row->published? 0:1;
$url = "index.php?Itemid=$Itemid&id=$row->id&task=modifyComment&option=com_jbook&section=bo ok&status=$status";
?>
<a href="<?php echo $url; ?>">&nbsp;
<img src="images/<?php echo $img; ?>" border="0"></a>&nbsp;
<?
}
echo $row->name;
?>
</td>
<td valign=top>
<?php echo $row->text; ?>
</td>
</tr>
<?php $k = 1 - $k; }} ?>
</table>

<?php
}
}




function voting($id,$Itemid) {
$html .= '<form method="post" action="' . sefRelToAbs( 'index.php' ) . '">';
$img = '';
$url = @$_SERVER['REQUEST_URI'];
$url = ampReplace( $url );

$html .= '<span class="content_vote">';
$html .= '<input class="button" type="submit" name="submit_vote" value="'. _RATE_BOOK .'" />&nbsp;';
$html .= _VOTE_POOR;
$html .= '<input type="radio" alt="vote 1 star" name="user_rating" value="1" />';
$html .= '<input type="radio" alt="vote 2 star" name="user_rating" value="2" />';
$html .= '<input type="radio" alt="vote 3 star" name="user_rating" value="3" />';
$html .= '<input type="radio" alt="vote 4 star" name="user_rating" value="4" />';
$html .= '<input type="radio" alt="vote 5 star" name="user_rating" value="5" checked="checked" />';
$html .= _VOTE_BEST;
$html .= '<p>';
$html .= '<input class="button" type="button" name="show" value="'. _COMMENT_BOOK .'" onClick="javascript:hideShow (\'newComment\')">';
$html .= '<input class="button" type="button" name="show" value="'. _ASK_MORE_INFO .'" onClick="javascript:hideShow (\'newEmailMessage\')">';
$html .= '<input type="hidden" name="task" value="vote" />';
$html .= '<input type="hidden" name="pop" value="0" />';
$html .= '<input type="hidden" name="option" value="com_jbook" />';
$html .= '<input type="hidden" name="Itemid" value="'. $Itemid .'" />';
$html .= '<input type="hidden" name="id" value="'. $id .'" />';
$html .= '<input type="hidden" name="section" value="book" />';

$html .= '</span>';
$html .= '</form>';
return $html;
}


?>

hope you can help.
Jun 28 '07 #4
lolamk
3 New Member
Well, judging by that single line of PHP you gave us, Id try to remove the two '}' and see what happens.
I removed two '}' as u suggested. Now, I am getting following error:

Parse error: syntax error, unexpected $end in C:\wamp\www\Joomla_1.0.12-Stable-Full_Package\components\com_jbook\jbook.html.php on line 489

line 489 is end of scripts

Expand|Select|Wrap|Line Numbers
  1. $html .= '</span>';
  2.         $html .= '</form>';
  3.         return $html;
  4.     }
  5. ?>
<---- line 489

hope you can help
Jun 28 '07 #5
pbmods
5,821 Recognized Expert Expert
Heya, lolamk.

You're getting this error because there's a conditional somewhere that isn't closing out properly.

My recommendation is to put those '}'s back in, and then look at the line directly before the '}' that's causing the error.
Jun 28 '07 #6
Atli
5,058 Recognized Expert Expert
It is extremely hard to debug this code because of the way it was inlined into the HTML markup, a method that I think should be avoided at all cost.

It seems that the author of this code sometimes uses '<?php' and other times '<?' when using PHP code. I would change the '<?' into '<?php', as this can sometimes cause random errors, and it will by Default on recent PHP builds.

You need to find ever function, conditional and loop in the code and mark their opening and closing brackets '{..}', as this is most likely a case of either an extra bracket or a missing bracket.

If this is not the case the error you last posted would indicate that a function is being referenced but the () is missing.
Jun 28 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Phrylock | last post by:
I am having problems getting my browser to show the parse errors that I have. They worked before I swtiched global variabls to off (to maintain some security), and now I can not get anything but a...
3
by: Dany | last post by:
Hi, I have trouble to intalling xerces.I've link the librairy and the include directory but I still can't compil the xerces's samples. Thanks in advance. Dany
2
by: Dave O'Hearn | last post by:
This is a stripped down example that duplicates the problem I am having. If I do it with concrete types, I can access the set's iterator type correctly. If I make a template with generic types, I...
5
by: tony collier | last post by:
I have ..... enum day {monday, tuesday, wednesday}; myArray=5; i=(int)Enum.Parse(typeof(day), wednesday);
10
by: yawnmoth | last post by:
I have two servers that have had PHP installed on them and... <?php echo 'hello, world! ?> ....displays a parse error on server A and doesn't display anything on server B. Any ideas as to...
21
by: BWIGLEY | last post by:
Basically I've just started making a game. So far it makes an array 25 by 20 and tries to make five rooms within it. In scr_make_room() there's parse errors: 20 C:\c\Rooms\Untitled1.c parse error...
13
by: Gilles Ganault | last post by:
Hello Is there a tool on Linux/FreeBSD that can parse a PHP script to make sure there's no compile-time issues? I just noticed that I copy/pasted some code that had lines longer that can fit...
4
by: Damodhar | last post by:
Any one help me to parse the bellow xml feed please .. =========================================================== <item> <title>Green earthquake alert Japan(M=6.8) potentially affecting 4.6...
3
by: broll911 | last post by:
I am gettin a error message on this script can someone help me. I am a complete newbie on this stuff. Thanks in advance for any help you can give me. here is the error. Parse error: syntax error,...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.