I was replacing some code in order to let my forum allow a new tab/window to be opened when clicking a link. I followed what they told me, but now I get this:

Parse error: syntax error, unexpected $end in /home/content/s/o/d/sodakracing/html/forum/includes/functions_content.php on line 1354

Here's the full page of code:

http://www.sodakracing.com/stuff/parse_error.txt

Please help? TIA!

    Sure is a long phpBB3 file: functions_content.php
    1353 lines.

    To give us some hint, can you tell in what part, what lines, you have made changes?
    Because I assume a phpBB3 file to be correct out-of-the-box.
    You have probably tried to make some MODIFICATIONS.

    <?php
    /**
    *
    * @package phpBB3
    * @version $Id: functions_content.php 10039 2009-08-21 09:44:55Z bantu $
    */

      I was to change this:

      $html    = "$whitespace<!-- $tag --><a$class href=\"$url\">$text</a><!-- $tag -->$append";

      to

      if ($type == MAGIC_URL_EMAIL)
          {
              $html    = "$whitespace<!-- $tag --><a$class href=\"$url\">$text</a><!-- $tag -->$append";    
      } else { $html = "$whitespace<!-- $tag --><a$class href=\"$url\" onclick=\"window.open(this.href);return false;\">$text</a><!-- $tag -->$append"; }

      which was somewhere around line 592.

        thanks
        I will have a look at that part.
        Be back 🙂

          The function you make this changes in
          has a missing closing tag,
          }
          before next function

          So, add the last
          }
          in the end of this code, Line 630 something

          /**
          * A subroutine of make_clickable used with preg_replace
          * It places correct HTML around an url, shortens the displayed text
          * and makes sure no entities are inside URLs
          */
          function make_clickable_callback($type, $whitespace, $url, $relative_url, $class)
          {
          //
          // ----- //
          
          $url	= htmlspecialchars($url);
          $text	= htmlspecialchars($text);
          $append	= htmlspecialchars($append);
          
          $html    = "$whitespace<!-- $tag --><a$class href=\"$url\">$text</a><!-- $tag -->$append";  
          
          } // add this in Line 630 or 631
          
          /**
          * make_clickable function
          *
          * Replace magic urls of form http://xxx.xxx., www.xxx. and xxx@xxx.xxx.
          * Cuts down displayed size of link if over 50 chars, turns absolute links
          * into relative versions when the server/script path matches the link
          */
          function make_clickable($text, $server_url = false, $class = 'postlink')

          Still I do not understand how that function works.
          Because it DOES NOT RETURN anything. At the end
          So in my opionion it will be useless!

            The original function
            returns $html;

            So, you should add not only the } tag
            but this:

            	$html	= "$whitespace<!-- $tag --><a$class href=\"$url\">$text</a><!-- $tag -->$append";
            
            return $html;  // the return, result of this function
            
            }     // around Line 630-632
            
              Write a Reply...