[PHP] PHP newbie question on xslt

2007-03-26 Thread Timothy Murphy
I've been trying some of the programs
in the PHP manual at http://www.php.net/manual/en/
in chapters CLXXXI and CLXXXII to work, for example

// Example 2519. Creating an XSLTProcessor

?php

$xml_filename = collection.xml;
$xsl_filename= collection.xsl;

$doc = new DOMDocument();
$xsl = new XSLTProcessor();

$doc-load($xsl_filename);
$xsl-importStyleSheet($doc);

$doc-load($xml_filename);
echo $xsl-transformToXML($doc);

?

(where I have added the two filenames,
and copied the files collection.x?l from the manual).

When I run PHP I get:

[EMAIL PROTECTED] Test]# php ex2519.php
// Example 2519. Creating an XSLTProcessor

Segmentation fault


I'm running the program under Fedora-6 Linux
with the latest versions of all programs.

Is there something I should have included,
to get the program to run?

Any advice or suggestions gratefully received.

-- 
Timothy Murphy  
e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland

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



Re: [PHP] PHP newbie question on xslt

2007-03-26 Thread Miguel J. Jiménez

Timothy Murphy escribió:

I've been trying some of the programs
in the PHP manual at http://www.php.net/manual/en/
in chapters CLXXXI and CLXXXII to work, for example

// Example 2519. Creating an XSLTProcessor

?php

$xml_filename = collection.xml;
$xsl_filename= collection.xsl;

$doc = new DOMDocument();
$xsl = new XSLTProcessor();

$doc-load($xsl_filename);
$xsl-importStyleSheet($doc);

$doc-load($xml_filename);
echo $xsl-transformToXML($doc);

?

(where I have added the two filenames,
and copied the files collection.x?l from the manual).

When I run PHP I get:

[EMAIL PROTECTED] Test]# php ex2519.php
// Example 2519. Creating an XSLTProcessor

Segmentation fault


I'm running the program under Fedora-6 Linux
with the latest versions of all programs.

Is there something I should have included,
to get the program to run?

Any advice or suggestions gratefully received.

  


Try not to load both xml and xsl in the same $doc variable... use one 
for the xsl and another for the xml. I think you are destroying the dom 
for the xsl before the transform...


--
Miguel J. Jiménez
Área de Internet/XSL/PHP
[EMAIL PROTECTED]



ISOTROL
Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta.
Parque Tecnológico Cartuja '93, 41092 Sevilla.
Teléfono: 955 036 800 - Fax: 955 036 849
http://www.isotrol.com

Killing is often a part of life. What's hypocritical is to condemn, and then make 
allowances when the situation suits.
Utu-Noranti Pralatong (Farscape 4x17 - A Constellation Of Doubt)


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

Re: [PHP] php newbie question with xml files

2005-05-04 Thread Mark Cain
This should get you started:


$old_data = file_get_contents('./test.txt');
$my_data = foo bar;
$pattern = '/(.*)(\/.*)$/i';
$replacement = '$1' . $my_data . '$2';
$new_data = preg_replace($pattern, $replacement, $old_data);
echo $new_data;

or a little more succinctly

$my_data = foo bar;
$new_data = preg_replace('/(.*)(\/.*)$/i', '$1' . $my_data . '$2',
file_get_contents('./test.txt'));
echo $new_data;


Mark Cain


- Original Message -
From: Jared Sherman [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tuesday, May 03, 2005 2:00 AM
Subject: [PHP] php newbie question with xml files


 I have an xml document storing some data I need. What I want to do is
this:
 1. Scan to the end of the file.
 2. Find the closing tag.
 3. Insert a new entry in before the closing tag.

 I've tried:
 1. Creating new files and renaming them to be the original.
 2. Writing the file to a dummy file and insert my lines part way through
 then finish the last tag.

 My problem is I'm looking for a /endtag and it comes up as endtag. Is
 there anyway to force PHP to read the .xml file as a text file so it wont
 strip off the xml tag information?

 I've used fopen with fgets and fwrite, and file with fwrite

 Jared Sherman
 Totally lost newbie

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



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



Re: [PHP] php newbie question with xml files

2005-05-04 Thread Mark Cain
This should get you started:


$old_data = file_get_contents('./test.txt');
$my_data = foo bar;
$pattern = '/(.*)(\/.*)$/i';
$replacement = '$1' . $my_data . '$2';
$new_data = preg_replace($pattern, $replacement, $old_data);
echo $new_data;

or a little more succinctly

$my_data = foo bar;
$new_data = preg_replace('/(.*)(\/.*)$/i', '$1' . $my_data . '$2',
file_get_contents('./test.txt'));
echo $new_data;


Mark Cain


- Original Message -
From: Jared Sherman [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tuesday, May 03, 2005 2:00 AM
Subject: [PHP] php newbie question with xml files


 I have an xml document storing some data I need. What I want to do is
this:
 1. Scan to the end of the file.
 2. Find the closing tag.
 3. Insert a new entry in before the closing tag.

 I've tried:
 1. Creating new files and renaming them to be the original.
 2. Writing the file to a dummy file and insert my lines part way through
 then finish the last tag.

 My problem is I'm looking for a /endtag and it comes up as endtag. Is
 there anyway to force PHP to read the .xml file as a text file so it wont
 strip off the xml tag information?

 I've used fopen with fgets and fwrite, and file with fwrite

 Jared Sherman
 Totally lost newbie

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



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



Re: [PHP] php newbie question with xml files

2005-05-04 Thread disguised.jedi
 I have an xml document storing some data I need. What I want to do is this:
 1. Scan to the end of the file.
 2. Find the closing tag.
 3. Insert a new entry in before the closing tag.

There are specific classes and functions in the PHP core that can help
you do just this.

 I've tried:
 1. Creating new files and renaming them to be the original.
 2. Writing the file to a dummy file and insert my lines part way through
 then finish the last tag.

I don't think this is the right approach to take.  Maybe using the DOM
and/or the XML Parser built-in to php would help you.

 My problem is I'm looking for a /endtag and it comes up as endtag. Is
 there anyway to force PHP to read the .xml file as a text file so it wont
 strip off the xml tag information?
 
 I've used fopen with fgets and fwrite, and file with fwrite

Again, this isn't the approach to take.  There are built-in functions
for this sort of thing, as well as classes on PEAR that will help you.
 Try google!

Read through all of this and decide which approach you want to take
before you start anything...

If you use Windows or compile PHP as an Apache module in Linux, you're
all set with the XML Parser.  If not, you'll need to get the library
according to the directions in the manual.

http://www.php.net/xml

Read everything in that thoroughly, and understand it before you
continue with this approach.  Copy and play with the examples to see
how it all works.  If you'd rather handle things in an environment
designed to create and manipulate XML dynamically, rather than just
read and insert raw strings, keep reading.

You can get the DOM XML working easily in Windows, and even easier in
a GNOME environment on a linux box.  The manual has excellent
instructions.

http://www.php.net/domxml

This extension is Object-Oriented (OO), and if you don't know what
that is, you better read up on it before you try this out.  If you do,
and have an OK understanding of how OO works in PHP, then read on!  If
not, read the article

http://www.php.net/oop

Now, understand that DOM XML is very particular about the syntax and
such in an XML file.  The file MUST start with the XML declaration
(without quotes) ?xml version=1.0 in order for DOM to try and use
it.

Use the functions to read right through it all.  You'll find that this
is probably exactly what you need!

I'd use DOM XML personally.  I included the other in case you didn't
want to have to install everything.

Have fun, and good luck with PHP!

-- 
[EMAIL PROTECTED]

PHP rocks!
Knowledge is Power.  Power Corrupts.  Go to school, become evil

Disclaimer: Any disclaimer attached to this message may be ignored. 
However, I must say that the ENTIRE contents of this message are
subject to other's criticism, corrections, and speculations.

This message is Certified Virus Free

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



Re: [PHP] php newbie question with xml files

2005-05-04 Thread Jason Barnett
PHP5:
http://php.net/manual/en/ref.dom.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] php newbie question with xml files

2005-05-03 Thread Jared Sherman
I have an xml document storing some data I need. What I want to do is this:
1. Scan to the end of the file.
2. Find the closing tag.
3. Insert a new entry in before the closing tag.

I've tried:
1. Creating new files and renaming them to be the original.
2. Writing the file to a dummy file and insert my lines part way through 
then finish the last tag.

My problem is I'm looking for a /endtag and it comes up as endtag. Is 
there anyway to force PHP to read the .xml file as a text file so it wont 
strip off the xml tag information?

I've used fopen with fgets and fwrite, and file with fwrite

Jared Sherman
Totally lost newbie 

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



[PHP] php NEWBIE Question

2003-08-25 Thread Dennis Dujan - Partycult.de
Hi,
can you tell me how is it possible to connect to a linux shell via PHP?
 
Greetz
Dennis


Re: [PHP] php NEWBIE Question

2003-08-25 Thread Curt Zirzow
* Thus wrote Dennis Dujan - Partycult.de ([EMAIL PROTECTED]):
 Hi,
 can you tell me how is it possible to connect to a linux shell via PHP?

Ok, i suppose I should reply to this before you ask the same
question with less details, again.

Please be a little more specific in your question, like what you
are trying to achieve.  Otherwise we will be just trying to guess
at what you want to do, and most likley guess wrong.

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



AW: [PHP] php NEWBIE Question

2003-08-25 Thread Dennis Dujan - Partycult.de
Iam currently writing some Scripts in PHP for a Webappliance.
And now I have the problem that I have to connect with
a PHP Script to a Shell that is located on another Server.
But I don't know how to do this... :-/
Perhaps you can help me with an example or a Page with a Tutorial.

Greetz
Dennis

-Ursprungliche Nachricht-
Von: Curt Zirzow [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 25. August 2003 01:22
An: [EMAIL PROTECTED]
Betreff: Re: [PHP] php NEWBIE Question

* Thus wrote Dennis Dujan - Partycult.de ([EMAIL PROTECTED]):
 Hi,
 can you tell me how is it possible to connect to a linux shell via PHP?

Ok, i suppose I should reply to this before you ask the same
question with less details, again.

Please be a little more specific in your question, like what you
are trying to achieve.  Otherwise we will be just trying to guess
at what you want to do, and most likley guess wrong.

Curt
--
I used to think I was indecisive, but now I'm not so sure.

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

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



RE: [PHP] php NEWBIE Question

2003-08-25 Thread Dennis Dujan - Partycult.de
Ok thank you very much

-Ursprungliche Nachricht-
Von: Chris Kay [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 25. August 2003 01:37
An: 'Dennis Dujan - Partycult.de'
Betreff: RE: [PHP] php NEWBIE Question


Try http://au.php.net/manual/en/function.fsockopen.php

If your looking for a tutorial, goto google and search for telnet with
php

--
Chris Kay (CK)
Eleet Internet Services
M: 0415 451 372
P: 02 4620 5076
F: 02 4620 7008
E: [EMAIL PROTECTED]

-Original Message-
From: Dennis Dujan - Partycult.de [mailto:[EMAIL PROTECTED]
Sent: Monday, 25 August 2003 9:34 AM
To: [EMAIL PROTECTED]
Subject: AW: [PHP] php NEWBIE Question

Iam currently writing some Scripts in PHP for a Webappliance.
And now I have the problem that I have to connect with
a PHP Script to a Shell that is located on another Server.
But I don't know how to do this... :-/
Perhaps you can help me with an example or a Page with a Tutorial.

Greetz
Dennis

-Ursprungliche Nachricht-
Von: Curt Zirzow [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 25. August 2003 01:22
An: [EMAIL PROTECTED]
Betreff: Re: [PHP] php NEWBIE Question

* Thus wrote Dennis Dujan - Partycult.de ([EMAIL PROTECTED]):
 Hi,
 can you tell me how is it possible to connect to a linux shell via
PHP?

Ok, i suppose I should reply to this before you ask the same
question with less details, again.

Please be a little more specific in your question, like what you
are trying to achieve.  Otherwise we will be just trying to guess
at what you want to do, and most likley guess wrong.

Curt
--
I used to think I was indecisive, but now I'm not so sure.

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

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

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



[PHP] PHP Newbie question

2002-11-18 Thread Bryan Cassidy
This might sound stupid but what the hell. I am running Red Hat 8.0
with Apache. I have apache working fine right now. I am wanting to
learn some php but really don't know where to start/look or anything
to tell the truth. I do everything from my FreeBSD 4.6.2 box but
Apache runs on Red Hat. With me? Could someone give me a very basic
PHP script or whatever they are called, tell me where I should or
need to put it on my Red Hat 8.0 box and what else I need to do to
see the script on my webpage? Put it like this. I will make a html
file in /var/www/html/ called php and inside php i will make a file
named php.ini ( i think it should be .ini right?) and I will edit my
index.html file, add a link and point it to the php.ini file and see
what happens. I just want to get a very basic idea of php, what it
does, where to put the php file and how to get started on the web. I
really hope this e-mail doesn't get ignored so could someone just help
me out a lil bit here? I would appreciate it.



msg86190/pgp0.pgp
Description: PGP signature


Re: [PHP] PHP Newbie question

2002-11-18 Thread Stolen
http://www.php.net/manual/en/tutorial.php


Bryan Cassidy wrote:


This might sound stupid but what the hell. I am running Red Hat 8.0
with Apache. I have apache working fine right now. I am wanting to
learn some php but really don't know where to start/look or anything
to tell the truth. I do everything from my FreeBSD 4.6.2 box but
Apache runs on Red Hat. With me? Could someone give me a very basic
PHP script or whatever they are called, tell me where I should or
need to put it on my Red Hat 8.0 box and what else I need to do to
see the script on my webpage? Put it like this. I will make a html
file in /var/www/html/ called php and inside php i will make a file
named php.ini ( i think it should be .ini right?) and I will edit my
index.html file, add a link and point it to the php.ini file and see
what happens. I just want to get a very basic idea of php, what it
does, where to put the php file and how to get started on the web. I
really hope this e-mail doesn't get ignored so could someone just help
me out a lil bit here? I would appreciate it.
 




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




Re: [PHP] PHP Newbie question

2002-11-18 Thread Maxim Maletsky

Steps:

1. Install PHP. Already installed?
2. make a file accessible via browser and call it test.php
3. put this into it:

?
echo Hello Worldbr;
phpinfo();
?

4. Now, access that file.

If you see Hello World outputted followed by a long blue-gray table
with lots of server data - means everything worked and you could go to
the sites like PHP Beginner (www.phpbeginner.com) or many others to read
some tutorials and still code to keep testing.

If you get asked to download a .php file then make sure you installed
your PHP with Apache right (requires some editing of httpd.conf, read
the manual)

Cheers,

--
Maxim Maletsky
[EMAIL PROTECTED]



Bryan Cassidy [EMAIL PROTECTED] wrote... :

 This might sound stupid but what the hell. I am running Red Hat 8.0
 with Apache. I have apache working fine right now. I am wanting to
 learn some php but really don't know where to start/look or anything
 to tell the truth. I do everything from my FreeBSD 4.6.2 box but
 Apache runs on Red Hat. With me? Could someone give me a very basic
 PHP script or whatever they are called, tell me where I should or
 need to put it on my Red Hat 8.0 box and what else I need to do to
 see the script on my webpage? Put it like this. I will make a html
 file in /var/www/html/ called php and inside php i will make a file
 named php.ini ( i think it should be .ini right?) and I will edit my
 index.html file, add a link and point it to the php.ini file and see
 what happens. I just want to get a very basic idea of php, what it
 does, where to put the php file and how to get started on the web. I
 really hope this e-mail doesn't get ignored so could someone just help
 me out a lil bit here? I would appreciate it.


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




[PHP] php newbie question

2002-05-31 Thread Taylor Lewick

I am having a hard time getting apache to load the php4 module.  Can I still use PHP 
for my web stuff...?

Thanks

Taylor Lewick
Unix System Administrator
Fortis Benefits
816 881 6073

Help Wanted.  Seeking Telepath...
You Know where to apply.


Please Note
The information in this E-mail message is legally privileged
and confidential information intended only for the use of the
individual(s) named above. If you, the reader of this message,
are not the intended recipient, you are hereby notified that 
you should not further disseminate, distribute, or forward this
E-mail message. If you have received this E-mail in error,
please notify the sender. Thank you
*

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




RE: [PHP] PHP newbie question

2001-01-11 Thread Bryne Jørg Vidar

http://www.php.net/manual/language.expressions.php

snip
One last thing worth mentioning is the truth value of expressions. In many
events, mainly in conditional execution and loops, you're not interested in
the specific value of the expression, but only care about whether it means
TRUE or FALSE (PHP doesn't have a dedicated boolean type). The truth value
of expressions in PHP is calculated in a similar way to perl. Any numeric
non-zero numeric value is TRUE, zero is FALSE. Be sure to note that negative
values are non-zero and are thus considered TRUE! The empty string and the
string "0" are FALSE; all other strings are TRUE. With non-scalar values
(arrays and objects) - if the value contains no elements it's considered
FALSE, otherwise it's considered TRUE.
/snip

Since variables doesn't need to be declared it's regarded as set when used
in an expression... hence $a is evaluated to "", or 0 if compared to
numbers, false if compared to boolean.

-Jrg
-Original Message-
From: Neil Zanella [mailto:[EMAIL PROTECTED]]
Sent: 10. januar 2001 19:33
To: Toby Butzon
Cc: PHP General Mailing List
Subject: Re: [PHP] PHP newbie question



On Wed, 10 Jan 2001, Toby Butzon wrote:

 : ?php if (! $a) print "Hello, World!"; // script 2 ?
 
 $a evaluates to false, the ! reverses it, and it prints "Hello, World!"

What is bothering me is the following: if variables that are not assigned
a value were to evaluate to false then since false is the same as the
number 1 the following PHP script should print the number 1 but instead
prints nothing:

?php if (! $a) print $a; ?

How is this behavior justified?
I could not find anything on this in the PHP manual.

Thanks,

-- Neil


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP newbie question

2001-01-10 Thread Hsieh, Wen-Yang


- Original Message -
From: "Neil Zanella" [EMAIL PROTECTED]
To: "Hsieh, Wen-Yang" [EMAIL PROTECTED]
Cc: "PHP General Mailing List" [EMAIL PROTECTED]
Sent: Wednesday, January 10, 2001 1:11 PM
Subject: Re: [PHP] PHP newbie question



 On Wed, 10 Jan 2001, Hsieh, Wen-Yang wrote:

  "" is false.

 The following three seem to be the same in PHP3:

 1) false
 2) ""
 3) 0

zero and an empty string were understood to be false.  Still they are
different.


 I guess that "" is automatically cast to 0 or to false
 wherever an integer is required. Where can I find the
 exact casting rules in PHP3/4 ?

http://www.php.net/manual/language.types.type-juggling.php#language.types.ty
pecasting


 Thanks,

 Neil



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]