[PHP] building CLI version only

2004-03-22 Thread neko
Hey guys,

A server I'm using has PHP compiled into Apache, and I want to leave 
that alone and just build a CLI version of php. Can I get away with just 
going:

./configure --with-mysql --prefix=/some/home/dir
make
make install
? I dont' want to upset the existing apache installation of PHP or 
anything, just want a CLI exe in my home dir to do some stuff with.

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


[PHP] Connection handling and output_buffering

2004-02-23 Thread neko
Hi guys,

Was reading through:
http://uk.php.net/manual/en/features.connection-handling.php
And I was wondering how PHP handles script termination when you have 
'output_buffering = On' in your php.ini?

If I have a long script that does lots of database stuff for example, 
and is riddled with echo() function calls, how will php handle a user 
clicking stop in their browser half way through?

I'm guessing that it WILL continue execution to the end, then when you 
send the buffer back to the client it determines that the client stopped 
the request and it terminates.

I guess some simple testing will suffice!

Neko

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


[PHP] Re: Web Service in PHP/XML

2003-10-31 Thread neko
And if you can't be arsed with SOAP, try XML-RPC, which does the job for 
me. Check PEAR for an implementation, or try Keith Deven's library, 
which is easy to use (you only deal with PHP types, and leave the XML to 
 the library)

http://keithdevens.com/software/xmlrpc/

-neko

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


[PHP] tips on sorting an array of objects by an attribute?

2003-03-28 Thread neko
Hi Guys, Just after some experience...

What's the best way to sort an array of objects by one of their attributes,
accessed by $obj-getFoo() (its a number) ? I was thinking a bubble-sort,
making multiple passses and switching array elements until there are no more
switches to make.

Any tips? The array size is not very large (not will it ever be), so it's
doesn't have to be a super-lean sorting algorithm (no harm though ;) )

cheers,
neko



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



[PHP] Re: php web indexer?

2003-03-13 Thread neko
If anyone's interested, I integrated phpdig into my site. Seems to work
quite well, and only took me a few hours to integrate it with the site's
framework.

nice!

neko



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



[PHP] php web indexer?

2003-03-12 Thread neko
Hi guys,

I'm looking for a PHP/MySQL based http site indexer - I won't want to do
filesystem searches, I want to do something like a standard web search
engine (like google) performs for my site.

I was hoping to make use of an existing search engine (open source) rather
than write a custom search module for my site. I was looking at products
like:

lucene (java I know, and text based indexer)
http://jakarta.apache.org/lucene/docs/index.html

htdig - looks interesting, but no windows distribution except through cygwin
(I think)
http://www.htdig.org/

PhpDig - lots of french scattered about, couldn't get it to work properly
(suspect doesn't run on php 4.3.x)
http://phpdig.toiletoine.net/

At the moment, I'm leaning towards just doing an on-the-fly fulltext search
in mysql of my content field in my CMS, but I was keen to see if I could
find a generic http indexer for better results more quickly.

cheers,
neko



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



[PHP] reversing attribute in array of objects

2003-03-11 Thread neko
I have a bit of a good one for you guys:

I have an array of objects which have an attribute $level (I use
$obj-get/setLevel() to access it).

Now, this array consists of these objects with $level in descending order,
and the same $level int can be set to multiple objects (in order), eg:

$objArr[0]-level = 5
$objArr[1]-level = 5
$objArr[2]-level = 4
$objArr[3]-level = 3
$objArr[4]-level = 2
$objArr[5]-level = 2
$objArr[6]-level = 2
$objArr[7]-level = 1

what I want to do is to reverse the $level attribute for the objects (not
the objects themselves!!!) in the array by using the $level attribute, so in
this case I'd end up with:

$objArr[0]-level = 1
$objArr[1]-level = 2
$objArr[2]-level = 2
$objArr[3]-level = 2
$objArr[4]-level = 3
$objArr[5]-level = 4
$objArr[6]-level = 5
$objArr[7]-level = 5

Any tips on this one?

--
cheers,
neko



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



[PHP] eval challenge

2003-03-04 Thread neko
- define a string that has a function call in it (that returns a string)
that at the time of declaration is not in scope, eg

$str = this is the name : \$node-getName(); // $node is _not_ defined
currently, so we can't escape out



then, later on in the code, this string will be passed to a function that
has $node in scope, and that's when I want to eval the string to replace the
value.

$node = new Node($argwhatever);
eval(\$str=\$str\;); // $node is now in scope, so I'd really like
$node-getName to return something meaningful

Anyone able to solve this one? Yesterday I could achieve most other
requirements with eval, but this one has me stumped.

cheers,
neko



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



Re: [PHP] eval challenge

2003-03-04 Thread neko
Thanks for your time, Dan.

Currently, I'm using defined tags for replacing info from my CMS, eg:

$str = ofa-core:siteMapLink/

Then I have a function that has all the objects in scope, and can perform
the necessary replacements.

I am prototyping some stuff with smarty, but so far have yet to see how it
benefits over my current implementation. I don't have to to worry about
non-technical persons building/maintaining the site, so I'd rather stick
with include() to build my pages from templates/blocks/content.

As I learn more about smarty, I might use it to power the presentation layer
of my CMS, but only when I can see a long-term benefit from using it. My cms
makes use of presentation logic components, which you supply microtemplates
to  in order to produce the final output. These components can reside within
templates, so currently my html redundancy is minimal.

cheers,
neko



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



Re: [PHP] eval challenge

2003-03-04 Thread neko
 ok ... what would ofa-core:siteMapLink/ represent?
 The output of $ofa-core-siteMapLink();?

 If your using XML throughout - have you looked at XSLT transformations?

It's just a symbolic name - the output is created from a few different
objects within the CMS, but it was such a commonly used set of data requests
that I make a tag up to handle them all at once, to make it a bit cleaner.

XSL/XSLT is on my to prototype list ;)

neko



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



[PHP] Re: PHP OOP design question

2003-03-04 Thread neko
Answer - use PEAR for both your database connection and as a data modeling
layer:

http://pear.php.net

check the documentation for more info.

neko

Joseph Szobody [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I have several web projects that are all database driven. I have recently
been diving into OOP, and rewriting a lot of procedural code in OOP. I have
a design question about handling the MySQL connection.





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



[PHP] eval help

2003-03-03 Thread neko
Hi guys,

My current task involves passing a string into a function that is able to
reference variables defined within that function for the final output. The
idea is that a function iterates through objects and eval's the string so
that the objects data (name etc) is substituted in the string.

Currently I have something like this:

$someVar = brtesting for node - wootah, \$evalTestArr[TAG_PAGENAME]


then in some other function that gets passed this string
...

$evalTestArr[TAG_PAGENAME] = hello anna marie gooberfish!;
$str = $someVar;
eval(\$str=\$str\;);

if I echo it out, the substitution is not done.

any thoughts? I'm reading through
http://www.php.net/manual/en/function.eval.php but yet to be inspired.




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



[PHP] Re: eval help

2003-03-03 Thread neko
note that the following php:

?php
/*
  eval testing
  SM 3/3/2003 1:28PM
*/

$name = Scott;
$arr[] = Dude;
$arr2[name] = Broness!;

echo($arr2['name']); // test

$str  = brHello, $name;
$str2 = brHello, $arr[0];
$str3 = brHello, $arr2['name'];

eval (\$evaldString = \$str\;);
echo $evaldString;

eval (\$evaldString = \$str2\;);
echo $evaldString;

eval (\$evaldString = \$str3\;);
echo $evaldString;

?

produces:

Broness!brHello, ScottbrHello, DudebrHello,

--

note that the last cannot be seen - I'm sure I'm almost there, but I have to
be able to reference an associative array.

Scott



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



Re: [PHP] Re: eval help

2003-03-03 Thread neko
Thanks Dan - I just worked this out before reading your solution! :)

$str4 = brHello, .$arr2['name'];

cheers and thanks to all - lets see how that goes within my framework now :)

neko



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



[PHP] Re: eval help

2003-03-03 Thread neko
Actually, I just realised that what I want to accomplish is different from
my example - the main issue is with scope:

?php
/*
  eval testing 3
  SM 33/3/2003 2:32PM
*/

func1();

function func1()
{
  echo(brwe're in the pipe, 5-5-5.);

  $str  = brHello, \$name;
  $str2 = brHello, \$arr[0];
  $str3 = brHello, \$arr2['name'];

  echo doEvalWithVarsInScope($str);
  echo doEvalWithVarsInScope($str2);
  echo doEvalWithVarsInScope($str3);
}

function doEvalWithVarsInScope($str)
{
  echo(brtrying to eval for str=$str);

  $name = Scott;
  $arr[] = Dude;
  $arr2[name] = Broness!;

  eval (\$evaldString = \$str\;);
  return $evaldString;
}

?

--

will produce:

we're in the pipe, 5-5-5.
trying to eval for str=
Hello, $name
Hello, Scott
trying to eval for str=
Hello, $arr[0]
Hello, Dude
trying to eval for str=
Hello, $arr2['name']
Hello,

--

any (more) help is greatly appreciated.

cheers,
neko



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



[PHP] Re: eval help

2003-03-03 Thread neko
?php
/*
  eval testing 3
  SM 33/3/2003 2:32PM
*/

define(NAME_TAG, name);
func1();

function func1()
{
  echo(brwe're in the pipe, 5-5-5.);

  $str  = brHello, \$name;
  $str2 = brHello, \$arr[0];
  $str3 = brHello, \$arr2[.NAME_TAG.];

  echo doEvalWithVarsInScope($str);
  echo doEvalWithVarsInScope($str2);
  echo doEvalWithVarsInScope($str3);
}

function doEvalWithVarsInScope($str)
{
  echo(brtrying to eval for str=$str and NAME_TAG:.NAME_TAG);

  $name = Scott;
  $arr[] = Dude;
  $arr2[NAME_TAG] = Broness!;

  eval (\$evaldString = \$str\;);
  return $evaldString;
}

?

--

produces:


we're in the pipe, 5-5-5.
trying to eval for str=
Hello, $name and NAME_TAG:name
Hello, Scott
trying to eval for str=
Hello, $arr[0] and NAME_TAG:name
Hello, Dude
trying to eval for str=
Hello, $arr2[name] and NAME_TAG:name
Hello, Broness!

--

done, but it's uglier than I was hoping :(



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



[PHP] Re: eval help

2003-03-03 Thread neko
ok - my latest in the eval saga is this:

I want to be able to eval a function call anywhere in the string supplied,
and the function call is not in scope when the string is defined.

So

-- somewhere in my code I wanted something like this:

$string = brtesting nodename: \$node-getName()
pagename:\$nodePageTags[.TAG_PAGENAME.];

-- where the code is evaled eventually, there is a $node object defined, so
the function call should work. Of course, that currently does not work :)

cheers,
neko



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



[PHP] quick check - by ref vs by value with objects

2003-02-28 Thread neko
Hi guys,

If I have an object that has another object as a variable (eg, a dbConn
object), then I create another object and pass this dbConn in the
constructor, if that second class sets that arg to it's own variable, is it
true in 4.3.1 that they will NOT be sharing the same object reference?

I this I think is different in the zend 2.0 engine - see here:

http://www.zend.com/images/press/Feb_2003-4_Zeev_PHP5.pdf

But anyway, if I want each of the 2 classes to each point to the same dbConn
object, does that mean I have to write the constructor as

function secondClass($dbConn)
{
$this-db = $dbConn;
}


?

cheers,
neko



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



[PHP] what are the planned features of php 5?

2003-02-26 Thread neko
I read something a while back about more OO features, but I was wondering if
there is a roadmap anywhere?

cheers,
neko



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



[PHP] emailing a web-page

2003-02-24 Thread neko
Hi guys,

I want to automate the process of connecting to a web-page and sending it as
a HTML email (like a weekly newsletter in html).

I've been reading up a bit on PEAR's Mail_mime
(http://pear.php.net/manual/en/core.mail.mime.php) but I just wanted to know
what the fastest way to accomplish my requirement is from your collective
experience?

thanks,
neko



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



Re: [PHP] emailing a web-page

2003-02-24 Thread neko
 is it a webpage you create with php or is it a webpage that you get from
 just any site?

It's a dynamically generated page on my site - I wanted to just include the
url's contents into a string, or something. So no I can't cheat and just
grab from the filesystem :)

cheers,
neko



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



[PHP] Re: emailing a web-page

2003-02-24 Thread neko
update:

I think I just need to work out how to grab a web-page and include it into a
string to supply to the mail I'm generating (using pear). Provided that the
hyperlinks aren't relative I should have a funky looking email going on..

neko

Neko [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi guys,

 I want to automate the process of connecting to a web-page and sending it
as
 a HTML email (like a weekly newsletter in html).

 I've been reading up a bit on PEAR's Mail_mime
 (http://pear.php.net/manual/en/core.mail.mime.php) but I just wanted to
know
 what the fastest way to accomplish my requirement is from your collective
 experience?

 thanks,
 neko





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



[PHP] Re: emailing a web-page

2003-02-24 Thread neko
http://www.php.net/manual/en/function.file-get-contents.php

I was thinking of using this, however the website I want to pull the HTML
from uses relative links, so that places me in a pretty pickle if I want to
have the email make use of stylesheets and images.

:)

neko_

Arjan Gijsberts [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 That shouldn't be a problem. You could use fopen() to open the file.

 Neko [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  update:
 
  I think I just need to work out how to grab a web-page and include it
into
 a
  string to supply to the mail I'm generating (using pear). Provided that
 the
  hyperlinks aren't relative I should have a funky looking email going
on..
 
  neko
 
  Neko [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
   Hi guys,
  
   I want to automate the process of connecting to a web-page and sending
 it
  as
   a HTML email (like a weekly newsletter in html).
  
   I've been reading up a bit on PEAR's Mail_mime
   (http://pear.php.net/manual/en/core.mail.mime.php) but I just wanted
to
  know
   what the fastest way to accomplish my requirement is from your
 collective
   experience?
  
   thanks,
   neko
  
  
 
 





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



[PHP] Re: emailing a web-page

2003-02-24 Thread neko
Question : When people send you junk e-mails they often have image refs and
so forth - does that mean they are using absolute links in the img refs?

I need to find a way to allow a non-technical user to quickly and easily
send off a web-page (generated on the fly) in email format, but so far I'm
still working out the particulars of sending as HTML with additional
resources (images, stylesheets).

neko_



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



[PHP] Re: emailing a web-page

2003-02-24 Thread neko
 4) Easy to do for anyone, even for you, it's simple.

Thanks for that sly jab ;)

neko_



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



[PHP] Re: Failed to initialize session module

2003-02-20 Thread neko
got it, had to change

session.save_handler = files
;session.save_handler = user

to files - my bad!

neko



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




[PHP] Re: smarty vs. patTemplate vs. includes - newbie q

2003-02-20 Thread neko
A great article on PHP and template engines can be found here:

http://phppatterns.com/index.php/article/articleview/4/1/1/

The opinon of the author is that template engines might not be worth your
time, and I'm inclined to agree. I'd rather develop a more comprehensive CMF
which limits what the user can design in other ways, rather than use some
template engine like smarty or velocity. To me, templates just seem like a
dumbed-down language - not that useful in my opinion.

neko



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




[PHP] Default argument values

2003-02-17 Thread neko
Hey All,

I've been trying to write a function that accepts multiple optional 
parameters, some of which are ints. The function signature looks like this:

function blahBlah($fromDate, $toDate = 0, $limit = 20, $limitNodeType = 
null)

I've been reading up here:

http://www.php.net/manual/en/functions.arguments.php

But it doesn't describe what to do with multiple optional arguments. Can I 
call the function like this:

blahBlah($date, null, null, $limitNodeType);


?

Need some help getting this language feature sorted.

cheers,
neko

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




[PHP] Re: getting database connection to fail gracefully

2003-01-22 Thread neko
Andy Clarke wrote:

Is there a way to get a database query to fail gracefully, so that rather
than calling Die(), it can work around the problem? In other words, to do
something like:


Another option is to make use of PEAR's DB support in your code, rather 
than using the mysql_ functions directly. This will provide a much 
better framework for database connectivity/use in general.

http://pear.php.net - check out the manual.

neko


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



[PHP] php obj - xml ?

2003-01-15 Thread neko
Just wanted some opinions on the best way to produce well-formed xml from a 
php object. In my case, I was toying with the idea of a generic way to 
product an xml file from a PEAR DataObject - the idea being that a 3rd 
party requests data, I extract from mysql using Pear's DataObjects, then 
tell that objects to produce xml (or pass it to a transformer or 
something).

Links? Ideas? Recommendations from RL experience?

cheers,
neko

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




[PHP] resolving php tags in a string

2002-02-22 Thread neko

I have a question: I normally use include to include a file, which often has
php tags that are then interpreted and resolved.

However, in one case I am reading a text file into a string (fread), then
running nl2br() on it to present it (with an echo command).

However, I wish to also resolve any php tags, which obviously aren't in this
case and are just presented in the browser as plain text.

What's the best way to solve this one? First thought was to write it to a
temporary file and then call an include on that, but that sounds plain bad.

neko

--
The secret of genius is to carry the spirit of the child into old age,
which means never losing your enthusiasm.
   -- Aldous Leonard Huxley



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