Re: --with-sablot

From: Date: Thu, 09 Nov 2000 22:42:31 +0000
Subject: Re: --with-sablot
References: 1  Groups: php.install 
Request: Send a blank email to php-install+get-703@lists.php.net to get a copy of this message
It looks like your using the article posted on phpbuilder.com. The functions have since changed since we wrote that article. I think that article was based on php-4.0.2. The available funcs can be found here. http://www.zend.com/phpfunc/extension.sablot.php Replace your transform method with this: function transform() { xslt_process($this->xsl, $this->xml, $outcome); $this->setOutput($outcome); } On Thu, 9 Nov 2000, Greg Militello wrote: >Well, it is partially working at least. > >There are a few functions I can't get to work: > xslt_create_processor(); > xslt_process_strings(); > >Possibly more. I have made a transform using the code in my second block >below, however, the first class bombs out. > >Is this an Expat problem? > > >-Greg > > >This code does not work: ><?php >/* >XSLTranformer -- Class to transform XML files using XSL with the Sablotron >libraries. >Justin Grant (2000-07-30) >Thanks to Bill Humphries for the original examples on using the Sablotron >module. >*/ > >/* test */ >/* >$transformer = new XSLTransformer(); > >if >($transform->setXsl("http://www.someurl.com/document.xsl") >&& > > $transform->setXml("http://www.someurl.com/document.xml")) > > $transformer->transform(); > echo $transformer->getOutput(); >} else > > echo $transformer->getError(); >} >*/ > >class XSLTransformer >{ > > var $xsl, $xml, $output, $error ; > > /* Constructor */ > function XSLTransformer() > > $this->processor = xslt_create_processor(); > } > > /* Destructor */ > function destroy() > > xslt_destroy_processor($this->processor); > } > > /* output methods */ > > function setOutput($string) > { > $this->output = $string; > } > > function getOutput() >{ > return $this->output; > } > > > /* set methods */ > > function setXml($uri) > > if($doc = new docReader($uri)) > > $this->xml = $doc->getString(); > return true; > } else > > $this->setError("Could not open $xml"); > return false; > } > } > > function setXsl($uri) > { > if($doc = new docReader($uri)) > { > $this->xsl = $doc->getString(); > return true; > } > else > { > $this->setError("Could not open $uri"); > return false; > } > } > > > /* transform method */ > > function transform() { > $this->setOutput( >xslt_process_strings($this->processor, >$this->xsl, $this->xml, &$err)); > $this->setError($err); > } > > > /* Error Handling */ > > function setError($string) > > $this->error = $string; > } > > function getError() > > return $this->error; > } > >} > > >/* docReader -- read a file or URL as a string */ > >/* test */ >/* >$docUri = new >docReader('http://www.someurl.com/doc.html'); >echo $docUri->getString(); >*/ > >class docReader > > > var $string; // public string representation of file > var $type; // private URI type: 'file','url' > var $bignum = 1000000; > > /* public constructor */ > > function docReader($uri) { // returns integer > > $this->setUri($uri); > $this->setType(); > > $fp = fopen($this->getUri(),"r"); > > if($fp) > > // get length > if ($this->getType() == 'file') > > $length = filesize($this->getUri()); > } else > > $length = $this->bignum; > } > > $this->setString(fread($fp,$length)); > return 1; > } else > > return 0; > } > } > > > /* determine if a URI is a filename or URL */ > > function isFile($uri) { // returns boolean > > if (strstr($uri,'http://') == $uri) > > return false; > } else > > return true; > } > } > > /* set and get methods */ > > function setUri($string) > > $this->uri = $string; > } > > function getUri() > > return $this->uri; > } > > function setString($string) > > $this->string = $string; > } > > function getString() > > return $this->string; > } > > function setType() > > if ($this->isFile($this->uri)) > > $this->type = 'file'; > } else > > $this->type = 'url'; > } > } > > function getType() > > return $this->type; > } > >} > >?> > > >But this code block works: ><?php > >/* >* Subject: XSLT class using PHP4 Sablotron extension >* Author: Urs Gehrig <urs@circle.ch> >* Date: 11-10-2000 >* Version: 0.1 >* >* URL: http://www.circle.ch/projects/xml/ >*/ > >class xsl_transform { > > var $xsl_file; > var $xml_file; > var $filename; > > // {{{ xsl_transform(), constructor of xsl_transform class > > function xsl_transform($xsl_file = '', $xml_file = ''){ > $this->xsl_string = $this->read_file($xsl_file); > $this->xml_string = $this->read_file($xml_file); > } > > // }}} > // {{{ read_file() > > function read_file($filename) { > // get contents of a file into a string > $fd = fopen( $filename, "r" ); > $content = fread( $fd, filesize( $filename ) ); > fclose( $fd ); > return $content; > } > > // }}} > // {{{ apply() > > function apply() { > $this->result = ''; > > $this->msg = xslt_process($this->xsl_string, $this->xml_string, >$this->result); > if(!$this->msg) print ("Transformation failed."); > return $this->result; > } > > // }}} >} > >$xslt = new xsl_transform("slashdot.xsl", "slashdot.xml"); >print ($xslt->apply()); > >?> > >----- Original Message ----- >From: Greg Militello <gmilitello@dyrectmedia.com> >To: Matt Dunford <matt@stary.zoomedia.com> >Cc: <php-install@lists.php.net> >Sent: Thursday, November 09, 2000 3:35 PM >Subject: Re: [PHP-INST] --with-sablot > > >> All is well. Thanks a lot for responding >> >> >> -Greg >> >> ----- Original Message ----- >> From: Matt Dunford <matt@stary.zoomedia.com> >> To: Greg Militello <gmilitello@dyrectmedia.com> >> Cc: <php-install@lists.php.net> >> Sent: Thursday, November 09, 2000 3:24 PM >> Subject: Re: [PHP-INST] --with-sablot >> >> >> > It looks like sablot wasn't compiled in correctly after all. >> > >> > Here's what I did to compile sablot and php. >> > I use Redhat 7.0, but this config runs on 6.2 as well. >> > >> > Sablot: >> > tar zxvf Sablot-0.44.tar.gz >> > tar zxvf Sablot-Expat-1.1.2.tar.gz >> > mv Expat Sablot-0.44 >> > cd Sablot-0.44 >> > ./configure >> > make >> > make install >> > >> > Apache: >> > cd apache_1.3.14 >> > ./configure >> > >> > Php: >> > cd php-4.0.3p1 >> > ./configure \ >> > --enable-track-vars \ >> > --with-mysql=/usr/local \ >> > --with-apache=../apache_1.3.14 \ >> > --with-sablot >> > make >> > make install >> > >> > Apache (again): >> > cd apache_1.3.14 >> > ./configure \ >> > --prefix=/www/apache \ >> > --enable-module=so \ >> > --activate-module=src/modules/php4/libphp4.a >> > make >> > make install >> > >> > >> > >> > >> > >> > On Thu, 9 Nov 2000, Greg Militello wrote: >> > >> > >Nope. I included my error and my code. Do you think you could send >your >> > >configs? >> > > >> > >-Greg >> > > >> > > >> > >Here is what I get returned: >> > > >> > >Fatal error: Call to undefined function: xslt_create_processor() in >> > >class.XSLTransformer.php on line 27 >> > > >> > > >> > >here is the code: >> > > >> > ><? >> > >set_magic_quotes_runtime(0); // this was from your post. >> > > >> > >include "class.XSLTransformer.php"; >> > >$transformer = new XSLTransformer(); >> > >if ($transform->setXsl("slashdot.xsl") && >> > >$transform->setXml("slashdot.xml")) >> > >> >> > > $transformer->transform(); >> > > echo $transformer->getOutput(); >> > >} else >> >> > > echo $transformer->getError(); >> > >} >> > >?> >> > > >> > > >> > > >> > >here is the class: >> > > >> > ><?php >> > >/* >> > >XSLTranformer -- Class to transform XML files using XSL with the >> Sablotron libraries. >> > >Justin Grant (2000-07-30) >> > >Thanks to Bill Humphries for the original examples on using the >Sablotron >> module. >> > >*/ >> > > >> > >/* test */ >> > >/* >> > >$transformer = new XSLTransformer(); >> > > >> > >if >> > >($transform->setXsl("http://www.someurl.com/document.xsl") >> > >&& >> > > >> > > $transform->setXml("http://www.someurl.com/document.xml")) >> >> > > $transformer->transform(); >> > > echo $transformer->getOutput(); >> > >} else >> >> > > echo $transformer->getError(); >> > >} >> > >*/ >> > > >> > >class XSLTransformer >> > >{ >> > > >> > > var $xsl, $xml, $output, $error ; >> > > >> > > /* Constructor */ >> > > function XSLTransformer() >> >> > > $this->processor = xslt_create_processor(); >> > > } >> > > >> > > /* Destructor */ >> > > function destroy() >> >> > > xslt_destroy_processor($this->processor); >> > > } >> > > >> > > /* output methods */ >> > > >> > > function setOutput($string) >> > > { >> > > $this->output = $string; >> > > } >> > > >> > > function getOutput() >> > >{ >> > > return $this->output; >> > > } >> > > >> > > >> > > /* set methods */ >> > > >> > > function setXml($uri) >> >> > > if($doc = new docReader($uri)) >> >> > > $this->xml = $doc->getString(); >> > > return true; >> > > } else >> >> > > $this->setError("Could not open $xml"); >> > > return false; >> > > } >> > > } >> > > >> > > function setXsl($uri) >> > > { >> > > if($doc = new docReader($uri)) >> > > { >> > > $this->xsl = $doc->getString(); >> > > return true; >> > > } >> > > else >> > > { >> > > $this->setError("Could not open $uri"); >> > > return false; >> > > } >> > > } >> > > >> > > >> > > /* transform method >> > > */ >> > > >> > > function transform() { >> > > $this->setOutput( >> > >xslt_process_strings($this->processor, >> > >$this->xsl, $this->xml, &$err)); >> > > $this->setError($err); >> > > } >> > > >> > > >> > > /* Error Handling */ >> > > >> > > function setError($string) >> > > >> > > $this->error = $string; >> > > } >> > > >> > > function getError() >> > > >> > > return $this->error; >> > > } >> > > >> > >} >> > > >> > > >> > >/* docReader -- read a file or URL as a string */ >> > > >> > >/* test */ >> > >/* >> > >$docUri = new >> > >docReader('http://www.someurl.com/doc.html'); >> > >echo $docUri->getString(); >> > >*/ >> > > >> > >class docReader >> > > >> > > >> > > var $string; // public string representation of file >> > > var $type; // private URI type: 'file','url' >> > > var $bignum = 1000000; >> > > >> > > /* public constructor */ >> > > >> > > function docReader($uri) { // returns integer >> > > >> > > $this->setUri($uri); >> > > $this->setType(); >> > > >> > > $fp = fopen($this->getUri(),"r"); >> > > >> > > if($fp) >> > > >> > > // get length >> > > if ($this->getType() == 'file') >> > > >> > > $length = filesize($this->getUri()); >> > > } else >> > > >> > > $length = $this->bignum; >> > > } >> > > >> > > $this->setString(fread($fp,$length)); >> > > return 1; >> > > } else >> > > >> > > return 0; >> > > } >> > > } >> > > >> > > >> > > /* determine if a URI is a filename or URL */ >> > > >> > > function isFile($uri) { // returns boolean >> > > >> > > if (strstr($uri,'http://') == $uri) >> > > >> > > return false; >> > > } else >> > > >> > > return true; >> > > } >> > > } >> > > >> > > /* set and get methods */ >> > > >> > > function setUri($string) >> > > >> > > $this->uri = $string; >> > > } >> > > >> > > function getUri() >> > > >> > > return $this->uri; >> > > } >> > > >> > > function setString($string) >> > > >> > > $this->string = $string; >> > > } >> > > >> > > function getString() >> > > >> > > return $this->string; >> > > } >> > > >> > > function setType() >> > > >> > > if ($this->isFile($this->uri)) >> > > >> > > $this->type = 'file'; >> > > } else >> > > >> > > $this->type = 'url'; >> > > } >> > > } >> > > >> > > function getType() >> > > >> > > return $this->type; >> > > } >> > > >> > >} >> > > >> > >?> >> > > >> > > >> > >----- Original Message ----- >> > >From: Matt Dunford <matt@stary.zoomedia.com> >> > >To: Greg Militello <gmilitello@dyrectmedia.com> >> > >Cc: <php-install@lists.php.net> >> > >Sent: Thursday, November 09, 2000 12:50 PM >> > >Subject: Re: [PHP-INST] --with-sablot >> > > >> > > >> > >> your configuration looks fine. What's probably happening is the >> > >> --enable-magic-quotes option is conflicting with Sablot somehow. >> > >> But there's no need to recompile. >> > >> >> > >> Add this to the top of php scripts that use Sablot functions: >> > >> >> > >> set_magic_quotes_runtime(0); >> > >> >> > >> If that doesn't work, I'll send you my configuration. >> > >> >> > >> >> > >> >> > >> On Wed, 8 Nov 2000, Greg Militello wrote: >> > >> >> > >> >Does anyone have detailed instructions for how to use this package? >> > >> > >> > >> >After two days of work I can't get this to work. >> > >> > >> > >> >below I have listed my "general" install method. Note: I do >> > >> >not >have >> > >> >all my commands in here, like cd's etc. >> > >> > >> > >> >Any clues as to what I am doing wrong? >> > >> > >> > >> > >> > >> >---- >> > >> >MySQL >> > >> >---- >> > >> >gunzip -dc mysql-3.22.32.tar.gz | tar xvf - >> > >> >./configure --prefix=/usr/local/mysql >> > >> >make >> > >> >make install >> > >> >scripts/mysql_install_db >> > >> >cd /usr/local/mysql/bin >> > >> >./safe_mysqld & >> > >> >./mysqladmin -u root password 'T&56jlq' >> > >> > >> > >> >---- >> > >> >sablotron >> > >> >---- >> > >> >tar -xzvf sablot_*.tar.gz >> > >> >cp expat*.tar.gz <sablotdir> >> > >> >cd <sablotdir> >> > >> >tar -xzvf Sablot-Expat*.tar.gz >> > >> >./configure --with-prefix=/usr/local >> > >> >make >> > >> >make install >> > >> > >> > >> >---- >> > >> >php 4 >> > >> >----- >> > >> >cd /tmp/download >> > >> >gunzip -c apache_1.3.12.tar.gz | tar xf - >> > >> >cd apache_1.3.12 >> > >> >./configure --prefix=/usr/local/apache >> > >> >cd .. >> > >> > >> > >> > NOTE: add to etc/sablot/config.m4 >> > >> > >> > >> > PHP_SUBST(SABLOT_SHARED_LIBADD) >> > >> > AC_ADD_LIBRARY_WITH_PATH(sablot, $SABLOT_DIR/lib, >> SABLOT_SHARED_LIBADD) >> > >> > +AC_ADD_LIBRARY(xmltok) >> > >> > +AC_ADD_LIBRARY(xmlparse) >> > >> > >> > >> > AC_DEFINE(HAVE_SABLOT,1,[ ]) >> > >> > >> > >> > END NOTE >> > >> > >> > >> >./buildconf >> > >> >./configure --with-mysql=/usr/local/mysql \ >> > >> >--with-sablot=/usr/local \ >> > >> >--with-xml \ >> > >> >--with-apache=../apache_1.3.14 \ >> > >> >--enable-calendar \ >> > >> >--enable-track-vars \ >> > >> >--enable-magic-quotes >> > >> >make >> > >> >make install >> > >> >cp php.ini-dist /usr/local/lib/php.ini >> > >> > >> > >> > >> > >> > >> > >> >---- >> > >> >rsaref >> > >> >---- >> > >> >mkdir rsaref-2.0 >> > >> >cd rsaref-2.0 >> > >> >gzip -dc ../rsaref20.tar.Z | tar xvf - >> > >> >cp -rp install/unix local >> > >> >cd local >> > >> >make >> > >> >mv rsaref.a librsaref.a >> > >> >cd ../.., >> > >> > >> > >> > >> > >> >---- >> > >> >openssl >> > >> >---- >> > >> >gunzip -dc openssl-0.9.6.tar.gz | tar xvf - >> > >> >cd openssl-0.9.6 >> > >> >./config --prefix=/usr/local/ssl \ >> > >> >-Lpwd/../rsaref-2.0/local/rsaref -fPIC >> > >> >make >> > >> >make test >> > >> >make install >> > >> > >> > >> >----- >> > >> >modssl >> > >> >----- >> > >> >gunzip -dc mod_ssl-2.6.4-1.3.12.tar.gz |tar xvf - >> > >> >cd mod_ssl-2.6.4-1.3.12 >> > >> >./configure --with-apache=../apache_1.3.12 >> > >> > >> > >> >----- >> > >> >apache >> > >> >----- >> > >> > >> > >> >SSL_BASE=../openssl-0.9.6 \ >> > >> >RSA_BASE=../rsaref-2.0/local \ >> > >> >./configure \ >> > >> >--enable-module=ssl \ >> > >> >--prefix=/usr/local/apache \ >> > >> >--enable-shared=ssl \ >> > >> >--activate-module=src/modules/php4/libphp4.a \ >> > >> >--enable-module=php4 \ >> > >> >--htdocsdir=/home/www >> > >> >make >> > >> >make certificate TYPE=custom >> > >> >make install >> > >> > >> > >> > >> > >> >> > >> >> > >> -- >> > >> PHP Install Mailing List (http://www.php.net/) >> > >> To unsubscribe, e-mail: php-install-unsubscribe@lists.php.net >> > >> For additional commands, e-mail: php-install-help@lists.php.net >> > >> To contact the list administrators, e-mail: >> php-list-admin@lists.php.net >> > >> >> > > >> > >> > >> > -- >> > PHP Install Mailing List (http://www.php.net/) >> > To unsubscribe, e-mail: php-install-unsubscribe@lists.php.net >> > For additional commands, e-mail: php-install-help@lists.php.net >> > To contact the list administrators, e-mail: php-list-admin@lists.php.net >> > >> >> >> -- >> PHP Install Mailing List (http://www.php.net/) >> To unsubscribe, e-mail: php-install-unsubscribe@lists.php.net >> For additional commands, e-mail: php-install-help@lists.php.net >> To contact the list administrators, e-mail: php-list-admin@lists.php.net >> >

« previous php.install (#703) next »