URL Parameter in Custom File

v2021, I created custom file for printing in pdf format. Included common files disabled.
The URL is : /print/printpo.php?Purchase=3083/PO/TLI/X/2020
The parameter is taken from $_GET[‘Purchase’];
As sampled in help file it should be/print/printpo?Purchase=3083/PO/TLI/X/2020
But I get error page
404
Error
Route ‘print/printpo’ not found.

Also why is the file generated printpo.php blank? Only contents :

<? // No class file ?>

Please help. What is the correct route URL for it?

ameisfine wrote:

Included common files disabled.
Route ‘print/printpo’ not found.

You need select “include common files” so that PHPMaker will generate a route for it.

Hi, after I did “include common files” selected here is the result :

Error
Error
Error
\views\Printpo.php(20): Class ‘PHPMaker2021\Tabu_ERP_2021\exFPDF’ not found

FYI I use FPDF modules for generating pdf page by adding the folder manually into the root folder.

Always post your code for more discussion.

ameisfine wrote:

\views\Printpo.php(20): Class ‘PHPMaker2021\Tabu_ERP_2021\exFPDF’ not found
FYI I use FPDF modules for generating pdf page by adding the folder manually into the root folder.

In such case your class is not under the project namespace, “PHPMaker2021\Tabu_ERP_2021”.

If you class has a composer package, you should add the package by Tools → Composer Packages to your project instead of adding it manually.

Hi

Here is custom content of printpo.php : (I dont paste all lines)

<?php require('fpdf/fpdf.php'); require('fpdf/exfpdf.php'); require('fpdf/easyTable.php'); $con=mysqli_connect('localhost','xxxxx','xxxxx'); mysqli_select_db($con,'dbxxx'); $pdf = new exFPDF('P','mm','A4'); $pdf->AliasNbPages('{pages}'); $abc = $_GET['Purchase'];

arbei wrote:

If you class has a composer package, you should add the package by Tools → Composer Packages to your project instead of adding it manually.

You should click Tools → Composer Packages to add the package “matthew-elisha/fpdf-easytable” to your project, then you can remove:

require(‘fpdf/fpdf.php’);
require(‘fpdf/exfpdf.php’);
require(‘fpdf/easyTable.php’);

ameisfine wrote:

$pdf = new exFPDF(‘P’,‘mm’,‘A4’);

Always to remember: since PHPMaker is now using namespace, you need to add black slash before the Class. If not, then it will be recognized as outside of the namespace.

That code above should be:

$pdf = new \exFPDF(‘P’,‘mm’,‘A4’);

arbei wrote:

arbei wrote:

If you class has a composer package, you should add the package by Tools →
Composer Packages to your project instead of adding it manually.

You should click Tools → Composer Packages to add the package
“matthew-elisha/fpdf-easytable” to your project, then you can remove:



Hi Arbei,
I tried it. But seems matthew-elisha/fpdf-easytable has no package version available. Then updating composer is always getting error. Meanwhile I dont find any other developer for easytable in composer. How to add / use package without using ‘composer’ in this v2021? because it was running smooth in previous version

If updating package from composer does not work, you may try your code as usual.

mobhar wrote:

That code above should be:

$pdf = new \exFPDF(‘P’,‘mm’,‘A4’);

mobhar wrote:

If updating package from composer does not work, you may try your code as usual.

mobhar wrote:

That code above should be:

$pdf = new \exFPDF(‘P’,‘mm’,‘A4’);

That was my first try (without using composer) and resulting :

  1. Include common files disabled
    404 Error
    Route ‘print/printpo’ not found.
  2. Include common files enabled
    Error
    \views\Printpo.php(20): Class ‘PHPMaker2021\Tabu_ERP_2021\exFPDF’ not found

ameisfine wrote:

  1. Include common files disabled

You need to keep enable “Include common files”.

ameisfine wrote:

Error
\views\Printpo.php(20): Class ‘PHPMaker2021\Tabu_ERP_2021\exFPDF’ not found

Change your code to:

$pdf = new \exFPDF(‘P’,‘mm’,‘A4’);

There are black slash \ after new.

mobhar wrote:

Change your code to:

$pdf = new \exFPDF(‘P’,‘mm’,‘A4’);

There are black slash \ after new.

I have added that, still not succeed, resulting:
Printpo.php(56): Class ‘PHPMaker2021\Tabu_ERP_2021\easyTable’ not found

ameisfine wrote:

But seems matthew-elisha/fpdf-easytable has no package version available. Then updating composer is always getting error.

You may set the version as “dev-master”, see: //packagist.org/packages/matthew-elisha/fpdf-easytable.

I have updated successfully composer using mathew-elisha/fpdf-easytable dev-master
And added backslashes in my file $pdf = new \exFPDF(‘P’,‘mm’,‘A4’);Now error message: Fatal error: Class ‘FPDF’ not found in … vendor\matthew-elisha\fpdf-easytable\exfpdf.php on line 12Seems the package is good but now the problem is in the file of package which can not find the path.?
Here is line 12:
class exFPDF extends FPDF{please kindly help. Thanks

Add the FPDF package also, e.g. setasign/fpdf.

fpdf added.
all syntax $pdf = new … added /
Here is result :
%PDF-1.3 3 0 obj <> endobj 4 0 obj <> stream x��[w�6~ϯ���IOc� ^�&�h�Ȫ$��9}Qb:QcI�$w��~ .C�$I~̇?P�"��Wa���W+t�FY�h���W�B����������Ҁ0�b0�p����r�^����">�,)J� MPB� NÑ—-:�bt�G�rl��">1���Y@¿½ï¿½G�B���S�!�~�� �X&�Ψ�E��d(Ii����nq�n��F�����j��`�m�I��iO#Θ1.�$�7����(C��3�cP\�� :�i�Ľ �Є�2$[�|��� �V)�"I��RiH�� C�\iI�dJ��T��R�44*$��R�ȕ���N�-�b����u+q�u���Ɨ5סs�����e��׼|�|�0��1�E�}к�_���u{ �ݣ���C8�<���L”��o�W�翟Gav�;��h�-��M��A86����hC-…

Displaying weird characters. What’s need to be tuned up?

[quote=ameisfine post_id=156479 time=1603681469 user_id=87982]
class exFPDF extends FPDF{
[/quote]It should be:
class exFPDF extends \FPDF{

Before this line
require(‘fpdf/fpdf.php’);Try to add this code:
ob_end_clean();