[PHP] preg_replace works on normal string but not with a string build from a file
hi, take a look at the following code basic problem is, it works with the custom build string in the script but not if get the code from a file. I allways used ereg_replace but after installing a newer version of php (4.2.2) it became very slow, so now I'm trying preg_replace please help !!! kind regards Jeroen olthof, '; $closetag = ''; // building the string in this script will give the wanted result $string = ''; $string .= 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>'; $string .= 'http://www.w3.org/1999/xhtml";>'; $string .= ''; $string .= 'Untitled Document'; $string .= ''; $string .= ''; $string .= ''; $string .= ''; $string .= ''; $string .= ''; $string .= ' '; $string .= 'aaa'; $string .= 'aaa'; $string .= 'aaa'; $string .= 'aaa'; $string .= ' '; $string .= ''; $string .= ''; $string .= ''; $string .= ''; // building the string from a text file won't give the wanted result; // uncomma the next file for testing // $string = implode(false,@file('./loadlooptest2.html')); echo "--result--\n\n\n"; echo $result = preg_replace("/.*$opentag(.*)$closetag.*/", '\\1',$string); echo "\n\n\n--modified\n\n\n"; echo $modified_template = ereg_replace("$opentag.*$closetag", '{replaced}', $string); ?> here is the xhtml file (copy past it in a file called loadlooptest2.html) http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";> Untitled Document aaa aaa aaa aaa aaa aaa aaa aaa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace works on normal string but not with a string build from a file
Thx, I had created a workarround, withs was looping through every line of the file and doing a rtrim. But your hint pointed me to the better solution The modifier m alone didn't do the job, because I uses a dot to match any character. But without the s modifier it will not match a new line. So both modifiers gets it all to work! Thx for the tip! Kind regards Jeroen Olthof, "John W. Holmes" <[EMAIL PROTECTED]> schreef in bericht 000801c29af6$a1a28450$7c02a8c0@coconut">news:000801c29af6$a1a28450$7c02a8c0@coconut... > > take a look at the following code > > basic problem is, it works with the custom build string in the script > but > > not if get the code from a file. > > I allways used ereg_replace but after installing a newer version of > php > > (4.2.2) it became very slow, so now I'm trying preg_replace > > > > please help !!! > > kind regards Jeroen olthof, > > > > > $opentag = ''; > > $closetag = ''; > > > > // building the string in this script will give the wanted result > > $string = ''; > [snip] > > $string .= ''; > > > > // building the string from a text file won't give the wanted result; > > // uncomma the next file for testing > > // $string = implode(false,@file('./loadlooptest2.html')); > > > > echo "--result--\n\n\n"; > > echo $result = preg_replace("/.*$opentag(.*)$closetag.*/", > '\\1',$string); > > echo "\n\n\n--modified\n\n\n"; > > echo $modified_template = ereg_replace("$opentag.*$closetag", > > '{replaced}', > > $string); > > Well, that string and the file aren't exactly the same. The file has > newlines in it, the string you're creating does not. So in the string, > it's all on the same line, while it's on separate lines in the file. > > Preg_replace may be looking for that pattern on a single line. The /m > modifier may help in this circumstance, I'm not sure though. > > ---John Holmes... > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XTemplate
http://www.millipede.nl/ectemplate very fast!! , no overhead functions, it does what it needs to do, separate your code from the html. take a look greetings, "Henry" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi All, > > I'm looking for a way to seperate my HTML from my PHP and database access > code, I pointed in the direction of XTemplate. After having had a look at > XTemplate I'm not sure if it is current and stable under PHP 4 Is it and > if it isn't is there something better to use? > > Henry > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to trigger incomming mail
hi, I'm building a online shop where people are able to pay online. The pay part is done by a external company who sends mail to a specifeid mail address when orders are placed and when orders are succesfully payed. both mails contains a order nummer in subject. now what I want is to automaticly match those 2 mail so I can write in a mysql database that the order is payed. I'd made a mail address payment@ on this mail I want to trigger mail incomming on this adres so I can start a php script that filters this standaard mail getting the order code and put in in a database with status incompleet and when another mail arrives on the payment address, filter order nummer again so I can look in the database to see if it there, to compleet the payment kind regards Jeroen Olthof -- 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] who added the damn slashes?
Hi, The problem: I don't use addslashes($) but somehow that is what happens to my posted data The situation: I'm building a wizard like form that read all posted data (HTTP_POST_VARS, HTTP_GET_VARS etc..) and puts it in an array that is registerd in a session. This gives me the possibility to use back en next in the wizard form. But every time the slashes are added ! What is the solution PHP version 4.0.3pl1 server is running a slash admin interface (so upgrading is a bit difficult) what to do , to avoid those auto addslasshes ??? kind regards Jeroen Olthof -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Don't tell me this isn't possible (object related question)
hi, let's say I have made some objects $content = new Content(); and in object content a new object is created $person = new Person("Jeroen"); Person holds a var age Now I want to do something like this in a normal PHP script echo $content->getPerson("Jeroen")->getAge(); or since PHP doesn't use private / prublic / etc.. echo $content->getPerson("Jeroen")->age; the point is , getPerson("Jeroen") returns an object. this object contains the function getAge() which return the var age but somehow this constuction isn't possible ? Why ... or is it but is there a strange syntax kind regards Jeroen Olthof -- 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] string replace using ereg
hi, I want to replace strings in string using a key / value array as the replacemant contract basicly, I want to find a open en close tag, pick out the word in the middle and replace it by the value of the key that match the picked out word. example <> <> should result in this is a test this is a test well, The below code works for only one replacement cause when I add another on the same line. it will pick out test>> < "this is a test" ) $OPENTAG = "<<"; $CLOSETAG = ">>"; while ($line[$i]) { ereg($OPENTAG."([^*]*)".$CLOSETAG, $line[$i], $regs); $newString .= str_replace($this->OPENTAG.$regs[1].$this->CLOSETAG, $ASSIGN[$regs[1]], $line[$i]); } -- 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] regexp. king needed (is it possible ???)
ereg_replace("$opentag([^*]*)$closetag", $this->OPENTAG.$loopHandle.$this->CLOSETAG, $template); how do I get al hold on the "\\1" part of the replacement. basicly I want to replace opentag1 .any content in between .. closetag1 with opentag2 onewordonly closetag2 but still need the .any content in between .. is this possible in some way ??? kind regards Jeroen Olthof -- 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] regexp. king needed (is it possible ???)
thanks my king :) it works !!! "Adrian Ciutureanu" <[EMAIL PROTECTED]> schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... $content = ''; $new_str = '' > -Original Message- > From: Jeroen Olthof [mailto:[EMAIL PROTECTED]] > Sent: 17 iulie 2001 17:38 > To: [EMAIL PROTECTED] > Subject: [PHP] regexp. king needed (is it possible ???) > > > ereg_replace("$opentag([^*]*)$closetag", > $this->OPENTAG.$loopHandle.$this->CLOSETAG, $template); > > how do I get al hold on the "\\1" part of the replacement. > basicly I want to replace > > opentag1 .any content in between .. closetag1 > > with > > opentag2 onewordonly closetag2 > > but still need the > > .any content in between .. > > is this possible in some way ??? > > kind regards > Jeroen Olthof > > > > > > -- > 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]
[PHP] Just like to know
hi, here's a little question. I like to know what is better and WHY ?? $string = "bla bla $somevar bla bla bla $somevar$somevar bla"; of $string = "bla bla ".$somevar." bla bla bla ".$somevar.$somevar." bla"; kind regards Jeroen Olthof -- 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] change user after uploading file using a form
hi, I'm using the form file object for uploading a file because php using ftp isn't supported on my provider but everthing ok so far. Now the http user (lets say the user that php is running on) is owner of the file, I want to change this to the user I am (the ftp user) hosting is running linux and I'm a real user there. is it possible to change user ? kind regards Jeroen Olthof -- 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] ob_start()
Can I increase speed by using this to buffer output ? kind regards Jeroen Olthof -- 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] adding functions to a class
hi, picture I have a class with some variable holding the information of this class. Now there are some functions to manipulate the vars. well, you nou what classes are about. but now I want to add functions that are located in a different php file. but this functions need to use the the var of the class. bassicly what a want is extends the original class with more functionalities like. you could see it as adding plug-ins in a program. So I don't want to just copy past the functions in the original class file. class a { var VAR1 var VAR2 var VAR3 require(morefunctions.php); function a($param) { .. } function test2($param) { .. } } the require(morefunctions.php); will ofcource not work but bassicly this is what I want. en all the functions added should be able to use VAR1 VAR2 VAR3 (and the other functions that are allready in the class) is there a why to do this ?? kind regards Jeroen Olthof -- 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] adding functions to a class
how stupid of me, ofcourse extends does the trick, thanks ! but one little question, somehow classname::function() works but parent::function() doesn't seem to work ??? "Sean C. McCarthy" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > What you are looking for is the OOP class extension. Look for "extends". > > Sean C. McCarthy > SCI, S.L. (www.sci-spain.com) > > > Jeroen Olthof wrote: > > > > hi, > > > > picture I have a class with some variable holding the information of this > > class. Now there are some functions to manipulate the vars. well, you nou > > what classes are about. but now I want to add functions that are located in > > a different php file. but this functions need to use the the var of the > > class. > > > > bassicly what a want is extends the original class with more functionalities > > like. you could see it as adding plug-ins in a program. So I don't want to > > just copy past the functions in the original class file. > > > > class a { > > > > var VAR1 > > var VAR2 > > var VAR3 > > > > require(morefunctions.php); > > > > function a($param) { > > .. > > } > > > > function test2($param) { > > .. > > } > > } > > > > the require(morefunctions.php); will ofcource not work but bassicly this is > > what I want. en all the functions added should be able to use VAR1 VAR2 VAR3 > > (and the other functions that are allready in the class) > > > > is there a why to do this ?? > > > > kind regards > > Jeroen Olthof > > > > -- > > 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]
[PHP] Undefined class name 'parent'
when I use parrent::function() to use parent class function from the child (extended one) I get Undefined class name 'parent' What I'm I doing wrong kind regards Jeroen Olthof -- 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] parent failer ?
hi, again (sorry) when I run this code (straight from the manual) \n"; } } class B extends A { function example() { echo "I am B::example() and provide additional functionality.\n"; parent::example(); } } $b = new B; // This will call B::example(), which will in turn call A::example(). $b->example(); ?> the result wil be I am B::example() and provide additional functionality. Fatal error: Undefined class name 'parent' test.php on line 15 what is going wrong here ??? kind regards Jeroen Olthof -- 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] Re: parent failer ?
btw. it works on a other server so it should be something in server configuration I use PHP Version 4.0.1pl2 configuration string './configure' '--target=i386-redhat-linux' '--prefix=/usr' '--with-config-file-path=/etc' '--disable-debug' '--enable-pic' '--enable-inline-optimization' '--with-apxs=/usr/sbin/apxs' '--disable-static' '--with-exec-dir=/usr/bin' '--with-regex=system' '--with-gettext' '--with-gd' '--with-jpeg-dir=/usr' '--with-png' '--with-zlib' '--with-db2' '--with-db3' '--with-gdbm' '--enable-debugger' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-yp' '--enable-ftp' '--without-mysql' '--with-xml' "Jeroen Olthof" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hi, again (sorry) > > when I run this code (straight from the manual) > > class A > { > function example() > { > echo "I am A::example() and provide basic functionality.\n"; > } > } > > class B extends A > { > function example() > { > echo "I am B::example() and provide additional > functionality.\n"; > parent::example(); > } > } > > $b = new B; > > // This will call B::example(), which will in turn call A::example(). > $b->example(); > > ?> > > the result wil be > > I am B::example() and provide additional functionality. > > Fatal error: Undefined class name 'parent' test.php on line 15 > > what is going wrong here ??? > > kind regards > Jeroen Olthof > > -- 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] NEW !! ecTemplate !! NEW
http://www.millipede.nl/ectemplate/ hi, I was inspired by fasttemplate. the idea of separate your HTML code from the PHP code. but when I first start usinging fasttemplate, it removed all my javascript function definitions. This was a reson for me to do a rewrite in my own way. starting from scretch I build up ecTemplate and using it now in real life website. it called ecTemplate (easyTemplate) because it's really easy to use. try it out !!! please use the comminucation board to let me know what u think of the ecTemplate construction ! http://www.millipede.nl/ectemplate/ kind regards Jeroen Olthof Netherlands -- 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] ecTemplate !!!
try it out and let me know what u think of it please ?! http://www.millipede.nl/ectemplate kind regards Jeroen Olthof -- 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] ecTemplate
hi, I would like te announce a really good html template parser class. How it works. Normally your HTML and PHP codes are mixed and therefor you are not able to use tools like dreamweaver anymore. Well with ecTemplate you can define to types of tags that you can put inside your html file. for example variable style {aName} loop style so your html file can look like this {title} {var_1}{var_2} the ecTemplate class is going to parse the html file and replaces the code special tags with te result of your php code. Just try it out and you will see it works really handy look here for a live excample http://www.millipede.nl/ectemplate greetings Jeroen Olthof -- 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] ecTemplate
I can't really anwser that question since I have never used that template system, I have writen this one to meet my exact needs and it is turned out to work really good. If you got any experience with the PHPLIB's template system, I really curious what you would think of it so I can get deserving response ??? "Joao Prado Maia" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Mon, 24 Sep 2001, Jeroen Olthof wrote: > look here for a live excample > http://www.millipede.nl/ectemplate > And how is ecTemplate different from PHPLIB's Template system ? It looks like the same thing to me.. Joao -- João Prado Maia <[EMAIL PROTECTED]> http://phpbrasil.com - php com um jeitinho brasileiro -- Precisando de consultoria em desenvolvimento para a Internet ? Impleo.net - http://impleo.net/?lang=br -- 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] SDO_DAS_Relational limitations
Hi, I'm looking into the SDO implementations and walked into the limitations very quickly. Limitations: - No composite key possible - Only one Foreign key per table - No way of setting up a many to many relationschip My models violates mostly and most likely all of this limitations. So I ask myself. Is it usefull or don't I understand the stratergy? what to do with the many to many relationships, the composite keys and multiple foreignkeys per table ??? kind regards Jeroen Olthof -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php