php-windows Digest 16 Jan 2005 02:02:25 -0000 Issue 2536

Topics (messages 25333 through 25342):

Re: HTML in PHP to a File
        25333 by: MikeA

Re: Insert range in Excel
        25334 by: Sven Schnitzke

Re: The Test.php program does not execute
        25335 by: egeorge.gedochin.com
        25337 by: egeorge.gedochin.com
        25338 by: egeorge.gedochin.com
        25339 by: egeorge.gedochin.com

Re: [PHP] php editor
        25336 by: Zu3Bi
        25341 by: Sven Schnitzke

PHP / HTML Editor
        25340 by: Hassan Shaikh

Re: Call ActiveX component
        25342 by: Shrock, Court

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 ---
Thanks.  I will try the eval.  Appreciate the help.!

Mike

"Jason Barnett" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
*Warning* I don't really suggest that you use eval() unless absolutely
necessary.  But in this case it does what I *think* you want it to do.
http://www.php.net/manual/en/function.eval.php

Luis Moreira wrote:
> What do you mean by "it doesn't work" ?
> It does (the minitest, I mean).
>
> Luis
>
> MikeA wrote:
>
>> I have a PHP file that outputs HTML to the Internet to a user.  The
>> user also wants to be able to
>> print that output to a printer.  The user wants it formatted with page
>> breaks in the proper place
>> and so on.  Using one PHP script to do both, short of a line to
>> display and a line to print, is
>> there a way to do this easily or am I in a pond of alligators?  Most
>> of the output is using an echo
>> statement.  I thought of trying to take a var and set it top echo or
>> write according to what is
>> needed at that time.  Here is my minitest.
>>
>> <?php
>> echo "<P>The test is starting";
>>
>> $echowrite = "echo ";
>>
>> $echowrite."<P>This is the first line.";

eval ($echowrite);

>>
>> echo "<P>You should have seen the first line by now.";
>>
>> ?>


-- 
Teach a person to fish...

Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://www.php.net/manual/en/index.php
php-general archives: http://marc.theaimsgroup.com/?l=php-general&w=2

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

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

sorry, no way (at least, directly). This is because PHP COM does not support
"multi dimensional variant arrays". These are req'd for passing range value 
lists.
(Maybe you want to drop a request to the devlist?)

But as transfer one by one is hilariously slow, you could go one of four ways:

a) transfer as CSV file and import via COM

b) if a row of the range is less than 32k chars in text representation, you may 
use 
    the expansion feature: convert it to tab separated text, stuff it into the 
first cell and 
    expand it, like so:

// You might want to load the appropriate type library if you have to use
// excel constants on the interface. Do that by setting value
// com.autoregister_typelib = true directly in PHP.INI file
// As of PHP-4.3.2:
// ini_set('com.autoregister_typelib', true);  does NOT work !!
// if you use register_typelib() you will get orphaned excel instances hanging 
around!
$excel = new COM('Excel.Application') or die('Unable to load Excel');

// this is because we want by all means try to get rid of the excel instance we 
were using,
// even if the script dies for any reason:
//  (function shutdown() releases the COM objects, closes and releases Excel)
register_shutdown_function('shutdown'); 

print "Loaded Excel version {$excel->Version}\n";

// Open (Add new) Workbook...
$excel->Workbooks->Open('existing_xls-file') or $excel->Workbooks->Add();

if($excel->Application->WorkBooks->Count() == 1) {
        // if not absolutely necessary we cut recalculation for speed
        // xlCalculationManual is a symbol that needs the typelib !
        $excel->Application->Calculation = xlCalculationManual;
        // crucical: suppress user interaction and error dialogs! Excel itself 
doesn't show up anyway if not forced.
        $excel->Application->DisplayAlerts = False;

        // grab the first workbook in list (the only one here)
        $wb = $excel->Workbooks(1);
        // Also possible to get a Workbook by name:
        // $wb = $excel->Workbooks('Mappe1.xls');
        // optional: create new sheet to put data in (will result in an error 
if WB already has Sheet4)
        $wb->Worksheets->Add->Name = 'Sheet4';
        // select sheet to put data in
        $ws = $wb->Worksheets('Sheet4');
        // here you usually test for $ws being an object to assure you get 
sthing useful        

        $num_cols = YOUR_COLUMN_COUNT;
        $ num_rows = YOUR_ROW_COUNT;
        // Column headers, not very imaginative ...
        for($col = 1; $col <= $num_cols; $col++) { $c = $ws->Cells(1, $col); 
$c->Value = 'Column '. $col; };
        // ... content, neither
        for ($row = 2; $row <= $num_rows+1; $row++) {
                // caveat: transferring as text a line at a time compared to
                // single cell transfer is roghly as many times faster as you 
have columns
                // BUT: a line may not exceed some 32700 (it's a little less 
than 2**15) chars
                // and the data may not contain tabs
                // and this is just for data; no bulk transfer for formulas 
that I know of
                $line = "";
                for ($col = 1; $col <= $num_cols; $col++) {
                        // youst filling in position number as content
                        $line .= $row* $col . "\t";
                }
                $c = $ws->Cells($row, 1);
                // the whole line is stuffed into the first cell
                $c->Value = $line;
        }
        // Now we take the column ...
        $c = $ws->Range($ws->Cells(2, 1), $ws->Cells($num_rows+1, 1));
        // ... and expand it into the sheet
        $c->TextToColumns();
}
// save wb and close excel


c) As Gryffyn Trevor pointed out in this list not long ago there's another 
choice in case 
   you have a modern Excel at hand (V10+ at least, I think):
   There's a HTML/XML format for excel sheets. These may be opened by a browser 
to 
   render and by Excel to fully control it. So you may produce such a text in 
the first 
   place. Will be a lot faster than COMing around...

d) If you have data that can be calculated from a seed (consecutives or any 
other building rule)
   you may automate "auto fill in". Do that by recording a macro when creating 
by hand and
   translate the upcoming macro.

HTH
-- 
Sven Schnitzke

> -----Urspr�ngliche Nachricht-----
> Von:  Louis Young [SMTP:[EMAIL PROTECTED]
> Gesendet am:  Freitag, 14. Januar 2005 14:34
> An:   [email protected]; [EMAIL PROTECTED]
> Betreff:      [PHP-WIN] Insert range in Excel
> 
> Hi guys
> 
> I managed to get this far with my Excel spreadsheet:
> 
> // Set the workbook to use and it's sheet
> $workbook=$_GLOBALS["templatedir"]."\ElectricityTransactions.XLT";
> $sheet="Sheet1";
> 
> //Instantiate the spreadsheet component.
> $ex = new COM("Excel.sheet") or Die ("Did not connect");
> 
> //Open the workbook that we want to use.
> $wkb = $ex->application->Workbooks->Open($workbook) or Die ("Did not open");
> 
> //Create a copy of the workbook, so the original workbook will be preserved.
> $ex->Application->ActiveWorkbook->SaveAs($_GLOBALS["reportdir"]."\rpt_electrans_".trim($Outlet_session).".xls");
> //$ex->Application->Visible = 1; #Uncomment to make Excel visible.
> 
> //Read and write to a cells in the sheet
> $sheets = $wkb->Worksheets($sheet); //Select the sheet
> $sheets->activate; //Activate it
> 
> $cell = $sheets->Cells(1,2) ; //Select the cell (Row Column number)
> $cell->activate; //Activate the cell
> $cell->value = "ELECTRICITY TRANSACTIONS Outlet ".trim($Outlet_session); 
> //Change it
> 
> But now how would I insert a range i.e., simulate in Excel the following:
> 
> Select range B8:H8. Right click and select insert.
> 
> Any ideas?
> 
> Cheers
> Louis
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Jason, I am using the CGI version of PHP. I use the executable other than
the CLI.


Running the PHP from the command line does not yield any result. However, I
managed to get the CGI version working in a way (php.ini configuration
mix-up) but the problem now is it cannot parse a variable input from an
HTML form.


What might I have still done wrong? Any further help?

GKE

"Jason Barnett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
GKE: are you using the CGI version of PHP for your server?  Or more
directly, which type of PHP executable are you trying to use?

There are *basically* 3 types
- CLI for the command line
- modules which are specialized versions for different server (ISAPI for
IIS and so on)
- CGI which is the common gateway interface

Are you sure that you followed *all* of the instructions for your
particular situation?  Please reread the manual page for this; it helps
you sort out most of the common problems.

You can also try running PHP from the command line and see if that
works.  Downloads aren't 100% reliable after all ;)


GkE wrote: > Cannot really tell what the restrictions are. Can anyone help me. > > GKE > > Luis wrote: > > The error is not PHP related. The message comes from the http server. > Either you have restrictions on the directory, at OS level (I don't know > if you can do that with '98), or within the HTTP server. > > Luis > > GKE wrote: > >



--
Teach a person to fish...

Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://php.net/manual/
php-general archives: http://marc.theaimsgroup.com/?l=php-general&w=2

--- End Message ---
--- Begin Message ---
Jason, I am using the CGI version of PHP. I use the executable other than
the CLI.

Running the PHP from the command line does not yield any result. However, I
managed to get the CGI version working in a way (php.ini configuration
mix-up)  but the problem now is it cannot parse a variable input from an
HTML form.

What might I have still done wrong? Any further help?

GKE

"Jason Barnett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> GKE: are you using the CGI version of PHP for your server?  Or more
> directly, which type of PHP executable are you trying to use?
>
> There are *basically* 3 types
> - CLI for the command line
> - modules which are specialized versions for different server (ISAPI for
> IIS and so on)
> - CGI which is the common gateway interface
>
> Are you sure that you followed *all* of the instructions for your
> particular situation?  Please reread the manual page for this; it helps
> you sort out most of the common problems.
>
> You can also try running PHP from the command line and see if that
> works.  Downloads aren't 100% reliable after all ;)
>
>
> GkE wrote:
> > Cannot really tell what the restrictions are. Can anyone help me.
> >
> > GKE
> >
> > Luis wrote:
> >
> > The error is not PHP related. The message comes from the http server.
> > Either you have restrictions on the directory, at OS level (I don't know
> > if you can do that with '98), or within the HTTP server.
> >
> > Luis
> >
> > GKE wrote:
> >
> >
>
>
>
> --
> Teach a person to fish...
>
> Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
> PHP Manual: http://php.net/manual/
> php-general archives: http://marc.theaimsgroup.com/?l=php-general&w=2

--- End Message ---
--- Begin Message ---
I do not have Apache installed; therefore I did not see any HTTPD.CONF file
to look at. I am using it as a straight CGI midule.


I proceeded to set up the web server by first installing the PWS from the
Win98SE CD. Next, I installed the Win PHP manually. I believe my problem
was configuring the php.ini file.


I have managed to get it working in a way now, but the problem now is it
cannot parse a variable input from an HTML form.


What might I have still done wrong?
GKE

"Luis Moreira" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
As I said, I don't know if you can do that with '98, but I think not.

So, it would be an Apache problem.
How did you proceed to set up the web server ?

You should look at the HTTPD.CONF file, which has the config for Apache.
You have directives that allow or forbid the access to directories.

There should be a "default area", like this

<Directory />
#    Options FollowSymLinks
    order allow,deny
    allow from all
    AllowOverride None
</Directory>

After that, a directive for each directory you which to protect (or not).

In your case, I would say that either the default order is "deny,allow"
or you have another directive forbidding the access to the directory in
question.


Luis


GkE wrote:

>Cannot really tell what the restrictions are. Can anyone help me.
>
>GKE
>
>Luis wrote:
>
>The error is not PHP related. The message comes from the http server.
>Either you have restrictions on the directory, at OS level (I don't know
>if you can do that with '98), or within the HTTP server.
>
>Luis
>
>GKE wrote:
>
>
>
>>I have just joined the learning bandwagon of PHP. I am using Windows
98SE,
>>as such, I downloaded the Windows version of the PHP program 4.3.2-Win32
>>version. But after
>>installation (Manual), I still cannot get anything working.
>>
>>Sometimes I get Access Denied ......something something FORCE REDIRECT
and
>>sometimes the following error message.
>>
>>
>>HTTP Error 403
>>403.1 Forbidden: Execute Access Forbidden
>>
>>This error can be caused if you try to execute a CGI, ISAPI, or other
>>executable program from a directory that does not allow programs to be
>>executed.
>>
>>What could I have done wrong? Need assistance
>>
>>GKE
>>
>>


--- End Message ---
--- Begin Message ---
I do not have Apache installed; therefore I did not see any HTTPD.CONF file
to look at. I am using it as a straight CGI midule.

I proceeded to set up the web server by first installing the PWS from the
Win98SE CD. Next, I installed the Win PHP manually.  I believe my problem
was configuring the php.ini file.

I have managed to get it working in a way now,  but the problem now is it
cannot parse a variable input from an HTML form.

What might I have still done wrong?
GKE

"Luis Moreira" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> As I said, I don't know if you can do that with '98, but I think not.
>
> So, it would be an Apache problem.
> How did you proceed to set up the web server ?
>
> You should look at the HTTPD.CONF file, which has the config for Apache.
> You have directives that allow or forbid the access to directories.
>
> There should be a "default area", like this
>
> <Directory />
> #    Options FollowSymLinks
>     order allow,deny
>     allow from all
>     AllowOverride None
> </Directory>
>
> After that, a directive for each directory you which to protect (or not).
>
> In your case, I would say that either the default order is "deny,allow"
> or you have another directive forbidding the access to the directory in
> question.
>
>
> Luis
>
>
> GkE wrote:
>
> >Cannot really tell what the restrictions are. Can anyone help me.
> >
> >GKE
> >
> >Luis wrote:
> >
> >The error is not PHP related. The message comes from the http server.
> >Either you have restrictions on the directory, at OS level (I don't know
> >if you can do that with '98), or within the HTTP server.
> >
> >Luis
> >
> >GKE wrote:
> >
> >
> >
> >>I have just joined the learning bandwagon of PHP. I am using Windows
98SE,
> >>as such, I downloaded the Windows version of the PHP program 4.3.2-Win32
> >>version. But after
> >>installation (Manual), I still cannot get anything working.
> >>
> >>Sometimes I get Access Denied ......something something FORCE REDIRECT
and
> >>sometimes the following error message.
> >>
> >>
> >>HTTP Error 403
> >>403.1 Forbidden: Execute Access Forbidden
> >>
> >>This error can be caused if you try to execute a CGI, ISAPI, or other
> >>executable program from a directory that does not allow programs to be
> >>executed.
> >>
> >>What could I have done wrong? Need assistance
> >>
> >>GKE
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
>

--- End Message ---
--- Begin Message ---
Try Dreamweaver, 2 words, Rapid Development.. :)

Zu3Bi
--- End Message ---
--- Begin Message ---
My favourite is Scite; it's Open Source, available for Linux, Unix and Win and 
knows a lot of
syntaxes.

http://www.scintilla.org

The PHP functions and parmlist-aware (call-tips, F1 to PHP docs) derivative 
named PHPSciTE 
seems to be withdrawn - maybe copyright issues using the PHP name ? I don't 
know, 
since it works like a charm. If one can get it it's worth a try

-- 
Sven Schnitzke

> -----Urspr�ngliche Nachricht-----
> Von:  Jason Barnett [SMTP:[EMAIL PROTECTED]
> Gesendet am:  Donnerstag, 13. Januar 2005 23:07
> An:   [email protected]
> Betreff:      [PHP-WIN] Re: [PHP] php editor
> 
> I use Wordpad.  Seriously ;)
> 
> 
> -- 
> Teach a person to fish...
> 
> Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
> PHP Manual: http://www.php.net/manual/en/index.php
> php-general archives: http://marc.theaimsgroup.com/?l=php-general&w=2
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Try Context!

http://www.context.cx/
--- End Message ---
--- Begin Message ---
The comma before the second trim is misplaced....by chance, do you mean this
instead:

$ReturnBalance=$DelphiASPObj->GetClientBalance(trim($Outlet_session)."E",
trim($Application["FinURL"]));

-----Original Message-----
From: Louis Young [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 14, 2005 6:15 AM
To: [email protected]; [EMAIL PROTECTED]
Subject: [PHP-WIN] Call ActiveX component


Hi there

I'm trying to call an ActiveX object from PHP. The code in ASP looks as 
follows:

Set DelphiASPObj = Server.CreateObject("ClientBalance.coClientBalance")
DelphiASPObj.GetClientBalance (Trim(Session("Outlet")) & "E")  , 
Trim(Application("FinURL")), ReturnBalance

I tried this in PHP:

$DelphiASPObj = COM("ClientBalance.coClientBalance"); // Line 281

$ReturnBalance=$DelphiASPObj->GetClientBalance(trim($Outlet_session)."E"),tr
im($Application["FinURL"]));

But I get the following error message:

*Parse error*: parse error in *C:\Program Files\Apache 
Group\Apache2\htdocs\spar\admin\rpt_electrans.php* on line *281

Any ideas?

Cheers
Louis
*

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

--- End Message ---

Reply via email to