PHP Parse error: syntax error, unexpected 'private'


#1

for the life of me i cant figure out what i am missing here

[php]<?php

$cwd = getcwd();

chdir( dirname(FILE) );

require ‘tfpdf/tfpdf.php’;

class FPDF extends tFPDF {}
{
private $_encoding = ‘UTF-8’;

var $angle=0;

}
public function Rotate($angle, $x=-1, $y=-1)
{
if($x==-1)
$x=$this->x;
if($y==-1)
$y=$this->y;
if($this->angle!=0)
$this->_out(‘Q’);
$this->angle=$angle;
if($angle!=0)
{
$angle*=M_PI/180;
$c=cos($angle);
$s=sin($angle);
$cx=$x*$this->k;
$cy=($this->h-$y)*$this->k;
$this->_out(sprintf(‘q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm’, $c, $s, -$s, $c, $cx, $cy, -$cx, -$cy));
}
}

/*
	Author	: Fernando Herrero
	Mail	: fherrero[at]noticiasdenavarra.com
	Program	: pdf-cmyk.php
	License	: GPL v2
	Description: Allow to use CMYK color space:
				 SetDrawColor() => Set draw color to black
				 SetDrawColor(int gray) => value in % (0 = black, 100 = white)
				 SetDrawColor(int red, int green, int blue) => 0 to 255
				 SetDrawColor(int cyan, int magenta, int yellow, int black) => values in % (0 to 100)
				 SetFillColor and SetTextColor same as SetDrawColor
	Date	   : 2004-01-22
*/
public function SetDrawColor() {
	//Set color for all stroking operations
	switch(func_num_args()) {
		case 1:
			$g = func_get_arg(0);
			$this->DrawColor = sprintf('%.3F G', $g / 100);
			break;
		case 3:
			$r = func_get_arg(0);
			$g = func_get_arg(1);
			$b = func_get_arg(2);
			$this->DrawColor = sprintf('%.3F %.3F %.3F RG', $r / 255, $g / 255, $b / 255);
			break;
		case 4:
			$c = func_get_arg(0);
			$m = func_get_arg(1);
			$y = func_get_arg(2);
			$k = func_get_arg(3);
			$this->DrawColor = sprintf('%.3F %.3F %.3F %.3F K', $c / 100, $m / 100, $y / 100, $k / 100);
			break;
		default:
			$this->DrawColor = '0 G';
	}
	if($this->page > 0)
		$this->_out($this->DrawColor);
}

public function SetFillColor() {
	//Set color for all filling operations
	switch(func_num_args()) {
		case 1:
			$g = func_get_arg(0);
			$this->FillColor = sprintf('%.3F g', $g / 100);
			break;
		case 3:
			$r = func_get_arg(0);
			$g = func_get_arg(1);
			$b = func_get_arg(2);
			$this->FillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
			break;
		case 4:
			$c = func_get_arg(0);
			$m = func_get_arg(1);
			$y = func_get_arg(2);
			$k = func_get_arg(3);
			$this->FillColor = sprintf('%.3F %.3F %.3F %.3F k', $c / 100, $m / 100, $y / 100, $k / 100);
			break;
		default:
			$this->FillColor = '0 g';
	}
	$this->ColorFlag = ($this->FillColor != $this->TextColor);
	if($this->page > 0)
		$this->_out($this->FillColor);
}

public function SetTextColor() {
	//Set color for text
	switch(func_num_args()) {
		case 1:
			$g = func_get_arg(0);
			$this->TextColor = sprintf('%.3F g', $g / 100);
			break;
		case 3:
			$r = func_get_arg(0);
			$g = func_get_arg(1);
			$b = func_get_arg(2);
			$this->TextColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
			break;
		case 4:
			$c = func_get_arg(0);
			$m = func_get_arg(1);
			$y = func_get_arg(2);
			$k = func_get_arg(3);
			$this->TextColor = sprintf('%.3F %.3F %.3F %.3F k', $c / 100, $m / 100, $y / 100, $k / 100);
			break;
		default:
			$this->TextColor = '0 g';
	}
	$this->ColorFlag = ($this->FillColor != $this->TextColor);
}

/*
 * END pdf-cmyk.php by Fernando Herrero
 */



public static function strip ($dirty=array())
{
	if (is_array($dirty))
	{
		foreach ($dirty as $key=> $dirtyValue)
			$clean[$key] = self::strip($dirtyValue);
	} else {
		$double	= substr_count($dirty, "\"") == substr_count($dirty, "\\\"");
		$single	= substr_count($dirty, "'") == substr_count($dirty, "\\'");
		$clean	= self::encodeString( ($double && $single)? stripslashes($dirty): $dirty );
	}
	return $clean;
}


public static function encode_string ($string)
{
	# create a utf32 string for comparison
	$utf32_string	= mb_convert_encoding($string, 'UTF-32', 'UTF-8');

	# convert the utf32 string back to utf8, if it matches then the passed string is utf8
	if ($string === mb_convert_encoding($utf32_string , 'UTF-8', 'UTF-32'))
	{
		return $string;
	# otherwise it's not and should be converted
	} else {
		return mb_convert_encoding($string, 'UTF-8');
	}
}

public function NbLines($w, $string)
{
	$string = self::encode_string($string);

	if ($this->FontSize < 0)
	{
		return 0;
	}

	$font_widths	= $this->CurrentFont['cw'];

	$max_width		= ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;

	$string			= str_replace("\r", '', $string);

	$string_length	= mb_strlen($string, $this->_encoding);

	if (mb_substr($string, $string_length-1, 1, $this->_encoding) === "\n")
	{
		$string = mb_substr($string, 0, $string_length-1, $this->_encoding);
	}

	$last_space		= -1;
	$char_pos		= 0;
	$j				= 0;
	$line_length	= 0;
	$line_count		= 1;

	while($char = mb_substr($string, $char_pos, 1, $this->_encoding))
	{
		list(,$char_code) = unpack('N', mb_convert_encoding($char, 'UCS-4BE', $this->_encoding));

		$char_width = isset($font_widths[$char_code])? $font_widths[$char_code]: 0;

		if($char === "\n")
		{
			$char_pos++;
			$line_count++;
			$last_space		= -1;
			$j				= $char_pos;
			$line_length	= 0;

			continue;
		}

		if($char === ' ')
		{
			$last_space = $char_pos;
		}

		$line_length += $char_width;

		if($line_length > $max_width)
		{
			if($last_space == -1)
			{
				($char_pos == $j)  &&  $char_pos++;

			} else {

				$char_pos = $last_space+1;
			}

			$last_space		= -1;
			$j				= $char_pos;
			$line_length	= 0;
			$line_count++;

			continue;
		}

		$char_pos++;
	}
	return $line_count;
}

}

require ‘FPDI-1.4/fpdi.php’;

chdir( $cwd );

[/php]


#2

Im sorry i forgot to mention the error was on

PHP Parse error: syntax error, unexpected 'private' (T_PRIVATE) in /Applications/MAMP/htdocs/squid/lib/card_pdf.php on line 12


#3

Your class is outside of it’s block,

class FPDF extends tFPDF {}
{


#4

how would i fix this?


#5

Add the code to the class and not have it out on its own.

[php]class Pie {} <- This should not be there
{
// I am not in a class
}

class Pie
{ <- This says all code in the block is part of the class
// I am in the class
} <- This say that is all for the class
[/php]

You have a couple brackets that are extra and will cause issues.


#6

So like this

[code]<?php

$cwd = getcwd();

chdir( dirname(FILE) );

require ‘tfpdf/tfpdf.php’;
{
class FPDF extends tFPDF {}

public $_encoding = 'UTF-8';

var $angle=0;

}
public function Rotate($angle, $x=-1, $y=-1)
{
if($x==-1)
$x=$this->x;
if($y==-1)
$y=$this->y;
if($this->angle!=0)
$this->_out(‘Q’);
$this->angle=$angle;
if($angle!=0)
{
$angle*=M_PI/180;
$c=cos($angle);
$s=sin($angle);
$cx=$x*$this->k;
$cy=($this->h-$y)*$this->k;
$this->_out(sprintf(‘q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm’, $c, $s, -$s, $c, $cx, $cy, -$cx, -$cy));
}
}
[/code]


#7

No. Look at my example again.


#8

Still cant get it.


#9

[php]class Person
{
// this is a class
// all code within the top and bottom bracket are a part of the class

}[/php]

[php] require ‘tfpdf/tfpdf.php’;
{ <- doesn’t belong
class FPDF extends tFPDF {} <- doesn’t belong
<- No opening bracket
public $_encoding = ‘UTF-8’;

var $angle=0;

} <- mismatched closing bracket[/php]


#10

This gives me an error:

[code]<?php

$cwd = getcwd();

chdir( dirname(FILE) );

require ‘tfpdf/tfpdf.php’;

class FPDF extends tFPDF
{
public $_encoding = ‘UTF-8’;

var $angle=0;

}
public function Rotate($angle, $x=-1, $y=-1)
{
if($x==-1)
$x=$this->x;
if($y==-1)
$y=$this->y;
if($this->angle!=0)
$this->_out(‘Q’);
$this->angle=$angle;
if($angle!=0)
{
$angle*=M_PI/180;
$c=cos($angle);
$s=sin($angle);
$cx=$x*$this->k;
$cy=($this->h-$y)*$this->k;
$this->_out(sprintf(‘q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm’, $c, $s, -$s, $c, $cx, $cy, -$cx, -$cy));
}
}[/code]

this gives me an error:

[code]<?php

$cwd = getcwd();

chdir( dirname(FILE) );

require ‘tfpdf/tfpdf.php’;

{
public $_encoding = ‘UTF-8’;

var $angle=0;

}
public function Rotate($angle, $x=-1, $y=-1)
{
if($x==-1)
$x=$this->x;
if($y==-1)
$y=$this->y;
if($this->angle!=0)
$this->_out(‘Q’);
$this->angle=$angle;
if($angle!=0)
{
$angle*=M_PI/180;
$c=cos($angle);
$s=sin($angle);
$cx=$x*$this->k;
$cy=($this->h-$y)*$this->k;
$this->_out(sprintf(‘q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm’, $c, $s, -$s, $c, $cx, $cy, -$cx, -$cy));
}
}[/code]

can you tell me like this :

replace this with this.

I am to stupid to figure this out


#11

[php]<?php

$cwd = getcwd();

chdir( dirname(FILE) );

require ‘tfpdf/tfpdf.php’;

class FPDF extends tFPDF
{
private $_encoding = ‘UTF-8’;

var $angle=0;

public function Rotate($angle, $x=-1, $y=-1)
{
	if($x==-1)
	    $x=$this->x;
	if($y==-1)
	    $y=$this->y;
	if($this->angle!=0)
	    $this->_out('Q');
	$this->angle=$angle;
	if($angle!=0)
	{
	    $angle*=M_PI/180;
	    $c=cos($angle);
	    $s=sin($angle);
	    $cx=$x*$this->k;
	    $cy=($this->h-$y)*$this->k;
	    $this->_out(sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm', $c, $s, -$s, $c, $cx, $cy, -$cx, -$cy));
	}
}


/*
	Author	: Fernando Herrero
	Mail	: fherrero[at]noticiasdenavarra.com
	Program	: pdf-cmyk.php
	License	: GPL v2
	Description: Allow to use CMYK color space:
				 SetDrawColor() => Set draw color to black
				 SetDrawColor(int gray) => value in % (0 = black, 100 = white)
				 SetDrawColor(int red, int green, int blue) => 0 to 255
				 SetDrawColor(int cyan, int magenta, int yellow, int black) => values in % (0 to 100)
				 SetFillColor and SetTextColor same as SetDrawColor
	Date	   : 2004-01-22
*/
public function SetDrawColor() {
	//Set color for all stroking operations
	switch(func_num_args()) {
		case 1:
			$g = func_get_arg(0);
			$this->DrawColor = sprintf('%.3F G', $g / 100);
			break;
		case 3:
			$r = func_get_arg(0);
			$g = func_get_arg(1);
			$b = func_get_arg(2);
			$this->DrawColor = sprintf('%.3F %.3F %.3F RG', $r / 255, $g / 255, $b / 255);
			break;
		case 4:
			$c = func_get_arg(0);
			$m = func_get_arg(1);
			$y = func_get_arg(2);
			$k = func_get_arg(3);
			$this->DrawColor = sprintf('%.3F %.3F %.3F %.3F K', $c / 100, $m / 100, $y / 100, $k / 100);
			break;
		default:
			$this->DrawColor = '0 G';
	}
	if($this->page > 0)
		$this->_out($this->DrawColor);
}

public function SetFillColor() {
	//Set color for all filling operations
	switch(func_num_args()) {
		case 1:
			$g = func_get_arg(0);
			$this->FillColor = sprintf('%.3F g', $g / 100);
			break;
		case 3:
			$r = func_get_arg(0);
			$g = func_get_arg(1);
			$b = func_get_arg(2);
			$this->FillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
			break;
		case 4:
			$c = func_get_arg(0);
			$m = func_get_arg(1);
			$y = func_get_arg(2);
			$k = func_get_arg(3);
			$this->FillColor = sprintf('%.3F %.3F %.3F %.3F k', $c / 100, $m / 100, $y / 100, $k / 100);
			break;
		default:
			$this->FillColor = '0 g';
	}
	$this->ColorFlag = ($this->FillColor != $this->TextColor);
	if($this->page > 0)
		$this->_out($this->FillColor);
}

public function SetTextColor() {
	//Set color for text
	switch(func_num_args()) {
		case 1:
			$g = func_get_arg(0);
			$this->TextColor = sprintf('%.3F g', $g / 100);
			break;
		case 3:
			$r = func_get_arg(0);
			$g = func_get_arg(1);
			$b = func_get_arg(2);
			$this->TextColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
			break;
		case 4:
			$c = func_get_arg(0);
			$m = func_get_arg(1);
			$y = func_get_arg(2);
			$k = func_get_arg(3);
			$this->TextColor = sprintf('%.3F %.3F %.3F %.3F k', $c / 100, $m / 100, $y / 100, $k / 100);
			break;
		default:
			$this->TextColor = '0 g';
	}
	$this->ColorFlag = ($this->FillColor != $this->TextColor);
}

/*
 * END pdf-cmyk.php by Fernando Herrero
 */



public static function strip ($dirty=array())
{
	if (is_array($dirty))
	{
		foreach ($dirty as $key=> $dirtyValue)
			$clean[$key] = self::strip($dirtyValue);
	} else {
		$double	= substr_count($dirty, "\"") == substr_count($dirty, "\\\"");
		$single	= substr_count($dirty, "'") == substr_count($dirty, "\\'");
		$clean	= self::encodeString( ($double && $single)? stripslashes($dirty): $dirty );
	}
	return $clean;
}


public static function encode_string ($string)
{
	# create a utf32 string for comparison
	$utf32_string	= mb_convert_encoding($string, 'UTF-32', 'UTF-8');

	# convert the utf32 string back to utf8, if it matches then the passed string is utf8
	if ($string === mb_convert_encoding($utf32_string , 'UTF-8', 'UTF-32'))
	{
		return $string;
	# otherwise it's not and should be converted
	} else {
		return mb_convert_encoding($string, 'UTF-8');
	}
}

public function NbLines($w, $string)
{
	$string = self::encode_string($string);

	if ($this->FontSize < 0)
	{
		return 0;
	}

	$font_widths	= $this->CurrentFont['cw'];

	$max_width		= ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;

	$string			= str_replace("\r", '', $string);

	$string_length	= mb_strlen($string, $this->_encoding);

	if (mb_substr($string, $string_length-1, 1, $this->_encoding) === "\n")
	{
		$string = mb_substr($string, 0, $string_length-1, $this->_encoding);
	}

	$last_space		= -1;
	$char_pos		= 0;
	$j				= 0;
	$line_length	= 0;
	$line_count		= 1;

	while($char = mb_substr($string, $char_pos, 1, $this->_encoding))
	{
		list(,$char_code) = unpack('N', mb_convert_encoding($char, 'UCS-4BE', $this->_encoding));

		$char_width = isset($font_widths[$char_code])? $font_widths[$char_code]: 0;

		if($char === "\n")
		{
			$char_pos++;
			$line_count++;
			$last_space		= -1;
			$j				= $char_pos;
			$line_length	= 0;

			continue;
		}

		if($char === ' ')
		{
			$last_space = $char_pos;
		}

		$line_length += $char_width;

		if($line_length > $max_width)
		{
			if($last_space == -1)
			{
				($char_pos == $j)  &&  $char_pos++;

			} else {

				$char_pos = $last_space+1;
			}

			$last_space		= -1;
			$j				= $char_pos;
			$line_length	= 0;
			$line_count++;

			continue;
		}

		$char_pos++;
	}
	return $line_count;
}

}

require ‘FPDI-1.4/fpdi.php’;

chdir( $cwd );
[/php]


#12

got this error

PHP Strict Standards: Declaration of FPDF::SetDrawColor() should be compatible with tFPDF::SetDrawColor($r, $g = NULL, $b = NULL) in /Applications/MAMP/htdocs/squid/lib/card_pdf.php on line 11

i forgot to say i have php 5.4

[code]<?php

  $cwd = getcwd();
  
  chdir( dirname(__FILE__) );
  
  require 'tfpdf/tfpdf.php';
  
class FPDF extends tFPDF 
{
	private $_encoding = 'UTF-8';

	var $angle=0;

	public function Rotate($angle, $x=-1, $y=-1)
	{
		if($x==-1)
		    $x=$this->x;
		if($y==-1)
		    $y=$this->y;
		if($this->angle!=0)
		    $this->_out('Q');
		$this->angle=$angle;
		if($angle!=0)
		{
		    $angle*=M_PI/180;
		    $c=cos($angle);
		    $s=sin($angle);
		    $cx=$x*$this->k;
		    $cy=($this->h-$y)*$this->k;
		    $this->_out(sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm', $c, $s, -$s, $c, $cx, $cy, -$cx, -$cy));
		}
	}[/code]

#13

Please help with this…


#14

Can’t believe no one can fix this here


#15

It is an issue with either the library or your version of PHP. Not much to do. Why are you using FPDF?


#16

but the code is fixable

private $_encoding = 'UTF-8';

I changed it to

$encoding = 'UTF-8';

and that fixed it

then i had to fix more errors that pop’d up

public function Rotate($angle, $x=-1, $y=-1)

changed it too:

Rotate($angle, $x=-1, $y=-1)

and that fixed that and so on

now i am at this error:

[code]<?php

$cwd = getcwd();

chdir( dirname(FILE) );

require ‘tfpdf/tfpdf.php’;

class FPDF extends tFPDF {}
{
$encoding = ‘UTF-8’;

$angle=0;

Rotate($angle, $x=-1, $y=-1)
{
	if($x==-1)
	    $x=$this->x;
	if($y==-1)
	    $y=$this->y;
	if($this->angle!=0)
	    $this->_out('Q');
	$this->angle=$angle;
	if($angle!=0)
	{
	    $angle*=M_PI/180;
	    $c=cos($angle);
	    $s=sin($angle);
	    $cx=$x*$this->k;
	    $cy=($this->h-$y)*$this->k;
	    $this->_out(sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm', $c, $s, -$s, $c, $cx, $cy, -$cx, -$cy));
	}
}


/*
	Author	: Fernando Herrero
	Mail	: fherrero[at]noticiasdenavarra.com
	Program	: pdf-cmyk.php
	License	: GPL v2
	Description: Allow to use CMYK color space:
				 SetDrawColor() => Set draw color to black
				 SetDrawColor(int gray) => value in % (0 = black, 100 = white)
				 SetDrawColor(int red, int green, int blue) => 0 to 255
				 SetDrawColor(int cyan, int magenta, int yellow, int black) => values in % (0 to 100)
				 SetFillColor and SetTextColor same as SetDrawColor
	Date	   : 2004-01-22
*/

function SetDrawColor() {
//Set color for all stroking operations
switch(func_num_args()) {
case 1:
$g = func_get_arg(0);
$this->DrawColor = sprintf(’%.3F G’, $g / 100);
break;
case 3:
$r = func_get_arg(0);
$g = func_get_arg(1);
$b = func_get_arg(2);
$this->DrawColor = sprintf(’%.3F %.3F %.3F RG’, $r / 255, $g / 255, $b / 255);
break;
case 4:
$c = func_get_arg(0);
$m = func_get_arg(1);
$y = func_get_arg(2);
$k = func_get_arg(3);
$this->DrawColor = sprintf(’%.3F %.3F %.3F %.3F K’, $c / 100, $m / 100, $y / 100, $k / 100);
break;
default:
$this->DrawColor = ‘0 G’;
}
if($this->page > 0)
$this->_out($this->DrawColor);
}

function SetFillColor() {
    //Set color for all filling operations
    switch(func_num_args()) {
        case 1:
            $g = func_get_arg(0);
            $this->FillColor = sprintf('%.3F g', $g / 100);
            break;
        case 3:
            $r = func_get_arg(0);
            $g = func_get_arg(1);
            $b = func_get_arg(2);
            $this->FillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
            break;
        case 4:
            $c = func_get_arg(0);
            $m = func_get_arg(1);
            $y = func_get_arg(2);
            $k = func_get_arg(3);
            $this->FillColor = sprintf('%.3F %.3F %.3F %.3F k', $c / 100, $m / 100, $y / 100, $k / 100);
            break;
        default:
            $this->FillColor = '0 g';
    }
    $this->ColorFlag = ($this->FillColor != $this->TextColor);
    if($this->page > 0)
        $this->_out($this->FillColor);
}

function SetTextColor() {
    //Set color for text
    switch(func_num_args()) {
        case 1:
            $g = func_get_arg(0);
            $this->TextColor = sprintf('%.3F g', $g / 100);
            break;
        case 3:
            $r = func_get_arg(0);
            $g = func_get_arg(1);
            $b = func_get_arg(2);
            $this->TextColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
            break;
        case 4:
            $c = func_get_arg(0);
            $m = func_get_arg(1);
            $y = func_get_arg(2);
            $k = func_get_arg(3);
            $this->TextColor = sprintf('%.3F %.3F %.3F %.3F k', $c / 100, $m / 100, $y / 100, $k / 100);
            break;
        default:
            $this->TextColor = '0 g';
    }
    $this->ColorFlag = ($this->FillColor != $this->TextColor);
}

}

/*
 * END pdf-cmyk.php by Fernando Herrero
 */



public static function strip ($dirty=array())
{
	if (is_array($dirty))
	{
		foreach ($dirty as $key=> $dirtyValue)
			$clean[$key] = self::strip($dirtyValue);
	} else {
		$double	= substr_count($dirty, "\"") == substr_count($dirty, "\\\"");
		$single	= substr_count($dirty, "'") == substr_count($dirty, "\\'");
		$clean	= self::encodeString( ($double && $single)? stripslashes($dirty): $dirty );
	}
	return $clean;
}


public static function encode_string ($string)
{
	# create a utf32 string for comparison
	$utf32_string	= mb_convert_encoding($string, 'UTF-32', 'UTF-8');

	# convert the utf32 string back to utf8, if it matches then the passed string is utf8
	if ($string === mb_convert_encoding($utf32_string , 'UTF-8', 'UTF-32'))
	{
		return $string;
	# otherwise it's not and should be converted
	} else {
		return mb_convert_encoding($string, 'UTF-8');
	}
}

public function NbLines($w, $string)
{
	$string = self::encode_string($string);

	if ($this->FontSize < 0)
	{
		return 0;
	}

	$font_widths	= $this->CurrentFont['cw'];

	$max_width		= ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;

	$string			= str_replace("\r", '', $string);

	$string_length	= mb_strlen($string, $this->_encoding);

	if (mb_substr($string, $string_length-1, 1, $this->_encoding) === "\n")
	{
		$string = mb_substr($string, 0, $string_length-1, $this->_encoding);
	}

	$last_space		= -1;
	$char_pos		= 0;
	$j				= 0;
	$line_length	= 0;
	$line_count		= 1;

	while($char = mb_substr($string, $char_pos, 1, $this->_encoding))
	{
		list(,$char_code) = unpack('N', mb_convert_encoding($char, 'UCS-4BE', $this->_encoding));

		$char_width = isset($font_widths[$char_code])? $font_widths[$char_code]: 0;

		if($char === "\n")
		{
			$char_pos++;
			$line_count++;
			$last_space		= -1;
			$j				= $char_pos;
			$line_length	= 0;

			continue;
		}

		if($char === ' ')
		{
			$last_space = $char_pos;
		}

		$line_length += $char_width;

		if($line_length > $max_width)
		{
			if($last_space == -1)
			{
				($char_pos == $j)  &&  $char_pos++;

			} else {

				$char_pos = $last_space+1;
			}

			$last_space		= -1;
			$j				= $char_pos;
			$line_length	= 0;
			$line_count++;

			continue;
		}

		$char_pos++;
	}
	return $line_count;
}

}

require ‘FPDI-1.4/fpdi.php’;

chdir( $cwd );[/code]

PHP Syntax Check: Parse error: syntax error, unexpected '{' in your code on line 17

#17

[php] class FPDF extends tFPDF {}
{[/php]

Not going to go around in circles with this. That was on page 1.


#18

I am doing what you tell me, if i am not doing it correct then your not explaining it to me correctly
Your making it seem like i am a pro and obviously since i see where the error is i should be able to fix this and this is a done issue.
But that’s not the case.


#19

I explained before, that this,

[php] class FPDF extends tFPDF {}
{[/php]

is not right, and gave examples.

[php] class FPDF extends tFPDF { /* this is your class block because of the brackets */ }
{ // this is off in it’s own little world and shouldn’t exists, because you said your class is already closed[/php]

You still haven’t said why you need FPDF