[PHP] ereg_replace all items in a array

2001-01-29 Thread Joseph H Blythe

G'day PHP'ers

I am trying highlight the results from a search, so far I have this working but only 
if the string is an exact match ie: case sensitive, for example:

" . $val . "";
$replaced = ereg_replace($val, $hilite, $data);
}

echo $replaced;
?>

Now as metioned this seems to work only for "foo" does anyone have any idea why? 

Also I need to be able to support mutiple keywords ie: foo Foo FOO, so basically I 
know I could split(" ", $keywords) then some how traverse the array making a new array 
of all possible case combinations then in my while loop replace each occurance found 
in $data with the highlighted replacment, sounds easy hmm

If anyone has any ideas or can see what I am doing wrong so far, it would be mutch 
appreciated.

Regards,

Joseph

-- 
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] APC install problems

2001-02-07 Thread Joseph H Blythe

Hey,

Does anyone know what is going wrong here:

phpize
autoconf: Undefined macros:
configure.in:43:AC_PROG_LIBTOOL
/usr/local/bin/phpize: libtoolize: command not found

There does not seem to be a libtoolize on my system? I also followed the INSTALL docs, 
and read the online FAQ, unfortunatly I know very little about php-modules and 
autoconf etc..

Any help mutch appreciated,

Regards,

Joseph.

-- 
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] APC install problems

2001-02-07 Thread Joseph H Blythe

On Thu, 8 Feb 2001 01:39:24 +0100
Christian wrote:
CR> 
CR> You'll have to install some packages: libtool, autoconf and automake I'd 
CR> say.
CR> 

Hmm, libtool wasn't installed strange, thanks!

Also I got a few warnings during the compile is this normal?

-snip-
In file included from /usr/local/include/php/php_compat.h:7,
 from /usr/local/include/php/php.h:35,
 from php_apc.h:19,
 from apc_cache.c:24:
/usr/local/include/php/php_config.h:1669: warning: `PHP_BUILD_DATE' redefined
-snip-

Regards,

Joseph.

-- 
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] help with classes

2001-02-12 Thread Joseph H Blythe

hey all,

Was just wondering how to do the following:



So how does one correctly assign a variable to a variable inside a class withot doing 
something like:

var $bar = '';
$this->bar = $foo;

Any insight would be much appreciated.

Regards

Joseph

-- 
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] help with classes

2001-02-12 Thread Joseph H Blythe

On Mon, 12 Feb 2001 20:11:14 -0800
Joe wrote:

JC> 
JC> I was curious too, so I looked it up. Seems you can't. From
JC> http://www.php.net/manual/en/language.oop.php
JC> 
JC> "Note: In PHP 4, only constant initializers for var variables are
JC> allowed. Use constructors for non-constant initializers."
JC> 
JC> Hope this helps,
JC> 
JC> Joe
JC> 

I missed that one little cryptic note :-) 

I basically just made a function that sets the var variable to what I wanted. Unless 
*anyone* knows a better way?

class Foo {
var $bar;

function setBar($bar) {
  this->bar = $bar;
}

}

Thanks for your help!

Regards,


Joseph



-- 
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] help with classes

2001-02-12 Thread Joseph H Blythe

On Mon, 12 Feb 2001 23:44:08 -0500 (EST)
Sean wrote:

SC> 
SC> That's how you have to do it.
SC> 
SC> 
SC> class MyClass {
SC> var $bar;
SC> 
SC> // This is the class's constructor
SC> sub MyClass () {
SC> $this->bar = $foo;
SC> }
SC> }

I didn't think php had sub routines like perl? shouldn't that be:

function MyClass(){
  $this->bar = $foo;
}

I tried this and it does not evaluate the variable. The only way I could get this to 
work was to create a function that I can pass the variable to as one of it paramaters 
(see previous post)

I could be wrong?


Regards


Joseph

-- 
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] help with classes

2001-02-12 Thread Joseph H Blythe

On Mon, 12 Feb 2001 21:04:30 -0800
Joe wrote:

JC> Is this closer to what you were looking for?
JC> - Joe
JC> 
JC>  
JC>  class Foo {
JC> 
JC>  var $bar;
JC> 
JC>  function mymethod(){
JC> 
JC>   global $foo;
JC>   $this->bar = $foo;
JC> 
JC>  }
JC> 
JC> }
JC> 
JC> $foo = "hello world";
JC> 
JC> echo "";
JC> 
JC> $cls = new foo();
JC> $cls->mymethod();
JC> echo $cls->bar;
JC> 
JC> echo "";
JC> ?>
JC> 

hmm sort of is, basically this works:

// Foo.class.php
class Foo {

var $bar;

setBar($bar) {
$this->bar = $bar;
}

}

// foo.php
include("Foo.class.php");
$foo = new Foo;
$bar = "1234567789";
$foo->setBar($bar);

Regards,

Joseph

-- 
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] Fast Template woes

2001-02-13 Thread Joseph H Blythe

Hey all,

I got a rather strange probelm with fast template, I won't go into great detail unless 
someone has had a simular experience while using define_dynamic. Basically I have 
written a site which totally uses Fast Templates and some sections use define_dynamic 
which work perfectly, my problem is I have just added a new section which refuses to 
acknowledge the:




tags (they appear in the final output) I have read all the documentation and am really 
sure that I have done this correctly, even checked the other pages which *are* 
working, no matter what I do this refuses to work, has anyone else run into a simular 
problem?

Any help would be mutch appreciated, I am really stuck on this.

Regards,

Joseph

-- 
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] deleting cart items on session expire

2001-02-14 Thread Joseph H Blythe

hey all,

I was wondering how one would suggest removing items from a cart system once the 
session lifetime has expired. I have it set to the default 0, which expires the 
session on browser close, what I want to be able to do is "delete * from Cart where 
session='$PHPSESSID'" when the user closes thier browser window is this even possible? 
maybe using register_shutdown_function or something?

Any ideas would be great!

Thanks

Joseph

-- 
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] deleting cart items on session expire

2001-02-15 Thread Joseph H Blythe

Thanks all,

This gives me a good start, I think I will just get cron to do it at a certain time of 
day, the only problem is trying to tell which sessions have expired as the database is 
not going to know this.

Regards

Joseph

-- 
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] checking to see if value is a integer from a form text field

2001-02-15 Thread Joseph H Blythe

hey,

I have a strange problem, when a user inputs the quantity into a text input field in a 
cart, I want to be able to test to see if the value is a integer if it isn't then 
default it to 1

if ( !is_int($Qty) ) {
$Qty = 1;
}

Looks ok, should work in theory, but it doesn't if I use this test, the update on the 
database fails, take it out and it works, so if a user was to type "f" in the quantity 
field in the cart and hit update because the quantity field is int(2) in the database 
it will default to 0 which I do not want. I have also tried to set the type before the 
update like so:

$Qty = settype($Qty, "integer");

This also will make the update fail, how would I make sure a user does not type 
characters in the quantity field without using  javascript or ereg stuff to check the 
values? I just want to default the quantity to 1 if a invailid quantity is inputted.

If there is no obvious soulution then I will use a piece of javascript to check the 
field onSubmit for illegal characters and alert the user I guess.

Regards,

Joseph

-- 
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] About to update

2001-02-15 Thread Joseph H Blythe

Hey all,

I am about to update one of our servers (i386) running RedHat-6.0 smp to:

Apache-1.3.17
MySQL-3.23.33
ModSSL-2.8.0-1.3.17
PHP-4.0.4pl1
ZendOptimizer-1.0.0-4.0.4

Does anyone know of any problems/incompatabilities between the above packages on the 
above platform.

I am mainly doing this because of a bug in one of the mysql utils (mysqlimport) it 
dumps a core on exit in mysql-3.23.22, and thought I may as well update the whole lot 
and be done with it.

Regards

Joseph

-- 
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] About to update

2001-02-18 Thread Joseph H Blythe

On Fri, 16 Feb 2001 10:59:52 -0500
Michael wrote:

MK> 2 things...
MK> 
MK> 1.  I've had nothing but problems with mysql3.23.  :(  I had 3.22 up for months at 
a stretch - I'm lucky to go more than a few weeks without a lockup on 3.23.  BUT... 
I've committed projects to
MK> the fulltext search feature.  :(  Just be careful and keep an eye on it.  Not 
really related to your question, but I had to bitch.  :)
MK> 
MK> 2.  Instead of the zend optimizer, think of trying the apc cache.  It'll give you 
much better performance results than the optimizer, and is cheaper than zend cache.  
apc.communityconnect.com
MK> 

Thanks for your feedback, mysql3.23 is now a stable release that seems strange, I 
tried to install apc but I keep getting unresolved symbol errors, so apache fails to 
start. What version of php are you using?

Regards,

Joseph.

-- 
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:mod_dav and dreamweaver 4.0

2001-02-27 Thread Joseph H Blythe

Hello,

Sorry if this is a little off topic but has anyone successfully used mod_dav with 
dreamweaver 4.0, I have mod_dav setup but am having trouble connecting to it via 
dreamweaver.

If anyone has successfully used this could they email me privately, as I don't want to 
waste any more bandwidth on this list.

Cheers,

Joseph

-- 
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] Template recommendations

2001-02-28 Thread Joseph H Blythe

Hey all,

I am developming a site using FastTemplates, but I have run into a problem which it 
looks like I will not be able to resolve, I have posted to this list and the makers of 
FastTemplate but have recieved no clues on what is going on.

I have decided to try and find another template system and rewrite the entire site. 
Can people who use such systems let me know thier findings, the template system must:

Be a php class
Totally separate html from php code
Be able to handle *dynamic* blocks of code (ala FastTemplate)
Not be phplib (sorry I have tried and dont like the autoprepend)
Be easy to use
Be Fast

Any comments will be appreciated,


Regards,


Joseph

-- 
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] Template recommendations

2001-03-01 Thread Joseph H Blythe

On Thu, 1 Mar 2001 07:58:23 +0100
Alexander wrote:

AW> If you want something faster, try Smarty.

Thanks, Smarty looks like it will do the trick and has some really neat features, like 
being able to nest dynamic blocks, I think this was my problem with FastTemplate.

Regards,

Joseph

-- 
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]