[PHP] Re: using mysql_close() = best practice?

2009-10-26 Thread Eric Bauman

On 24/10/2009 7:36 PM, Kim Madsen wrote:

Hi

PHP closes an open db connection when the script is done.

I've read somewhere that in PHP6 this behaviour will dissapear, is this
true? In that case using mysql_close() would definetly be best practice
in all current scripts, to make it portable.

A nice solution would probably be adding a end_mysql() or page_end() to
all pages and put whatever is needed into that function (mysql_close,
mysql_free_result, etc)



I can't say with any certainty whether that is true or not - but it 
certainly seems like it is false. Non-persistent connections are 
destroyed automatically by the garbage collector when no more references 
are detected. See 
http://au2.php.net/manual/en/language.types.resource.php#language.types.resource.self-destruct


That said, I believe it to be good practice to close any opened database 
connection. All my database methods are wrapped in a class, however, so 
I do this in the destructor.


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



[PHP] What is the best practice for adding persistence to an MVC model?

2009-10-26 Thread Eric Bauman
I'm in the process of implementing an ultra-light MVC framework in PHP. 
It seems to be a common opinion that the loading of data from a 
database, file etc. should be independent of the Model, and I agree. 
What I'm unsure of is the best way to link this "data layer" into MVC.


I've considered a few options:

*Datastore interacts with Model*

//controller
public function update()
{

 $model = $this->loadModel('foo');
 $data = $this->loadDataStore('foo', $model);

 $data->loadBar(9); //loads data and populates Model
 $model->setBar('bar');
 $data->save(); //reads data from Model and saves

}

*Controller mediates between Model and Datastore*

Seems a bit verbose and requires the model to know that a datastore exists.

//controller
public function update()
{

 $model = $this->loadModel('foo');
 $data = $this->loadDataStore('foo');

 $model->setDataStore($data);

 $model->getDataStore->loadBar(9); //loads data and populates Model
 $model->setBar('bar');
 $model->getDataStore->save(); //reads data from Model and saves

}

*Datastore extends Model*

What happens if we want to save a Model extending a database datastore 
to a flatfile datastore?


//controller
public function update()
{

 $model = $this->loadHybrid('foo'); //get_class == Datastore_Database

 $model->loadBar(9); //loads data and populates
 $model->setBar('bar');
 $model->save(); //saves

}

*Model extends datastore*

This allows for Model portability, but it seems wrong to extend like 
this. Further, the datastore cannot make use of any of the Model's methods.


//controller extends model
public function update()
{

 $model = $this->loadHybrid('foo');  //get_class == Model

 $model->loadBar(9); //loads data and populates
 $model->setBar('bar');
 $model->save(); //saves

}



Any input on the "best" option - or alternative - would be most appreciated.

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



Re: [PHP] Strange behaviour with uploaded files .. XAMPP on Windows

2009-10-26 Thread Angus Mann
Yep, you were right. When I look, now I see that the permissions for the 
file are different to locally created files.


Thanks for that !







Yeah, definitely sounds like a permissions issue.

I'm not much of a windows admin, but this looks like it might help:
http://www.mydigitallife.info/2007/05/25/how-to-take-ownership-and-grant-permissions-in-windows-vista/

HTH,

Brady

--
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] Strange behaviour with uploaded files .. XAMPP on Windows

2009-10-26 Thread Brady Mitchell
On Mon, Oct 26, 2009 at 6:31 PM, Angus Mann  wrote:
> When I use a form to upload a file, using $_FILES['uploadedfile']['name']
> and move_uploaded-file($_FILES['uploadedfile']['name'], $targetpath) strange
> effects happen.
>
> The file is uploaded to the target directory just as it should.
>
> But when I access this directory as a network share on a different machine,
> the file is not visible.

This sounds more like a windows permissions problem than PHP or XAMPP
related. Make sure the user that is connecting to the network share
has rights to view files on the windows box. It sounds like the user
that is running XAMPP has full control (or at least read/write/delete)
to that directory, but the user connecting to the network share
doesn't.

> When I go to delete the file, or the entire uploads folder, the file is not
> deleted, nor the folder. If the folder contains anything I put there
> manually (ie. not uploaded as above) that is deleted, but the uploaded
> content remains.

Yeah, definitely sounds like a permissions issue.

I'm not much of a windows admin, but this looks like it might help:
http://www.mydigitallife.info/2007/05/25/how-to-take-ownership-and-grant-permissions-in-windows-vista/

HTH,

Brady

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



Re: [PHP] How to Get the Sub Classes of a Parent Class

2009-10-26 Thread Martin Scotta
On Mon, Oct 26, 2009 at 10:33 PM, David Otton <
phpm...@jawbone.freeserve.co.uk> wrote:

> 2009/10/27 Raymond Irving :
>
> >>> I want to automatically initialize a specific sub class when the php
> page
> >>> is loaded.
>
> >> You may be able solve this with a simple class_exists() (pseudo-code
> ahead):
> >>
> >> if(class_exists($var)) {
> >> $class = new $var;
> >> } else {
> >> $class = new FourOhFour;
> >> }
>
> >> This works if you know the name of the class. What I'm looking for is a
> way
> >> to get one of the sub classes and initialize it dynamically.
>
> I'm confused. If you don't know the name of the child class, how are
> you going to know which one to instantiate? Are you going to pick one
> at random?
>
> What you're trying to do can probably be accomplished, but I can't
> shake the feeling we're trying to solve the wrong problem here.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Just having FUN, do not take me serious : )

function getInstanceRandom()
{
$classes = get_declared_classes();
$index = array_rand( $classes );
return new $classes[ $index ]();
}

$obj = getInstanceRandom();
echo get_class( $obj );

This is way you NEVER know which class you will instantiate!

-- 
Martin Scotta


Re: [PHP] How to Get the Sub Classes of a Parent Class

2009-10-26 Thread Martin Scotta
On Mon, Oct 26, 2009 at 10:22 PM, Raymond Irving  wrote:

>
> This works if you know the name of the class. What I'm looking for is a way
> to get one of the sub classes and initialize it dynamically.
>
>
>
>
> 
> From: David Otton 
> To: Raymond Irving 
> Cc: PHP-General List 
> Sent: Sun, October 25, 2009 10:25:27 AM
> Subject: Re: [PHP] How to Get the Sub Classes of a Parent Class
>
> 2009/10/25 Raymond Irving :
>
> > I want to automatically initialize a specific sub class when the php page
> is loaded.
> >
> > I'm looking for a solution for php 5.1+ or anything that's optimized for
> 5.3
>
> You may be able solve this with a simple class_exists() (pseudo-code
> ahead):
>
> if(class_exists($var)) {
>$class = new $var;
> } else {
>$class = new FourOhFour;
> }
>

This script only works for loaded classes .
If your script has autoloader then there is no way to know the declared
classes before you declare them.

error_reporting( E_ALL | E_STRICT );

Class Foo {}

Class Bar extends Foo {}
Class Baz extends Foo {}

Class Beer extends Bar {}
Class Pier extends Bar {}

function get_subclasses($class)
{

$sub = array();

foreach(get_declared_classes() as $name )
{
$rClass = new ReflectionClass($name);

if( $rClass->isSubclassOf( $class ))
{
$sub[] = $name;
}
}

return $sub;
}

print_r( get_subclasses( 'Foo' ));
print_r( get_subclasses( 'Bar' ));

-- 
Martin Scotta


Re: [PHP] How to Get the Sub Classes of a Parent Class

2009-10-26 Thread David Otton
2009/10/27 Raymond Irving :

>>> I want to automatically initialize a specific sub class when the php page
>>> is loaded.

>> You may be able solve this with a simple class_exists() (pseudo-code ahead):
>>
>> if(class_exists($var)) {
>> $class = new $var;
>> } else {
>> $class = new FourOhFour;
>> }

>> This works if you know the name of the class. What I'm looking for is a way
>> to get one of the sub classes and initialize it dynamically.

I'm confused. If you don't know the name of the child class, how are
you going to know which one to instantiate? Are you going to pick one
at random?

What you're trying to do can probably be accomplished, but I can't
shake the feeling we're trying to solve the wrong problem here.

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



[PHP] Strange behaviour with uploaded files .. XAMPP on Windows

2009-10-26 Thread Angus Mann
Hi all. I'm not sure if this is really a PHP question or specific to XAMPP, 
or windows in general...


I have XAMPP including PHP 4.29 running on a Vista machine.

When I use a form to upload a file, using $_FILES['uploadedfile']['name'] 
and move_uploaded-file($_FILES['uploadedfile']['name'], $targetpath) strange 
effects happen.


The file is uploaded to the target directory just as it should.

But when I access this directory as a network share on a different machine, 
the file is not visible.


When I go to delete the file, or the entire uploads folder, the file is not 
deleted, nor the folder. If the folder contains anything I put there 
manually (ie. not uploaded as above) that is deleted, but the uploaded 
content remains.


This reminds me a bit of "symbolic links" behaviour but I'm really stumped 
if that's the case.


Any ideas?



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



Re: [PHP] How to Get the Sub Classes of a Parent Class

2009-10-26 Thread Raymond Irving

This works if you know the name of the class. What I'm looking for is a way to 
get one of the sub classes and initialize it dynamically. 





From: David Otton 
To: Raymond Irving 
Cc: PHP-General List 
Sent: Sun, October 25, 2009 10:25:27 AM
Subject: Re: [PHP] How to Get the Sub Classes of a Parent Class

2009/10/25 Raymond Irving :

> I want to automatically initialize a specific sub class when the php page is 
> loaded.
>
> I'm looking for a solution for php 5.1+ or anything that's optimized for 5.3

You may be able solve this with a simple class_exists() (pseudo-code ahead):

if(class_exists($var)) {
$class = new $var;
} else {
$class = new FourOhFour;
}


RE: [PHP] dynamic menu with show hide capabilities - understanding possible workflow

2009-10-26 Thread MEM
Thanks a lot for your replies. 

Let's see if I understand, if not, please, let me know, I'm not that proficient 
in English. 
Second try, in order to accomplish this, I have to:


1) Generate the multidimensional array from query.

2) Generate the ul / li menu (echo + foreach) displaying all child elements as 
well.

3) Apply the anchor to the list items.
 
 3.1) Each anchor on this list should point to a new URL (I don't care if the 
page refreshes on this case).

4) Print all this on a nice way to the browser. (unobtrusive)

5) Apply js to:
 5.1) HIDE the elements that need to be hidden. 
 5.2) SHOW what needs to be displayed.


I don't want to have any onHover effect. The submenus will not appear on a 
onhover effect. 
They should appear when the user either clicks on a parent menu item, or 
navigates to a specific URL. 

Should this make me change this workflow somehow? 



Please have patience... :s

Thanks again,
Márcio


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



Re: [PHP] Issues with MySQL connectivity ... on only one machine, and for a while now

2009-10-26 Thread Michael Shadle
nope. it's a quad core with 4 gig ram

[r...@sql02 ~]# free -m
 total   used   free sharedbuffers cached
Mem:  3905   3774130  0170941
-/+ buffers/cache:   2662   1243
Swap: 3906 20   3886
[r...@sql02 ~]#

i do have collectd installed and am waiting for it to happen some more
to see if i can correlate it with any specific event

On Mon, Oct 26, 2009 at 5:53 AM, John Black
 wrote:
> Michael Shadle wrote:
>>
>> Oct 25 22:00:01 sql02 php: PHP Warning:  mysqli_connect():
>> (HY000/2013): Lost connection to MySQL server at 'sending
>> authentication information', system error: 32 in
>> /home/foo/web/foo.com/core.php on line 2394
>>
>> mysql 5.0.75 on ubuntu jaunty 64-bit
>> php 5.2.11 (but has been showing this issue since 5.2.9 if not
>> earlier, I didn't start tracking it then)
>
>
> Is this a VPS (virtual private server)?
> Reason I am asking is because some VPS implementations only give you RAM but
> no SWAP space. So once all RAM is consumed processes will get aborted.
>
> --
> John
> Klarmachen zum Ändern!
>   Piratenpartei Deutschland
> http://www.youtube.com/v/-u3IUno5A-M
>
> --
> 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] simplexml_load_file() improvement

2009-10-26 Thread Marco Barbieri
Hi all!
This is my first mail, I hope I will use this mailing list in the correct
mode.
One of main advantages of SQL in the concorrent access of many script to the
same database.
I would like improve similar functions to the SimpleXML module.
In particular, I want modify the simplexml_load_file() function adding the
interaction with the flock() function.
What do you think about?


[PHP] simple xml object

2009-10-26 Thread Chris W
I have the following xmlwith standard tags changed to [ and ] to 
prevent mail clients from encoding it as html.

[?xml version="1.0"?]
[resultset errors="0" results="86"]
[result id="20080922133104871678" lastinspected="9/29/2009 
0:00"]0.4[/result]
[result id="20080922133104871678" lastinspected="8/28/2009 
0:00"]1.1[/result]

. . .

I am using the simplexml_load_string to read it in to an object and 
execute the following code


 $xml = simplexml_load_string($content);


 foreach($xml as $Result){
   print_r($Result);
   foreach($Result->attributes() as $i => $v){
 $$i = $v;
 print "Attr: $i = '$v'\n";
   }
 }

that all works fine.  Problem is I can't figure out how to get the 
acutual value (0.4 and 1.1).  I also don't know why I can't simply do 
something like


$id = $Result->attributes()->id;

the output of this looks like 

SimpleXMLElement Object
(
   [...@attributes] => Array
   (
   [id] => 20080922133104871678
   [lastinspected] => 9/29/2009 0:00
   )

   [0] => 0.4
)
Attr: id = '20080922133104871678'
Attr: lastinspected = '9/29/2009 0:00'

SimpleXMLElement Object
(
   [...@attributes] => Array
   (
   [id] => 20080922133104871678
   [lastinspected] => 8/28/2009 0:00
   )

   [0] => 1.1
)
Attr: id = '20080922133104871678'
Attr: lastinspected = '8/28/2009 0:00'



How do I read the [0] value?  $Result[0] gives me nothing.

--
Chris W
KE5GIX

"Protect your digital freedom and privacy, eliminate DRM, 
learn more at http://www.defectivebydesign.org/what_is_drm";


Ham Radio Repeater Database.
http://hrrdb.com


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



Re: [PHP] (nginx) fcgi+PHP+memcache on RedHat: Class 'Memcache' not found...

2009-10-26 Thread Eddie Drapkin
On Mon, Oct 26, 2009 at 12:22 PM, Tom Barrett  wrote:
> 2009/10/26 Eddie Drapkin :
>> On Mon, Oct 26, 2009 at 11:59 AM, Tom Barrett  wrote:
>>> 2009/10/26 Eddie Drapkin :
 On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett  wrote:
> Hello
>
> I have installed:
>  - libevent
>  - libmemcached (http://tangent.org/552/libmemcached.html)
>  - Done a PECL installation (pecl download memcached, phpize &&
> ./configure && make)
>  - memcached
>
>> cat /etc/php.d/memcached.ini
> ; Memcached default settings
> extension=memcache.so
>
>> ls -1  /usr/lib64/php/modules/memcache*
> /usr/lib64/php/modules/memcached.so
> /usr/lib64/php/modules/memcache.so
>
>> memcached -h
> memcached 1.2.6
> ...
>
>> php -v
> PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
> Copyright (c) 1997-2006 The PHP Group
> Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
>
>
> /var/www/php_fcgi_memcache> cat memcache.php
>  $memcache = new Memcache;
> print_r($memcache);
> ?>
>
> /var/www/php_fcgi_memcache> php memcache.php
> PHP Fatal error:  Class 'Memcache' not found in
> /var/www/php_fcgi_memcache/memcache.php on line 2
>
> Memcached is working fine (being use by Perl quite happily).
>
> PHP/FCGI is working OK and phpinfo() shows:
> memcached support enabled
> Version 1.0.0
> libmemcached version 0.34
> Session support yes
>
> Any pointers in the right direction would so very much appreciated.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

 Try instantiating a Memcached instance, not a Memcache instance.
 They're two different PECL extensions!
>>>
>>> Hi
>>>
>>> That just auto-instantiates an empty object?
>>>
 cat memcached.php
>>> >> $memcache = new Memcached;
>>> print_r($memcache);
>>> ?>
>>>
 php memcached.php
>>> Memcached Object
>>> (
>>> )
>>>
>>> I have used the $m=new Memcache; syntax on another server, which works fine.
>>>
>>> Or have I mixed up my libraries somehow?
>>>
>>
>> They're actually two different classes from two different PECL
>> extensions.  Memcached is the newer (imo better) extension written by
>> Andrei (at digg) to use libmemcached.  Memcache is the older, entirely
>> custom (no external deps) PECL extension that's been around forever.
>> So, I'm guessing you have Memcache on one machine and Memcached on
>> another.  They have slightly different APIs, so I'd make sure you're
>> aware of which one you're using.  :)
>
> Thanks
>
> Any chance you could show me the way?
>
> This is how I installed the PECL extension:
>
>> pecl download memcached
>> tar zxf memcached-1.0.0.tgz
>> cd memcached-1.0.0
>> phpize
>> ./configure
>> make
>> make install
>
> Does that look like the right one? Did I miss something?
>

That'll install the Memcached extension, which is the one I'd usually
recommend and the one that I use.  I don't see anythign wrong with
using that one or that way of installing it, but I was just saying
that the method names and parameters are different from the older
extension and to just be aware of that.

Old extension: http://us2.php.net/manual/en/book.memcache.php
New extension: http://us2.php.net/manual/en/book.memcached.php

The naming confusion is unnecessary but it exists so there's not
really too much you can do about it :P

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



Re: [PHP] (nginx) fcgi+PHP+memcache on RedHat: Class 'Memcache' not found...

2009-10-26 Thread Tom Barrett
2009/10/26 Eddie Drapkin :
> On Mon, Oct 26, 2009 at 11:59 AM, Tom Barrett  wrote:
>> 2009/10/26 Eddie Drapkin :
>>> On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett  wrote:
 Hello

 I have installed:
  - libevent
  - libmemcached (http://tangent.org/552/libmemcached.html)
  - Done a PECL installation (pecl download memcached, phpize &&
 ./configure && make)
  - memcached

> cat /etc/php.d/memcached.ini
 ; Memcached default settings
 extension=memcache.so

> ls -1  /usr/lib64/php/modules/memcache*
 /usr/lib64/php/modules/memcached.so
 /usr/lib64/php/modules/memcache.so

> memcached -h
 memcached 1.2.6
 ...

> php -v
 PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
 Copyright (c) 1997-2006 The PHP Group
 Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies


 /var/www/php_fcgi_memcache> cat memcache.php
 >>> $memcache = new Memcache;
 print_r($memcache);
 ?>

 /var/www/php_fcgi_memcache> php memcache.php
 PHP Fatal error:  Class 'Memcache' not found in
 /var/www/php_fcgi_memcache/memcache.php on line 2

 Memcached is working fine (being use by Perl quite happily).

 PHP/FCGI is working OK and phpinfo() shows:
 memcached support enabled
 Version 1.0.0
 libmemcached version 0.34
 Session support yes

 Any pointers in the right direction would so very much appreciated.

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


>>>
>>> Try instantiating a Memcached instance, not a Memcache instance.
>>> They're two different PECL extensions!
>>
>> Hi
>>
>> That just auto-instantiates an empty object?
>>
>>> cat memcached.php
>> > $memcache = new Memcached;
>> print_r($memcache);
>> ?>
>>
>>> php memcached.php
>> Memcached Object
>> (
>> )
>>
>> I have used the $m=new Memcache; syntax on another server, which works fine.
>>
>> Or have I mixed up my libraries somehow?
>>
>
> They're actually two different classes from two different PECL
> extensions.  Memcached is the newer (imo better) extension written by
> Andrei (at digg) to use libmemcached.  Memcache is the older, entirely
> custom (no external deps) PECL extension that's been around forever.
> So, I'm guessing you have Memcache on one machine and Memcached on
> another.  They have slightly different APIs, so I'd make sure you're
> aware of which one you're using.  :)

Thanks

Any chance you could show me the way?

This is how I installed the PECL extension:

> pecl download memcached
> tar zxf memcached-1.0.0.tgz
> cd memcached-1.0.0
> phpize
> ./configure
> make
> make install

Does that look like the right one? Did I miss something?

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



Re: [PHP] (nginx) fcgi+PHP+memcache on RedHat: Class 'Memcache' not found...

2009-10-26 Thread Eddie Drapkin
On Mon, Oct 26, 2009 at 11:59 AM, Tom Barrett  wrote:
> 2009/10/26 Eddie Drapkin :
>> On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett  wrote:
>>> Hello
>>>
>>> I have installed:
>>>  - libevent
>>>  - libmemcached (http://tangent.org/552/libmemcached.html)
>>>  - Done a PECL installation (pecl download memcached, phpize &&
>>> ./configure && make)
>>>  - memcached
>>>
 cat /etc/php.d/memcached.ini
>>> ; Memcached default settings
>>> extension=memcache.so
>>>
 ls -1  /usr/lib64/php/modules/memcache*
>>> /usr/lib64/php/modules/memcached.so
>>> /usr/lib64/php/modules/memcache.so
>>>
 memcached -h
>>> memcached 1.2.6
>>> ...
>>>
 php -v
>>> PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
>>> Copyright (c) 1997-2006 The PHP Group
>>> Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
>>>
>>>
>>> /var/www/php_fcgi_memcache> cat memcache.php
>>> >> $memcache = new Memcache;
>>> print_r($memcache);
>>> ?>
>>>
>>> /var/www/php_fcgi_memcache> php memcache.php
>>> PHP Fatal error:  Class 'Memcache' not found in
>>> /var/www/php_fcgi_memcache/memcache.php on line 2
>>>
>>> Memcached is working fine (being use by Perl quite happily).
>>>
>>> PHP/FCGI is working OK and phpinfo() shows:
>>> memcached support enabled
>>> Version 1.0.0
>>> libmemcached version 0.34
>>> Session support yes
>>>
>>> Any pointers in the right direction would so very much appreciated.
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>> Try instantiating a Memcached instance, not a Memcache instance.
>> They're two different PECL extensions!
>
> Hi
>
> That just auto-instantiates an empty object?
>
>> cat memcached.php
>  $memcache = new Memcached;
> print_r($memcache);
> ?>
>
>> php memcached.php
> Memcached Object
> (
> )
>
> I have used the $m=new Memcache; syntax on another server, which works fine.
>
> Or have I mixed up my libraries somehow?
>

They're actually two different classes from two different PECL
extensions.  Memcached is the newer (imo better) extension written by
Andrei (at digg) to use libmemcached.  Memcache is the older, entirely
custom (no external deps) PECL extension that's been around forever.
So, I'm guessing you have Memcache on one machine and Memcached on
another.  They have slightly different APIs, so I'd make sure you're
aware of which one you're using.  :)

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



Re: [PHP] (nginx) fcgi+PHP+memcache on RedHat: Class 'Memcache' not found...

2009-10-26 Thread Tom Barrett
2009/10/26 Eddie Drapkin :
> On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett  wrote:
>> Hello
>>
>> I have installed:
>>  - libevent
>>  - libmemcached (http://tangent.org/552/libmemcached.html)
>>  - Done a PECL installation (pecl download memcached, phpize &&
>> ./configure && make)
>>  - memcached
>>
>>> cat /etc/php.d/memcached.ini
>> ; Memcached default settings
>> extension=memcache.so
>>
>>> ls -1  /usr/lib64/php/modules/memcache*
>> /usr/lib64/php/modules/memcached.so
>> /usr/lib64/php/modules/memcache.so
>>
>>> memcached -h
>> memcached 1.2.6
>> ...
>>
>>> php -v
>> PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
>> Copyright (c) 1997-2006 The PHP Group
>> Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
>>
>>
>> /var/www/php_fcgi_memcache> cat memcache.php
>> > $memcache = new Memcache;
>> print_r($memcache);
>> ?>
>>
>> /var/www/php_fcgi_memcache> php memcache.php
>> PHP Fatal error:  Class 'Memcache' not found in
>> /var/www/php_fcgi_memcache/memcache.php on line 2
>>
>> Memcached is working fine (being use by Perl quite happily).
>>
>> PHP/FCGI is working OK and phpinfo() shows:
>> memcached support enabled
>> Version 1.0.0
>> libmemcached version 0.34
>> Session support yes
>>
>> Any pointers in the right direction would so very much appreciated.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> Try instantiating a Memcached instance, not a Memcache instance.
> They're two different PECL extensions!

Hi

That just auto-instantiates an empty object?

> cat memcached.php


> php memcached.php
Memcached Object
(
)

I have used the $m=new Memcache; syntax on another server, which works fine.

Or have I mixed up my libraries somehow?

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



Re: [PHP] dynamic menu with show hide capabilities - understanding possible workflow

2009-10-26 Thread Ashley Sheridan
On Mon, 2009-10-26 at 08:49 -0700, Jim Lucas wrote:

> MEM wrote:
> > Thank you all.
> >  
> > Ok. Please stay with me, cause I still have some doubts. 
> > Not only do I need to display the subitems on click but also, when the user 
> > clicks on one menu item, I need to change the URI as well.
> > Why? Because, each time the user clicks on a menu item (whateaver that item 
> > as childs or not), I want to display a list of products related to the 
> > clicked item.
> >  
> > So, I was trying to avoid js, because, I don’t know that much about js. 
> > However, I’d like to do it properly, so, the only way I was allowing the 
> > use of js, was by do not disabling the back button functionality and by 
> > allowing a add to favorites option as well, allowing the URI changing… O.o
> 
> The JS part isn't for clicking at all.  Rather, it is for hovering.
> 
> Since IE doesn't have hover on any element besides the anchor, it is used to
> mimic hovering in IE.
> 
> Use the following example to add the hover ability to your app.
> 
> http://snipplr.com/view/1912/internet-explorer-ie6-css-hover/
> 
> >  
> > Anyway, let’s face it: 
> > Js is my only option, could this be a nice workflow, for an unobtrusive 
> > solution?
> 
> Remember, JS is only used to create the ability for IE to hover over elements 
> :)
> 
> >  
> >  
> > 1)  Generate the multidimensional array from query.
> > 2)  Generate the ul / li menu (echo + foreach) displaying all child 
> > elements as well.
> > 3)  Apply the anchor to the list items.
> 
> NO!!!  don't do the following!
> 
> > 4)  Apply some js to that ul / li that: 
> > 4.1) will be responsible for show/hide elements.
> > 4.2) Will be responsible to show/hide elements only when some DOM node(?) 
> > as children.
> > 4.3) Change the URI on click, so that some information can be showed based 
> > on uri segment. 
> >  
> > Can I have your help to fill the blanks here, or, if there are to many, 
> > just an orientation reference, in order to get started…
> >  
> >  
> 
> Now to satisfy the people that are going to ask the inevitable question "What 
> if
> JS is turned off??"
> 
> Show everything by default. Then, using JS, hide all that should be hidden and
> go from their.
> 
> >  
> > Thanks a lot once again,
> > Márcio
> >  
> >  
> >  
> >  
> > From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
> > Sent: segunda-feira, 26 de Outubro de 2009 14:38
> > To: MEM
> > Cc: php-general@lists.php.net
> > Subject: Re: [PHP] dynamic menu with show hide capabilities - understanding 
> > possible workflow
> >  
> > On Mon, 2009-10-26 at 13:28 +, MEM wrote: 
> >  
> > Hello all,
> >  
> > I'm on my way to build my first dynamic menu using php.
> > However, each time I say this, people start jumping at me crying out loud:
> > "Jquery" .
> > I don't need js for this. Really. (At least, this is what I believe).
> >  
> > So I was wondering if It's possible to accomplish it, by using css and php
> > only.
> >  
> >  
> > If so, I'm wondering if something like this it's a good way for doing this:
> >  
> > 1)
> > Generate a multidimensional array from database table containing categories
> > and subcategories.
> >  
> > 2)
> > Create a css file with two classes one that shows, another that hides.
> >  
> > 3)
> > Grab that array and: 
> >  3.1) print it recursively (no idea how to accomplish this)
> >  3.2) print it with some sort of class="showThis" inside the generated html
> > element.
> >  3.3) make a conditional somewhere (I really don't know where, and this may
> > be related with the recursion doubt), in order to display the children
> > elements, only when we click the parent element.
> >  
> > And here resides my main doubt: Is the point 3.3 feasible without the use of
> > js?
> >  
> >  
> >  
> > I just need some directions please,
> >  
> > Regards,
> > Márcio
> >  
> >  
> >  
> > 
> > Everything there is feasible without Javascript except for the clicking 
> > part, which is pretty essential to what you want. Pure CSS-only menus are 
> > still unavailable because of IE, so using some Javascript is your only 
> > option really.
> > 
> > Is there a particular reason you are shying away from Javascript in this 
> > case? There are ways you can construct drop-down menus in a way that if 
> > Javascript is unavailable, then they fall back to becoming a bog-standard 
> > navigation bar.
> > 
> > Also, before anyone mentions them,  lists are not the same thing as 
> > a drop-down menu, and navigating to different parts of a document upon 
> > changing the selected option is actually breaking their default behavior, 
> > and can become confusing to people who expect them to work as select lists.
> > 
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> > 
> > 
> >  
> > 
> 


I've always gone the route of having the drop-downs just accompany a
standard, regular, functioning navigation bar. That way, if someone has
Javascript turned off, they are still able to use 

Re: [PHP] dynamic menu with show hide capabilities - understanding possible workflow

2009-10-26 Thread Jim Lucas
MEM wrote:
> Thank you all.
>  
> Ok. Please stay with me, cause I still have some doubts. 
> Not only do I need to display the subitems on click but also, when the user 
> clicks on one menu item, I need to change the URI as well.
> Why? Because, each time the user clicks on a menu item (whateaver that item 
> as childs or not), I want to display a list of products related to the 
> clicked item.
>  
> So, I was trying to avoid js, because, I don’t know that much about js. 
> However, I’d like to do it properly, so, the only way I was allowing the use 
> of js, was by do not disabling the back button functionality and by allowing 
> a add to favorites option as well, allowing the URI changing… O.o

The JS part isn't for clicking at all.  Rather, it is for hovering.

Since IE doesn't have hover on any element besides the anchor, it is used to
mimic hovering in IE.

Use the following example to add the hover ability to your app.

http://snipplr.com/view/1912/internet-explorer-ie6-css-hover/

>  
> Anyway, let’s face it: 
> Js is my only option, could this be a nice workflow, for an unobtrusive 
> solution?

Remember, JS is only used to create the ability for IE to hover over elements :)

>  
>  
> 1)  Generate the multidimensional array from query.
> 2)  Generate the ul / li menu (echo + foreach) displaying all child 
> elements as well.
> 3)  Apply the anchor to the list items.

NO!!!  don't do the following!

> 4)  Apply some js to that ul / li that: 
> 4.1) will be responsible for show/hide elements.
> 4.2) Will be responsible to show/hide elements only when some DOM node(?) as 
> children.
> 4.3) Change the URI on click, so that some information can be showed based on 
> uri segment. 
>  
> Can I have your help to fill the blanks here, or, if there are to many, just 
> an orientation reference, in order to get started…
>  
>  

Now to satisfy the people that are going to ask the inevitable question "What if
JS is turned off??"

Show everything by default. Then, using JS, hide all that should be hidden and
go from their.

>  
> Thanks a lot once again,
> Márcio
>  
>  
>  
>  
> From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
> Sent: segunda-feira, 26 de Outubro de 2009 14:38
> To: MEM
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] dynamic menu with show hide capabilities - understanding 
> possible workflow
>  
> On Mon, 2009-10-26 at 13:28 +, MEM wrote: 
>  
> Hello all,
>  
> I'm on my way to build my first dynamic menu using php.
> However, each time I say this, people start jumping at me crying out loud:
> "Jquery" .
> I don't need js for this. Really. (At least, this is what I believe).
>  
> So I was wondering if It's possible to accomplish it, by using css and php
> only.
>  
>  
> If so, I'm wondering if something like this it's a good way for doing this:
>  
> 1)
> Generate a multidimensional array from database table containing categories
> and subcategories.
>  
> 2)
> Create a css file with two classes one that shows, another that hides.
>  
> 3)
> Grab that array and: 
>  3.1) print it recursively (no idea how to accomplish this)
>  3.2) print it with some sort of class="showThis" inside the generated html
> element.
>  3.3) make a conditional somewhere (I really don't know where, and this may
> be related with the recursion doubt), in order to display the children
> elements, only when we click the parent element.
>  
> And here resides my main doubt: Is the point 3.3 feasible without the use of
> js?
>  
>  
>  
> I just need some directions please,
>  
> Regards,
> Márcio
>  
>  
>  
> 
> Everything there is feasible without Javascript except for the clicking part, 
> which is pretty essential to what you want. Pure CSS-only menus are still 
> unavailable because of IE, so using some Javascript is your only option 
> really.
> 
> Is there a particular reason you are shying away from Javascript in this 
> case? There are ways you can construct drop-down menus in a way that if 
> Javascript is unavailable, then they fall back to becoming a bog-standard 
> navigation bar.
> 
> Also, before anyone mentions them,  lists are not the same thing as a 
> drop-down menu, and navigating to different parts of a document upon changing 
> the selected option is actually breaking their default behavior, and can 
> become confusing to people who expect them to work as select lists.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
>  
> 


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



Re: [PHP] (nginx) fcgi+PHP+memcache on RedHat: Class 'Memcache' not found...

2009-10-26 Thread Eddie Drapkin
On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett  wrote:
> Hello
>
> I have installed:
>  - libevent
>  - libmemcached (http://tangent.org/552/libmemcached.html)
>  - Done a PECL installation (pecl download memcached, phpize &&
> ./configure && make)
>  - memcached
>
>> cat /etc/php.d/memcached.ini
> ; Memcached default settings
> extension=memcache.so
>
>> ls -1  /usr/lib64/php/modules/memcache*
> /usr/lib64/php/modules/memcached.so
> /usr/lib64/php/modules/memcache.so
>
>> memcached -h
> memcached 1.2.6
> ...
>
>> php -v
> PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
> Copyright (c) 1997-2006 The PHP Group
> Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
>
>
> /var/www/php_fcgi_memcache> cat memcache.php
>  $memcache = new Memcache;
> print_r($memcache);
> ?>
>
> /var/www/php_fcgi_memcache> php memcache.php
> PHP Fatal error:  Class 'Memcache' not found in
> /var/www/php_fcgi_memcache/memcache.php on line 2
>
> Memcached is working fine (being use by Perl quite happily).
>
> PHP/FCGI is working OK and phpinfo() shows:
> memcached support enabled
> Version 1.0.0
> libmemcached version 0.34
> Session support yes
>
> Any pointers in the right direction would so very much appreciated.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Try instantiating a Memcached instance, not a Memcache instance.
They're two different PECL extensions!

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



[PHP] (nginx) fcgi+PHP+memcache on RedHat: Class 'Memcache' not found...

2009-10-26 Thread Tom Barrett
Hello

I have installed:
 - libevent
 - libmemcached (http://tangent.org/552/libmemcached.html)
 - Done a PECL installation (pecl download memcached, phpize &&
./configure && make)
 - memcached

> cat /etc/php.d/memcached.ini
; Memcached default settings
extension=memcache.so

> ls -1  /usr/lib64/php/modules/memcache*
/usr/lib64/php/modules/memcached.so
/usr/lib64/php/modules/memcache.so

> memcached -h
memcached 1.2.6
...

> php -v
PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies


/var/www/php_fcgi_memcache> cat memcache.php


/var/www/php_fcgi_memcache> php memcache.php
PHP Fatal error:  Class 'Memcache' not found in
/var/www/php_fcgi_memcache/memcache.php on line 2

Memcached is working fine (being use by Perl quite happily).

PHP/FCGI is working OK and phpinfo() shows:
memcached support enabled
Version 1.0.0
libmemcached version 0.34
Session support yes

Any pointers in the right direction would so very much appreciated.

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



RE: [PHP] dynamic menu with show hide capabilities - understanding possible workflow

2009-10-26 Thread Ashley Sheridan
On Mon, 2009-10-26 at 15:01 +, MEM wrote:
> Thank you all.
> 
>  
> 
> Ok. Please stay with me, cause I still have some doubts. 
> 
> Not only do I need to display the subitems on click but also, when the
> user clicks on one menu item, I need to change the URI as well.
> 
> Why? Because, each time the user clicks on a menu item (whateaver that
> item as childs or not), I want to display a list of products related
> to the clicked item.
> 
>  
> 
> So, I was trying to avoid js, because, I don’t know that much about
> js. However, I’d like to do it properly, so, the only way I was
> allowing the use of js, was by do not disabling the back button
> functionality and by allowing a add to favorites option as well,
> allowing the URI changing… O.o
> 
>  
> 
> Anyway, let’s face it: 
> 
> Js is my only option, could this be a nice workflow, for an
> unobtrusive solution?
> 
>  
> 
>  
> 
> 1)  Generate the multidimensional array from query.
> 
> 2)  Generate the ul / li menu (echo + foreach) displaying all
> child elements as well.
> 
> 3)  Apply the anchor to the list items.
> 
> 4)  Apply some js to that ul / li that: 
> 
> 4.1) will be responsible for show/hide elements.
> 
> 4.2) Will be responsible to show/hide elements only when some DOM
> node(?) as children.
> 
> 4.3) Change the URI on click, so that some information can be showed
> based on uri segment. 
> 
>  
> 
> Can I have your help to fill the blanks here, or, if there are to
> many, just an orientation reference, in order to get started…
> 
>  
> 
>  
> 
>  
> 
> Thanks a lot once again,
> 
> Márcio
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 
> From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
> Sent: segunda-feira, 26 de Outubro de 2009 14:38
> To: MEM
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] dynamic menu with show hide capabilities -
> understanding possible workflow
> 
> 
> 
>  
> 
> On Mon, 2009-10-26 at 13:28 +, MEM wrote: 
> 
> 
>  
> Hello all,
>  
> I'm on my way to build my first dynamic menu using php.
> However, each time I say this, people start jumping at me crying out loud:
> "Jquery" .
> I don't need js for this. Really. (At least, this is what I believe).
>  
> So I was wondering if It's possible to accomplish it, by using css and php
> only.
>  
>  
> If so, I'm wondering if something like this it's a good way for doing this:
>  
> 1)
> Generate a multidimensional array from database table containing categories
> and subcategories.
>  
> 2)
> Create a css file with two classes one that shows, another that hides.
>  
> 3)
> Grab that array and: 
>  3.1) print it recursively (no idea how to accomplish this)
> 3.2) print it with some sort of class="showThis" inside the generated html
> element.
> 3.3) make a conditional somewhere (I really don't know where, and this may
> be related with the recursion doubt), in order to display the children
> elements, only when we click the parent element.
>  
> And here resides my main doubt: Is the point 3.3 feasible without the use of
> js?
>  
>  
>  
> I just need some directions please,
>  
> Regards,
> Márcio
>  
>  
>  
> 
> 
> 
> Everything there is feasible without Javascript except for the
> clicking part, which is pretty essential to what you want. Pure
> CSS-only menus are still unavailable because of IE, so using some
> Javascript is your only option really.
> 
> Is there a particular reason you are shying away from Javascript in
> this case? There are ways you can construct drop-down menus in a way
> that if Javascript is unavailable, then they fall back to becoming a
> bog-standard navigation bar.
> 
> Also, before anyone mentions them,  lists are not the same
> thing as a drop-down menu, and navigating to different parts of a
> document upon changing the selected option is actually breaking their
> default behavior, and can become confusing to people who expect them
> to work as select lists.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
> 
> 
> 
>  
> 
> 

In that case, what you need to do is navigate to a new URL each time, as
there is no way you can change the URL at all. The only way to change it
without reloading is to alter the #anchor part of the URL, but that is
not too flexible.

Thanks,
Ash
http://www.ashleysheridan.co.uk




RE: [PHP] dynamic menu with show hide capabilities - understanding possible workflow

2009-10-26 Thread MEM
Thank you all.
 
Ok. Please stay with me, cause I still have some doubts. 
Not only do I need to display the subitems on click but also, when the user 
clicks on one menu item, I need to change the URI as well.
Why? Because, each time the user clicks on a menu item (whateaver that item as 
childs or not), I want to display a list of products related to the clicked 
item.
 
So, I was trying to avoid js, because, I don’t know that much about js. 
However, I’d like to do it properly, so, the only way I was allowing the use of 
js, was by do not disabling the back button functionality and by allowing a add 
to favorites option as well, allowing the URI changing… O.o
 
Anyway, let’s face it: 
Js is my only option, could this be a nice workflow, for an unobtrusive 
solution?
 
 
1)  Generate the multidimensional array from query.
2)  Generate the ul / li menu (echo + foreach) displaying all child 
elements as well.
3)  Apply the anchor to the list items.
4)  Apply some js to that ul / li that: 
4.1) will be responsible for show/hide elements.
4.2) Will be responsible to show/hide elements only when some DOM node(?) as 
children.
4.3) Change the URI on click, so that some information can be showed based on 
uri segment. 
 
Can I have your help to fill the blanks here, or, if there are to many, just an 
orientation reference, in order to get started…
 
 
 
Thanks a lot once again,
Márcio
 
 
 
 
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: segunda-feira, 26 de Outubro de 2009 14:38
To: MEM
Cc: php-general@lists.php.net
Subject: Re: [PHP] dynamic menu with show hide capabilities - understanding 
possible workflow
 
On Mon, 2009-10-26 at 13:28 +, MEM wrote: 
 
Hello all,
 
I'm on my way to build my first dynamic menu using php.
However, each time I say this, people start jumping at me crying out loud:
"Jquery" .
I don't need js for this. Really. (At least, this is what I believe).
 
So I was wondering if It's possible to accomplish it, by using css and php
only.
 
 
If so, I'm wondering if something like this it's a good way for doing this:
 
1)
Generate a multidimensional array from database table containing categories
and subcategories.
 
2)
Create a css file with two classes one that shows, another that hides.
 
3)
Grab that array and: 
 3.1) print it recursively (no idea how to accomplish this)
 3.2) print it with some sort of class="showThis" inside the generated html
element.
 3.3) make a conditional somewhere (I really don't know where, and this may
be related with the recursion doubt), in order to display the children
elements, only when we click the parent element.
 
And here resides my main doubt: Is the point 3.3 feasible without the use of
js?
 
 
 
I just need some directions please,
 
Regards,
Márcio
 
 
 

Everything there is feasible without Javascript except for the clicking part, 
which is pretty essential to what you want. Pure CSS-only menus are still 
unavailable because of IE, so using some Javascript is your only option really.

Is there a particular reason you are shying away from Javascript in this case? 
There are ways you can construct drop-down menus in a way that if Javascript is 
unavailable, then they fall back to becoming a bog-standard navigation bar.

Also, before anyone mentions them,  lists are not the same thing as a 
drop-down menu, and navigating to different parts of a document upon changing 
the selected option is actually breaking their default behavior, and can become 
confusing to people who expect them to work as select lists.

Thanks,
Ash
http://www.ashleysheridan.co.uk


 


Re: [PHP] dynamic menu with show hide capabilities - understanding possible workflow

2009-10-26 Thread Ashley Sheridan
On Mon, 2009-10-26 at 13:28 +, MEM wrote:

> Hello all,
> 
> I'm on my way to build my first dynamic menu using php.
> However, each time I say this, people start jumping at me crying out loud:
> "Jquery" .
> I don't need js for this. Really. (At least, this is what I believe).
> 
> So I was wondering if It's possible to accomplish it, by using css and php
> only.
> 
> 
> If so, I'm wondering if something like this it's a good way for doing this:
> 
> 1)
> Generate a multidimensional array from database table containing categories
> and subcategories.
> 
> 2)
> Create a css file with two classes one that shows, another that hides.
> 
> 3)
> Grab that array and: 
>  3.1) print it recursively (no idea how to accomplish this)
>  3.2) print it with some sort of class="showThis" inside the generated html
> element.
>  3.3) make a conditional somewhere (I really don't know where, and this may
> be related with the recursion doubt), in order to display the children
> elements, only when we click the parent element.
> 
> And here resides my main doubt: Is the point 3.3 feasible without the use of
> js?
> 
> 
> 
> I just need some directions please,
> 
> Regards,
> Márcio
> 
> 
> 


Everything there is feasible without Javascript except for the clicking
part, which is pretty essential to what you want. Pure CSS-only menus
are still unavailable because of IE, so using some Javascript is your
only option really.

Is there a particular reason you are shying away from Javascript in this
case? There are ways you can construct drop-down menus in a way that if
Javascript is unavailable, then they fall back to becoming a
bog-standard navigation bar.

Also, before anyone mentions them,  lists are not the same thing
as a drop-down menu, and navigating to different parts of a document
upon changing the selected option is actually breaking their default
behavior, and can become confusing to people who expect them to work as
select lists.

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] dynamic menu with show hide capabilities - understanding possible workflow

2009-10-26 Thread MEM
Hello all,

I'm on my way to build my first dynamic menu using php.
However, each time I say this, people start jumping at me crying out loud:
"Jquery" .
I don't need js for this. Really. (At least, this is what I believe).

So I was wondering if It's possible to accomplish it, by using css and php
only.


If so, I'm wondering if something like this it's a good way for doing this:

1)
Generate a multidimensional array from database table containing categories
and subcategories.

2)
Create a css file with two classes one that shows, another that hides.

3)
Grab that array and: 
 3.1) print it recursively (no idea how to accomplish this)
 3.2) print it with some sort of class="showThis" inside the generated html
element.
 3.3) make a conditional somewhere (I really don't know where, and this may
be related with the recursion doubt), in order to display the children
elements, only when we click the parent element.

And here resides my main doubt: Is the point 3.3 feasible without the use of
js?



I just need some directions please,

Regards,
Márcio



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



Re: [PHP] php mail() function

2009-10-26 Thread John Black

Bob McConnell wrote:

I strongly recommend you call the help desk at Shaw and ask them to
explain what is happening. They should know what is going on with their
servers. Everyone on this list appears to be guessing at the problem,
which is not likely to help you.


But they are educated guesses :)

No seriously, without a definitive error message it is hard to say for sure.
Since he only needs postfix on the server to allow php to email out I 
may have a different solution for him.
I sent him my custom smtp_email function which talks to the ISPs SMTP 
server directly and supports authentication.

Lets see if that help.

--
John
Nur wer im Wohlstand lebt, schimpft auf ihn.
[Ludwig Marcuse]

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



RE: [PHP] php mail() function

2009-10-26 Thread Bob McConnell
From: James Prentice

> I have tried setting both $to and $email to be the same shaw address
> since I assumed it should be recognized by the mail server, but it's
> still getting bounced. So why is 'www-d...@homemade' being listed as
> the sender? Any ideas?

I strongly recommend you call the help desk at Shaw and ask them to
explain what is happening. They should know what is going on with their
servers. Everyone on this list appears to be guessing at the problem,
which is not likely to help you.

Bob McConnell

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



Re: [PHP] Issues with MySQL connectivity ... on only one machine, and for a while now

2009-10-26 Thread John Black

Michael Shadle wrote:

Oct 25 22:00:01 sql02 php: PHP Warning:  mysqli_connect():
(HY000/2013): Lost connection to MySQL server at 'sending
authentication information', system error: 32 in
/home/foo/web/foo.com/core.php on line 2394

mysql 5.0.75 on ubuntu jaunty 64-bit
php 5.2.11 (but has been showing this issue since 5.2.9 if not
earlier, I didn't start tracking it then)



Is this a VPS (virtual private server)?
Reason I am asking is because some VPS implementations only give you RAM 
but no SWAP space. So once all RAM is consumed processes will get aborted.


--
John
Klarmachen zum Ändern!
   Piratenpartei Deutschland
http://www.youtube.com/v/-u3IUno5A-M

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



Re: [PHP] getcsv error

2009-10-26 Thread John Black

Looks like Steve posted the answer so here is something related.
I use the function below to deal with those annoying magic quotes setups.

The function will remove the magically annoying quotes from the POST, 
GET, COOKIE and REQUEST arrays. Simply save it to a file and include it 
on top of your pages.



http://usphp.com/manual/en/security.magicquotes.disabling.php

if (get_magic_quotes_gpc()) {
   function stripslashes_deep($value)
   {
   $value = is_array($value) ?
   array_map('stripslashes_deep', $value) :
   stripslashes($value);

   return $value;
   }

   $_POST = array_map('stripslashes_deep', $_POST);
   $_GET = array_map('stripslashes_deep', $_GET);
   $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
   $_REQUEST = array_map('stripslashes_deep', $_REQUEST);

}
?>


--
John
There's room at the top they are telling you still,
But first you must learn how to smile as you kill,
If you want to be like the folks on the hill...
[John Lennon]

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



Re: [PHP] RewriteRule to hide PHP vars in URL

2009-10-26 Thread Ashley Sheridan
On Mon, 2009-10-26 at 07:46 +0530, kranthi wrote:

>  you have to type the relative path to your document root for every URI)
> 
> seems you are looking for
> http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#RewriteCond


I don't think that will do what he wants. Consider the following two
examples:

http://www.example.com/docs/somedoc
http://www.example.com/

Now imagine there was a rewrite rule set up to take these URLs and
convert them into the following server-side:

http://www.example.com/index.php?doc=somedoc
http://www.example.com/index.php

The same index.php page is being used to serve up all the content, but
to the browser, one 'page' is located in the document root, the other
in /docs. Any relative URL's in the pages to images, CSS, Javascript,
etc will be treated as relative to where the browser thinks the page is,
not where the server does. Therefore, you either have to use the 
tag or make all the URL's absolute. The  tag method allows for
more flexibilty in the future, for example if you changed domain name
slightly.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Issues with MySQL connectivity ... on only one machine, and for a while now

2009-10-26 Thread Michael Shadle
Yep the only connectivity issues are coming from the server itself.

I have 3 webservers talking to this server and never get a failed read
- the batch jobs running on the server itself have issues once in a
while. I even FORCED sockets just in case it was using TCP via
localhost...


On Mon, Oct 26, 2009 at 12:24 AM, Kim Madsen  wrote:
> Michael Shadle wrote on 2009-10-26 06:48:
>>
>> Oct 25 22:00:01 sql02 php: PHP Warning:  mysqli_connect():
>> (HY000/2013): Lost connection to MySQL server at 'sending
>> authentication information', system error: 32 in
>> /home/foo/web/foo.com/core.php on line 2394
>>
>> It's either this or one or two others. What is odd is I have switched
>> to making it sockets only - doesn't seem to help. I think it was
>> anyway, it's all over localhost. It wasn't always like this either.
>
> I think it's related to network flaws, at least that was the understanding I
> had from the same problem, which occured some months ago at an ISP i'm
> using, but you're writing "all over localhost"?
>
> --
> Kind regards
> Kim Emax - masterminds.dk
>

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



Re: [PHP] Issues with MySQL connectivity ... on only one machine, and for a while now

2009-10-26 Thread Kim Madsen

Michael Shadle wrote on 2009-10-26 06:48:

Oct 25 22:00:01 sql02 php: PHP Warning:  mysqli_connect():
(HY000/2013): Lost connection to MySQL server at 'sending
authentication information', system error: 32 in
/home/foo/web/foo.com/core.php on line 2394

It's either this or one or two others. What is odd is I have switched
to making it sockets only - doesn't seem to help. I think it was
anyway, it's all over localhost. It wasn't always like this either.


I think it's related to network flaws, at least that was the 
understanding I had from the same problem, which occured some months ago 
at an ISP i'm using, but you're writing "all over localhost"?


--
Kind regards
Kim Emax - masterminds.dk

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