pdf page number control code

current page =15 , total page=15 as a result of the formule above, output must be TRUE , but we got FALSE

sorun.JPG

In your IF statement, you are comparing two strings that ‘look like’ numbers. I would try casting them to integers to make sure and get rid of any problems related to character sets.

$current_page=(int)$current_page

Nick

Hi Nick,
Firstly many thanks , I have made the rotation that you said.

“$toltal_page=(int)$toltal_page” After this formula “0” value is coming so I could not find any solution.
It is really interesting that on the formula line, “$current_page” value is always seen as “0” but when it is written in the provision on the page it returns its normal value.

There is any problem in the rotation of “$current_page=(int)$current_page”

Tayfun

Tayfun,

I think you should look at the code that Script Case is generating. I have seen at least one place where I wrote something like $x=$x; and Script Case generated something like $this->x=$x;

Or, if you copy the code to this message, I will take a look at what gets generated.

Nick

Nick ,

I couldn’t find anything. scriptcase project and database (Mysql) file is attached.
Thanks.

Tayfun

http://rapidshare.com/files/2099490590/code.rar

Nick ,

I couldn’t find anything. scriptcase project and database (Mysql) file is attached.

Thanks.

Tayfun

http://rapidshare.com/files/2099490590/code.rar

Tayfun,

I don’t want to try importing your whole project into my system, but it looks like a bug in Scriptcase.

Here is the generated code that I found in what you sent me:

$page_number = $this->PageNo().’/ {nb}’;
$x=explode("/",$page_number);

$current_page=trim($x[0]);
$toltal_page=trim($x[1]);

$this->Text(1,6,$current_page);
$this->Text(1,9,$toltal_page);
$this->Text(40,9,$current_page."/".$toltal_page);

if ($current_page==’$toltal_page’ ){
$this->Text(20,6,“TRUE”);
$this->Text(20,9,$current_page);
$this->Text(20,12,$toltal_page);
}else{
$this->Text(20,6,“FALSE”);
$this->Text(20,9,$current_page);
$this->Text(20,12,$toltal_page);
}
}

Please note that in the IF statement, $toltal_page has single quotes around it. So you are comparing a number to a string… :frowning:

When you output the values with $this->Text(20,12,$toltal_page);, the single quotes are gone. So you will see the correct value instead of the string.

Nick

I’m sorry I answered late. Thanks :wink: