Date: 09/07/00
- Next message: Sebastian Bergmann: "Re: [phplib-dev] PHP-Kongress"
- Previous message: Alexander Aulbach: "Re: [phplib-dev] DB_Sql: queries with priorities"
- In reply to: Vilson Cristiano Gärtner: "[phplib-dev] [Fwd: **PSLib for PHP**]"
- Next in thread: Vilson Cristiano Gärtner: "Re: [phplib-dev] [Fwd: **PSLib for PHP**]"
- Reply: Vilson Cristiano Gärtner: "Re: [phplib-dev] [Fwd: **PSLib for PHP**]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, 1 Sep 2000, Vilson Cristiano Gärtner wrote:
}Sending again...
}
}Vilson
}
}-------- Original Message --------
}Subject: **PSLib for PHP**
}Date: Tue, 29 Aug 2000 16:31:46 -0300
}From: Vilson Cristiano Gärtner <vgartner <email protected>>
}Organization: UNIVATES - Centro Universitário
}To: php-dev <email protected>
}
}Hi, my name is Vilson Gartner and I work at Univates University here in
}the South of Brasil (south america).
}Attached is our PSLib, a PHP library we use to generate PostScript files
}on the fly. We'd like very much you take a look at it and tell us what
}you think, and also reccomend us what would be the best way to publish
}it.
Wow, the idea is cool!
The execution could be much better (sorry). To create a postscript
document, the object oriented way seems to be ideal.
Fine would be a method, which will send out the document without storing
it first inside of a file.
Some code excerpts of pslib.php3:
-----------------------------------------------------------
#### the name pslib.php3: Nameing convention is now .php
-----------------------------------------------------------
<?
-----------------------------------------------------------
#### better would be
<?php
-----------------------------------------------------------
function PS_begin_page($file, $page, $pagecount)
{
if (empty($file))
{
echo("<br><b>PSLib Warning:</b> Function PS_begin_page - Missing parameter: 1 (file name) <br>");
}
if (empty($page))
{
echo("<br><b>PSLib Warning:</b> Function PS_begin_page - Missing parameter: 2 (page number) <br>");
}
if (empty($pagecount))
{
echo("<br><b>PSLib Warning:</b> Function PS_begin_page - Missing parameter: 3 (pagecount) <br>");
}
if (intval($pagecount) == 0)
{
echo("<br><b>PSLib Warning:</b> Function PS_begin_page - Incorrect value: pagecount) <br>"); }
fwrite($file, "%%Page: " . $page . " " . $pagecount . "\n");
}
---------------------------------------------------------------------------
#### 4 ifs and one line of "real" code - I would write a check-function
#### for it, caus 80% of the hole code consists out of such if-statements.
#### With PHP4 some of the following code should be much easier:
function PS_begin_page($file, $page, $pagecount)
{
PS_check_fn('PS_begin_page',array($file,$page,$pagecount));
...
}
function PS_check_fn ($name,$params) {
if ($name=='PS_begin_page') {
if (empty($params[0])) {
PS_error($name,'Missing Parameter 1 (file name)');
}
if ...
...
}
function PS_error($name,$str) {
echo "<br><b>PSLib Warning:</b> Function $name - $str";
}
Could reduce code size about 50%.
----------------------------------------------------------------------------
function PS_show_xy($file, $text, $xcoord, $ycoord)
{
if ($file=='help')
{
echo("<br><b>PSLib HELP:</b> Function PS_show_xy(param1, param2,param3, par echo("param1 = ps file name to write to <br>");
echo("param2 = text to show <br>");
echo("param3 = X coordenate <br>");
echo("param4 = Y coordenate <br><br>");
return("");
}
---------------------------------------------------------------------------
#### Built in Docs... what an idea. :) Sorry, this is the wrong
#### way. Either you make documentation inside of your code
#### with inline comments, and write a program, which can get the docs out
#### of the source and make HTML, or simple text out of it or you write
#### a seperate docu.
--------------------------------------------------------------------------
if (file_exists('acentos.ps'))
{
$file_acentos = fopen('acentos.ps',"r");
--------------------------------------------------------------------------
#### you have to check if fopen returned a true value:
$fname='acentos.ps';
if (file_exists($fname))
{
$file_acentos = fopen($fname,'r') or die("Could't fopen '$fname'");
--------------------------------------------------------------------------
?>
<HTML><BODY>
</BODY></HTML>
--------------------------------------------------------------------------
#### you don't need to set any HTML-Tags inside a function-library. This
#### task should be done by your application
--------------------------------------------------------------------------
--SSilk - Alexander Aulbach - Herbipolis/Frankonia Minoris - (0931)22032
--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-dev-unsubscribe <email protected> For additional commands, e-mail: phplib-dev-help <email protected>
- Next message: Sebastian Bergmann: "Re: [phplib-dev] PHP-Kongress"
- Previous message: Alexander Aulbach: "Re: [phplib-dev] DB_Sql: queries with priorities"
- In reply to: Vilson Cristiano Gärtner: "[phplib-dev] [Fwd: **PSLib for PHP**]"
- Next in thread: Vilson Cristiano Gärtner: "Re: [phplib-dev] [Fwd: **PSLib for PHP**]"
- Reply: Vilson Cristiano Gärtner: "Re: [phplib-dev] [Fwd: **PSLib for PHP**]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

