Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Syntax error - prośba o pomoc
Forum PHP.pl > Forum > Przedszkole
smolam
Witam

przy probie wrzucenia kodu Google analytics na stronę coś nagrzebałem i teraz mam problem.
Usunąłem wszystkie swoje zmiany ale nadal pojawia się błąd :

Parse error: syntax error, unexpected '=' in /home/iturystyka/ftp/main/templates/mice_1/index.php on line 90

nie mogę znaleźć przyczyny, proszę o pomoc.
przy okazji może wie ktoś jak sprawić by GA działało na php ?
kod wadliwego pliku :
  1. <?php
  2. /**
  3. * @version $Id: index.php 11407 2009-01-09 17:23:42Z willebil $
  4. * @package Joomla
  5. * @copyright Copyright (C) 2005 - 2009 Open Source Matters. All rights reserved.
  6. * @license GNU/GPL, see LICENSE.php
  7. * Joomla! is free software. This version may have been modified pursuant
  8. * to the GNU General Public License, and as distributed it includes or
  9. * is derivative of works licensed under the GNU General Public License or
  10. * other free or open source software licenses.
  11. * See COPYRIGHT.php for copyright notices and details.
  12. */
  13.  
  14.  
  15. // Set flag that this is a parent file
  16. define( '_JEXEC', 1 );
  17.  
  18. define('JPATH_BASE', dirname(__FILE__) );
  19.  
  20. define( 'DS', DIRECTORY_SEPARATOR );
  21.  
  22. require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
  23. require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
  24.  
  25. JDEBUG ? $_PROFILER->mark( 'afterLoad' ) : null;
  26.  
  27. /**
  28.  * CREATE THE APPLICATION
  29.  *
  30.  * NOTE :
  31.  */
  32. $mainframe =& JFactory::getApplication('site');
  33.  
  34. /**
  35.  * INITIALISE THE APPLICATION
  36.  *
  37.  * NOTE :
  38.  */
  39. // set the language
  40. $mainframe->initialise();
  41.  
  42. JPluginHelper::importPlugin('system');
  43.  
  44. // trigger the onAfterInitialise events
  45. JDEBUG ? $_PROFILER->mark('afterInitialise') : null;
  46. $mainframe->triggerEvent('onAfterInitialise');
  47.  
  48. /**
  49.  * ROUTE THE APPLICATION
  50.  *
  51.  * NOTE :
  52.  */
  53. $mainframe->route();
  54.  
  55. // authorization
  56. $Itemid = JRequest::getInt( 'Itemid');
  57. $mainframe->authorize($Itemid);
  58.  
  59. // trigger the onAfterRoute events
  60. JDEBUG ? $_PROFILER->mark('afterRoute') : null;
  61. $mainframe->triggerEvent('onAfterRoute');
  62.  
  63. /**
  64.  * DISPATCH THE APPLICATION
  65.  *
  66.  * NOTE :
  67.  */
  68. $option = JRequest::getCmd('option');
  69. $mainframe->dispatch($option);
  70.  
  71. // trigger the onAfterDispatch events
  72. JDEBUG ? $_PROFILER->mark('afterDispatch') : null;
  73. $mainframe->triggerEvent('onAfterDispatch');
  74.  
  75. /**
  76.  * RENDER THE APPLICATION
  77.  *
  78.  * NOTE :
  79.  */
  80. $mainframe->render();
  81.  
  82. // trigger the onAfterRender events
  83. JDEBUG ? $_PROFILER->mark('afterRender') : null;
  84. $mainframe->triggerEvent('onAfterRender');
  85.  
  86. /**
  87.  * RETURN THE RESPONSE
  88.  */
  89. echo JResponse::toString($mainframe->getCfg('gzip'));
  90. lowScriptAccess="always" loop="false" hspace="0" vspace="0"></embed>
  91. </object>
  92.  
  93. </center>
  94.  
  95. <table cellpadding="0" cellspacing="0" align="center">
  96. <tr>
  97. <td width="1000" align="right">
  98.  
  99. <table cellpadding="0" cellspacing="0" align="right">
  100. <tr>
  101. <td>
  102. <?php mosLoadModules ( 'user1' ); ?>
  103. </td>
  104. </tr>
  105. </table>
  106.  
  107. </td>
  108. </tr>
  109. </table>
  110.  
  111. <div style="position: absolute; width: 100%; top: 0px; left: 0px;">
  112.  
  113.  
  114.  
  115. <table cellpadding="0" cellspacing="0" width="980" border="0" align="center">
  116.  
  117. <tr>
  118. <td colspan="2" align="right" class="padd">
  119. <?php mosLoadModules ( 'top' ); ?>
  120. </td>
  121. </tr>
  122.  
  123. <tr>
  124. <td width="470">
  125.  
  126. <table cellpadding="0" cellspacing="0" width="100%" border="0" align="left">
  127. <tr><td height="160"></td></tr>
  128. <tr><td valign="top" align="left"><?php mosLoadModules ( 'user2' ); ?></td></tr>
  129. </table>
  130.  
  131. </td>
  132.  
  133. <td valign="top" align="left" style="padding-top: 15px;">
  134. <div style="overflow: auto; width: 510px; height: 370px; align: left;">
  135.  
  136. <?php mosMainBody(); ?>
  137.  
  138. </div>
  139. </td>
  140. </tr>
  141.  
  142. </table>
  143.  
  144.  
  145. </div>
  146.  
  147. </body>
  148.  
  149. </html>

askone
Hej

Twój błąd spowodowany jest umieszczeniem czystego kodu HTML bezpośrednio w bloku PHP. W linii 89 wywołujesz metodę:
  1. JResponse::toString($mainframe->getCfg('gzip'));
Tutaj jeszcze wszystko jest ok, ale już linię dalej - czyli właśnie 90 - dajesz czysty kod HTML... Aby usunąć błąd musisz zamknąć blok kodu PHP przed przejściem w tryb HTML.
  1. <?php
  2. ...
  3. ...
  4. echo JResponse::toString($mainframe->getCfg('gzip'));
  5. ?>
  6. <table cellpadding="0" cellspacing="0" align="center">


Pozdrawiam

Cytat(smolam @ 15.10.2010, 12:27:10 ) *
Parse error: syntax error, unexpected '=' in /home/iturystyka/ftp/main/templates/mice_1/index.php on line 90

  1. /**
  2.  * RENDER THE APPLICATION
  3.  *
  4.  * NOTE :
  5.  */
  6. $mainframe->render();
  7.  
  8. // trigger the onAfterRender events
  9. JDEBUG ? $_PROFILER->mark('afterRender') : null;
  10. $mainframe->triggerEvent('onAfterRender');
  11.  
  12. /**
  13.  * RETURN THE RESPONSE
  14.  */
  15. echo JResponse::toString($mainframe->getCfg('gzip'));
  16. lowScriptAccess="always" loop="false" hspace="0" vspace="0"></embed>
  17. </object>
  18.  
  19. </center>
  20.  
  21. <table cellpadding="0" cellspacing="0" align="center">
smolam
Dzieki za odpowiedz, mógłbyś wstawić ten znacznik dokładnie tam gdzie powinien być ? wstawiałem w rożnych miejscach i nie przyniosło to efektu. Na php nie znam się zupełnie. miedzy innymi wstawiłem tak :
  1. * RETURN THE RESPONSE
  2. */
  3. echo JResponse::toString($mainframe->getCfg('gzip'));
  4. ?>
  5. lowScriptAccess="always" loop="false" hspace="0" vspace="0"></embed>
  6. </object>
  7.  
  8. </center>
  9.  
  10. <table cellpadding="0" cellspacing="0" align="center">
  11. <tr>



ale bez efektu
askone
Ale czy po wstawieniu w tym miejscu nadal masz SYNTAX ERROR? Tego typu błędu już nie powinno być. Ciekawi mnie czy przypadkiem nie wyciąłeś jakiejś większej części kodu bo fragment:

  1. lowScriptAccess="always" loop="false" hspace="0" vspace="0"></embed>


wygląda na wybrakowany. Zwróć uwagę, iż zamykany jest znacznik "</embed>" ale nigdzie nie jest on otwierany? Przynajmniej nigdzie jawnie...
batman
1. Łączenie stringów to jedna z podstawowych czynności, jaką wykonuje się w PHP.
2. Forum nie parser. Zainstaluj dowolne IDE z kolorowaniem składni, a od razu zauważysz, gdzie masz błąd.

W związku z powyższym zamykam.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.