php-general Digest 5 Dec 2005 14:14:44 -0000 Issue 3833

Topics (messages 226851 through 226869):

Re: PDF Generator
        226851 by: jud.bizville.com
        226855 by: Anas Mughal
        226865 by: Norbert Wenzel

Could you help me to solve this problem?
        226852 by: CHEN RAN
        226853 by: Stephen Johnson

Re: Exception
        226854 by: Anas Mughal

using curl to peform post
        226856 by: Brent Clark

Performance question
        226857 by: Anders Norrbring
        226868 by: James Benson

OpenDocument .odt to .xhtml Parser
        226858 by: Sadda Teh

R: [PHP] Performance question
        226859 by: Sebastian \"En3pY\" Zdrojewski
        226862 by: Anders Norrbring

Multiple callback_outputs for ob_start
        226860 by: Mathijs

template systems
        226861 by: Eternity Records Webmaster
        226864 by: Thomas

Re: [PHP-DEV] Zend Sudio's Optimizer / PHP 5.1.1
        226863 by: Mike Bretz

functions that take variable arguments?
        226866 by: Eternity Records Webmaster
        226867 by: Richard Heyes

Re: Count and Preg_Replace Using Version 4.4.1
        226869 by: Al

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Why not use JavaScript? It's supported well in Acrobat Professional. 

Jud. 



Original Message:
-----------------
From: Dan Harrington [EMAIL PROTECTED]
Date: Sun, 4 Dec 2005 09:12:51 -0700
To: [email protected]
Subject: [PHP] Re: PDF Generator



I have a TON of forms that I have to populate, can I make a PDF file using
Acrobat Professional, and then use PHP to populate those forms and have text
inserted into the pre-made text fields that I made using Acrobat?  And if
so, what is the best tool for that?  I'd prefer to do it for free, but
spending $$ is fine too. 

Thanks
Dan


Rick Lim wrote:

> What is the best FREE pdf generator for PHP?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .

--- End Message ---
--- Begin Message ---
I used this in the past:
http://www.ros.co.nz/pdf/

Fully self-contained.
My only frustration was that didn't support multiple tables on one row.
Maybe I was asking too much... ;)





On 12/4/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Why not use JavaScript? It's supported well in Acrobat Professional.
>
> Jud.
>
>
>
> Original Message:
> -----------------
> From: Dan Harrington [EMAIL PROTECTED]
> Date: Sun, 4 Dec 2005 09:12:51 -0700
> To: [email protected]
> Subject: [PHP] Re: PDF Generator
>
>
>
> I have a TON of forms that I have to populate, can I make a PDF file using
> Acrobat Professional, and then use PHP to populate those forms and have
> text
> inserted into the pre-made text fields that I made using Acrobat?  And if
> so, what is the best tool for that?  I'd prefer to do it for free, but
> spending $$ is fine too.
>
> Thanks
> Dan
>
>
> Rick Lim wrote:
>
> > What is the best FREE pdf generator for PHP?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --------------------------------------------------------------------
> mail2web - Check your email from the web at
> http://mail2web.com/ .
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Anas Mughal

--- End Message ---
--- Begin Message ---
Dan Harrington wrote:
I have a TON of forms that I have to populate, can I make a PDF file using
Acrobat Professional, and then use PHP to populate those forms and have text
inserted into the pre-made text fields that I made using Acrobat?  And if
so, what is the best tool for that?  I'd prefer to do it for free, but
spending $$ is fine too.
Thanks
Dan


Rick Lim wrote:


What is the best FREE pdf generator for PHP?

fpdf will only draw your documents, there is no way to use it with forms. and i don't know any way to process pdf forms in php, but i didn't really need it yet.

if you find any solutions, please post them.

--- End Message ---
--- Begin Message ---
hi,

After uploading file to web server with php upload script in http://us3.php.net/features.file-upload, I can't access the file with web browser. I get error message as "403 Forbidden" or "You are not authorized to view this page".
However, there is no such problem when i using FTP to upload files.

Please help,

Thanks a lot.

Ran

--- End Message ---
--- Begin Message ---
When you upload you also need to change the permissions on the file that you
uploaded.

chmod("/somedir/somefile", 0755)

More info : http://us3.php.net/chmod


On 12/4/05 6:35 PM, "CHEN RAN" <[EMAIL PROTECTED]> wrote:

> hi,
> 
> After uploading file to web server with php upload script in
> http://us3.php.net/features.file-upload, I can't access the file with web
> browser. I get error message as "403 Forbidden" or "You are not authorized
> to view this page".
> However, there is no such problem when i using FTP to upload files.
> 
> Please help,
> 
> Thanks a lot.
> 
> Ran

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

--- End Message ---
--- Begin Message ---
I don't know about PHP, however, in other languages, exception throwing and
catching is expensive.

As Curt put it, exception handling should be reserved for truly exceptional
cases:
- DB connection failure
- SOA connectivity failure

General errors like the user not completing a form, should be handled as
regular error conditions.

Hope this helps.



On 12/4/05, Christian Herrnbock <[EMAIL PROTECTED]> wrote:
>
> mr php wrote:
>
> > Hello
> > Is it good to use exception handling for error handling or I should use
> > only for exceptions?
> > For example:
> > Is it good to throwing user input errors with throw new Exception().
> > Thanks
>
> Hello,
>
> I would also go by keeping them separate; it helps both in logic-flow, and
> maintenence. Not to mention, exception handlers are design to do just that
> - handle exceptions.
>
>
> Regards,
> Christian
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Anas Mughal

--- End Message ---
--- Begin Message ---
Hi all

I have need to simulate the role of a web browser by submitting the following 
code.

<form name="form1" action="propsearch.pl" method="post">
<textarea rows="12" cols="70" name="msg">GREENc</textarea>
<input type="submit" value="Submit">
</form>

Heres my PHP code that got from the curl function.

<?php

$url = "www.example.com";
$page = "/cgi-bin/ecco/scripts/h2h/glo/propsearch.pl";

$post_string = "msg=GREE01";

$header = "POST ".$page." HTTP/1.0 ";
$header .= "MIME-Version: 1.0 ";
$header .= "Content-type: application/PTI26 ";
$header .= "Content-length: ".strlen($post_string)." ";
$header .= "Content-transfer-encoding: text ";
$header .= "Request-number: 1 ";
$header .= "Document-type: Request ";
$header .= "Interface-Version: Test 1.4 ";
$header .= "Connection: close ";
$header .= $post_string;

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);

$data = curl_exec($ch); if (curl_errno($ch)) {
print curl_error($ch);
} else {
curl_close($ch);
}

print $data;
?>

Any assistant would gratefully be appreciated.

Kind Regards
Brent Clark

--- End Message ---
--- Begin Message ---

I've been spending some time to find performance pros and cons, but so far haven't had any real luck.

Can someone on this list say which is better than the other, and also why, when it comes to these kinds of syntax:

1.
php code
?>
<html statements><?= $variable ?></end tag>
<tag><?= $var2 ?></end tag>
<?
more php code

2.
php code
echo "<tag>$variable</end tag>";
echo "<tag>$var2</end tag>";
more php code

In both cases, some processing is done, not that 'echo' uses a lot of cpu time, but still... On the other hand, there are more jumps in and out for the interpreter in the first example...

I'd love some thoughts on this.
--

Anders Norrbring
Norrbring Consulting

--- End Message ---
--- Begin Message --- I dont think either will give a performance decrease any less than the other will do.





Anders Norrbring wrote:

I've been spending some time to find performance pros and cons, but so far haven't had any real luck.

Can someone on this list say which is better than the other, and also why, when it comes to these kinds of syntax:

1.
php code
?>
<html statements><?= $variable ?></end tag>
<tag><?= $var2 ?></end tag>
<?
more php code

2.
php code
echo "<tag>$variable</end tag>";
echo "<tag>$var2</end tag>";
more php code

In both cases, some processing is done, not that 'echo' uses a lot of cpu time, but still... On the other hand, there are more jumps in and out for the interpreter in the first example...

I'd love some thoughts on this.

--- End Message ---
--- Begin Message ---
With the release of OpenOffice.org 2 came the ability to export .odt to
.xhtml. As most probably know, the OOo .odt native file format is basically
gzipped XML. Also OOo comes with .xsl files which are used to transform the
.odt file to .xhtml files when they are exported.

Does anyone know of any projects being worked on which use the OOo .xsl XSLT
files to transform .odt files to .xhtml files? The type of code I'm
specifically looking for would be an API written in PHP 5 that can basically
take any .odt file and spit out a .xhtml file using the .xsl files that ship
with OOo (can be found in share\xslt\export\xhtml in the root install dir on
a Windows install, not sure about Linux).

Does anyone know if any code is out there to do this, or if any projects
exist to address this need. I've done a little Google research on this
topic, but haven't found much, so I figured someone on this list might know
where to point me for more info, or can point me to people who are working
on this. If no one is doing something like this is anyone interested in
working on the with me? Thanks for any replies.

I'm not an XML whiz, and frankly don't want to be one, so I'm hoping there
is some code out there that already addresses this.

--- End Message ---
--- Begin Message ---
Hi,

I do prefer the first style programming after longer time in programming
PHP. I like the idea of keeping HTML and PHP code separate for cosmetic
purpose as well as mantainance. Actually a code with PHP only, I mean really
with NO HTML code in it, is more portable and easy to mantain. As for
performance I don't know, but a difference is present for sure. Actually I
never benchmarked the performance of the two styles, but wanted to give my
10 cents for the coding style :)

Cheers

En3pY


Sebastian Konstanty Zdrojewski 

________________________________

URL: http://www.en3py.net/
E-Mail: [EMAIL PROTECTED]

________________________________

Le informazioni contenute in questo messaggio sono riservate e
confidenziali. Il loro utilizzo è consentito esclusivamente al destinatario
del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei
non fosse la persona a cui il presente messaggio è destinato, La invito ad
eliminarlo dal Suo Sistema ed a distruggere le varie copie o stampe, dandone
gentilmente comunicazione. Ogni utilizzo improprio è contrario ai principi
del D.lgs 196/03 e alla legislazione Europea (Direttiva 2002/58/CE). 

-----Messaggio originale-----
Da: Anders Norrbring [mailto:[EMAIL PROTECTED] 
Inviato: lunedì 5 dicembre 2005 8.27
A: PHP General
Oggetto: [PHP] Performance question


I've been spending some time to find performance pros and cons, but so far
haven't had any real luck.

Can someone on this list say which is better than the other, and also why,
when it comes to these kinds of syntax:

1.
php code
?>
<html statements><?= $variable ?></end tag> <tag><?= $var2 ?></end tag> <?
more php code

2.
php code
echo "<tag>$variable</end tag>";
echo "<tag>$var2</end tag>";
more php code

In both cases, some processing is done, not that 'echo' uses a lot of cpu
time, but still...
On the other hand, there are more jumps in and out for the interpreter in
the first example...

I'd love some thoughts on this.
-- 

Anders Norrbring
Norrbring Consulting

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.11/191 - Release Date: 02/12/2005
 

Attachment: smime.p7s
Description: S/MIME cryptographic signature


--- End Message ---
--- Begin Message ---
On 2005-12-05 09:05 Sebastian "En3pY" Zdrojewski wrote:
Hi,

I do prefer the first style programming after longer time in programming
PHP. I like the idea of keeping HTML and PHP code separate for cosmetic
purpose as well as mantainance. Actually a code with PHP only, I mean really
with NO HTML code in it, is more portable and easy to mantain. As for
performance I don't know, but a difference is present for sure. Actually I
never benchmarked the performance of the two styles, but wanted to give my
10 cents for the coding style :)

Cheers

En3pY


Yep, I like it too, for the same "cosmetic" reasons.. But now I've become involved in a project where extreme performance is a key issue, so of course I'd like to have some input on the situation...

Anders.





Sebastian Konstanty Zdrojewski
________________________________

URL: http://www.en3py.net/
E-Mail: [EMAIL PROTECTED]

________________________________

Le informazioni contenute in questo messaggio sono riservate e
confidenziali. Il loro utilizzo è consentito esclusivamente al destinatario
del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei
non fosse la persona a cui il presente messaggio è destinato, La invito ad
eliminarlo dal Suo Sistema ed a distruggere le varie copie o stampe, dandone
gentilmente comunicazione. Ogni utilizzo improprio è contrario ai principi
del D.lgs 196/03 e alla legislazione Europea (Direttiva 2002/58/CE).
-----Messaggio originale-----
Da: Anders Norrbring [mailto:[EMAIL PROTECTED] Inviato: lunedì 5 dicembre 2005 8.27
A: PHP General
Oggetto: [PHP] Performance question


I've been spending some time to find performance pros and cons, but so far
haven't had any real luck.

Can someone on this list say which is better than the other, and also why,
when it comes to these kinds of syntax:

1.
php code
?>
<html statements><?= $variable ?></end tag> <tag><?= $var2 ?></end tag> <?
more php code

2.
php code
echo "<tag>$variable</end tag>";
echo "<tag>$var2</end tag>";
more php code

In both cases, some processing is done, not that 'echo' uses a lot of cpu
time, but still...
On the other hand, there are more jumps in and out for the interpreter in
the first example...

I'd love some thoughts on this.


--

Anders Norrbring
Norrbring Consulting

--- End Message ---
--- Begin Message ---
Hello ppl,

I Have a question about ob_start().

How can i add more callback_outputs to ob_start?

I want to have both: ob_start('switchContent');
and: ob_start('ob_gzhandler');

How can i do that?

Thx in advanced.

--- End Message ---
--- Begin Message ---
Hi...

I was wondering if there are any template systems out there that are fairly
easy to use (that don't require hours and hours reading books) and that are
fairly good as well? I need one also that works with pear packages since I
use html_quickform a lot. I considered checking out smarty but wasnt for
sure if that one would be the best.

--- End Message ---
--- Begin Message ---
Hi,

Templating systems are really a matter of taste. You have a few options,
depending also on the paradigm you want to use (Model2, MVC ... maybe read
up on that as that is good general knowledge).

Also, please check the archives as this question has already been discussed
at length ;-)

Anyway, I will give my 5c worth, when I say that I have gotten to like
HTML_Template_Flexy (a pear package) quite a lot. This paradigm forces you
to do almost all of your logic stuff on the php side, whilst nicely
separating html and php code (you can really end up with some pretty
straight forward html pages, with a little Flexy code - cool things is also
that you can use Flexy code inline (as in <p flexy:if=""></p>) makes for
neat code!)

Another plus for Flexy is that it is not bloated like Smarty. Fair enough,
Smarty is pretty cool, but it just gives you too many ropes to hang yourself
with.

Not sure how easy integration with Quickform is ... should not be a problem
as most things happen on the code side anyway.

Hope that helps. 

-----Original Message-----
From: Eternity Records Webmaster [mailto:[EMAIL PROTECTED] 
Sent: 05 December 2005 11:00 AM
To: [email protected]
Subject: [PHP] template systems

Hi...

I was wondering if there are any template systems out there that are fairly
easy to use (that don't require hours and hours reading books) and that are
fairly good as well? I need one also that works with pear packages since I
use html_quickform a lot. I considered checking out smarty but wasnt for
sure if that one would be the best.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message --- ZendOptimizer will be available for PHP5.1 within "a few weeks" - that's what you get from zend support.

mike


Joseph Crawford wrote:

i keep getting an error that zend optimizer doesnt work with this version of
PHP, can anyone explain why that would be?
i have gone into zend studio and went to /lib/Optimizer-2.5.13/ created the
php-5.1.x dir and copied the ZendOptimizer.dll from the php-5.0.x directory
but it still complains ;( is there something else i need to change in zend
studio server?

Thanks,
--
Joseph Crawford Jr.
Zend Certified Engineer
Codebowl Solutions, Inc.
1-802-671-2021
[EMAIL PROTECTED]


--
mike peter bretz                        metropolis ag / entwicklung
email:  [EMAIL PROTECTED]        heinestraße 72
phone:  +49-7121-348-120                d-72762 reutlingen
fax:    +49-7121-348-111                http://www.metropolis-ag.de/

metropolis ag. creating social internetworks.

--- End Message ---
--- Begin Message ---
how do you create/use a function that takes an undefined amount of
arguments? I looked at the manual but its a little confusing. for example, i
want to make a function called Update inside a DB class:

class DB {
//vars here
var $host;
var $DbUser;

//functions
function Update(...) {
//this function can take as few as 1 argument or as many as php will allow
//its supposed to update a database with the new values of the arguments.
//any help getting started on creating a function like this would be
apreciated
}
//end class
}

thanks

--- End Message ---
--- Begin Message ---
Eternity Records Webmaster wrote:
how do you create/use a function that takes an undefined amount of
arguments? I looked at the manual but its a little confusing. for example, i
want to make a function called Update inside a DB class:

class DB {
//vars here
var $host;
var $DbUser;

//functions
function Update(...) {
//this function can take as few as 1 argument or as many as php will allow
//its supposed to update a database with the new values of the arguments.
//any help getting started on creating a function like this would be
apreciated
}
//end class
}


class DB
{
    function Update()
    {
        $args = func_get_args();
    }
}

$args will then be a regular array of any/all the arguments passed to the function.

--
Richard Heyes
http://www.phpguru.org/

--- End Message ---
--- Begin Message ---
Shaun wrote:
Hi,

The following code matches all occurences of <p> tags within an html page and wraps form tags around it:

echo preg_replace(
    '/<p[^>]*>(.*?)<\/p>/ms',
'<form name="form" target="_parent" action="'.$CFG->edit_pages_adm.'/index.php?action=edit_paragraph" method="post">
      <input type="hidden" name="text" value="$1">
      <p><a href="javascript:;" onclick="document.form.submit();">$1</a></p>
     </form>',
    file_get_contents($CFG->frontenddir_editable.'/'.$file) );

Unfortunately if there is more than one match the form won't submit because the forms have the same name. Does anyone know how can I modify this so that each occurence is numbered sequentially i.e.

form'.$count.'...

As I am using version 4.4.1 I don't have access to the count paramter in version 5.1.

Thanks for your advice


Each of your html input elements must have a different name, otherwise the php 
code will only see the last one.

Consider a simple foreach loop to generate your html input elements, e.g.,

        $report= ""; $i= 0;
        
        foreach($array as $key=> $value){    
                        
                $report .= "<p><input type=\"text\" name=\"input$i\" 
value=\"\"></P>";

                other stuff as needed
                
                $i++;
        }//end

        echo $report;

I'm not sure I see why you need the JAVA script. Seems like you can let the user poke in everything and then provide a submit button to post everything.

Your $_POST will contain all the results.  e.g.,
$value1= $_POST['input1'];
$value2= $_POST['input2'];

etc.

Another simple foreach loop can be used to extract the input values.

--- End Message ---

Reply via email to