[PHP] postgresql database access failure

2011-04-30 Thread e-letter
Readers,

A postgresql database (local disk installation) is successfully
accessed as a normal user:

psql -U username databasename

However, creating a php file to access the database has not been successful.





why does this fail?




The following php code produces the user agent:



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



[PHP] Why Constants could Not be Array?

2011-04-30 Thread Walkinraven

For needing a constants=array, I have to use
'public static $a = array(...)'

instead.

Why the language could not relax the restriction of constants?

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



[PHP] dynamic copyright in page footer?

2011-04-30 Thread David Mehler
Hello,

I am trying to use php to put a copyright notice in a page footer. I'm
using the date function with the "Y" value for the year. Here's the
code:



This works great for a site done in 2011 but next year I'm going to
want to have 2011 and 2012 in the copyright notice, adding an
additional year the site's up. I'd appreciate some suggestions i'm
very likely overthinking this.

Thanks.
Dave.

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



Re: [PHP] dynamic copyright in page footer?

2011-04-30 Thread Simon J Welsh
On 30/04/2011, at 11:06 PM, David Mehler wrote:

> Hello,
> 
> I am trying to use php to put a copyright notice in a page footer. I'm
> using the date function with the "Y" value for the year. Here's the
> code:
> 
>  echo date ('Y');
> ?>
> 
> This works great for a site done in 2011 but next year I'm going to
> want to have 2011 and 2012 in the copyright notice, adding an
> additional year the site's up. I'd appreciate some suggestions i'm
> very likely overthinking this.
> 
> Thanks.
> Dave.

I would use something simple like:
if(date('Y') == '2011') {
echo '2011';
} else {
echo '2011-', date('Y');
}

---
Simon Welsh
Admin of http://simon.geek.nz/

Who said Microsoft never created a bug-free program? The blue screen never, 
ever crashes!

http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e


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



Re: [PHP] dynamic copyright in page footer?

2011-04-30 Thread dholmes1031
Something simple like this would work 
$date=date('Y');
$startdate='2011';
if($date == $startdate) {
echo $startdate
} else {
Echo $startdate;
Echo '-';
echo  $date;

}
Sent via BlackBerry from T-Mobile

-Original Message-
From: David Mehler 
Date: Sat, 30 Apr 2011 07:06:17 
To: php-general
Subject: [PHP] dynamic copyright in page footer?
Hello,

I am trying to use php to put a copyright notice in a page footer. I'm
using the date function with the "Y" value for the year. Here's the
code:



This works great for a site done in 2011 but next year I'm going to
want to have 2011 and 2012 in the copyright notice, adding an
additional year the site's up. I'd appreciate some suggestions i'm
very likely overthinking this.

Thanks.
Dave.

-- 
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] Re: Flattery will get you nowhere

2011-04-30 Thread Marc Guay
>  Dinna know bats even _had_ eyelids

They increase the effectiveness of evil spells by 50%, especially when
coupled with Frogs Tears (tm).

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



Re: [PHP] dynamic copyright in page footer?

2011-04-30 Thread Geoff Lane
On Saturday, April 30, 2011, Simon J Welsh wrote:

> I would use something simple like:
> if(date('Y') == '2011') {
> echo '2011';
> } else {
> echo '2011-', date('Y');
> }

... or in one line:

echo (date('Y') != '2011' ? '2011-' : '') . date('Y');

However, you might want to change that to:

echo '2011-' . date('Y');

at the first review after the start of 2012!

HTH,

-- 
Geoff


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



Re: [PHP] Why Constants could Not be Array?

2011-04-30 Thread Stuart Dallas
On Saturday, 30 April 2011 at 10:51, Walkinraven wrote:
For needing a constants=array, I have to use
> 'public static $a = array(...)'
> 
> instead.
> 
> Why the language could not relax the restriction of constants?

As I understand it constants must be declarations not evaluations because 
they're initialised during parsing not execution. Arrays are evaluations even 
if they only contain literal values. It could be done, but it would require a 
fundamental change to the engine and the benefit-cost calculation just doesn't 
add up.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/






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



Re: [PHP] Wiki formatting class or something similar

2011-04-30 Thread Stuart Dallas
On Friday, 29 April 2011 at 22:04, Andre Polykanine wrote:
Hi everyone,
> I allow my users to put some Html into their blogs. I filter it using
> a great tool called HtmLawed and written by Dr. Santosh Patnaik (if
> you're reading this, many thanks to you!).
> However, I would like to give them a possibility to mark-up their text
> in a more convenient way for beginners (such as Wiki or something
> similar).
> I searched through http://phpclasses.org/ but didn't find anything.
> Could you suggest me something?
> And one more question: maybe some of you already have a handy solution
> to process smilies? Say, a user writes ":)" and this is replaced by an
> image in my directory.
> Thanks in advance!

Markdown is a pretty good option for a wiki: 
http://michelf.com/projects/php-markdown/

Textile is another option (and supports tables which markdown does not): 
http://textile.thresholdstate.com/

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/






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



Re: [PHP] gd Graphics Library Question (EXIF)

2011-04-30 Thread Stuart Dallas
On Saturday, 30 April 2011 at 03:32, Mitch wrote:
I was wondering about that. Since I am not actually hosting my ISP would 
> have to have it loaded (or compiled into their PHP implementation), right?

You may be able to use http://php.net/dl to load the extension (you'll need to 
build it to be compatible with your host and then upload it) but it's highly 
unlikely they'll have the dl function enabled. Your best bet is to ask them to 
add it to their environment.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/



> On 4/29/2011 9:26 AM, Stuart Dallas wrote:
> > On Friday, 29 April 2011 at 03:33, Mitch wrote:
> > I have written a lightweight, easy to use photo album "system" in
> > > HTML/PHP/MySQL.In addition to the Photo Album side I have written a
> > > series of Admin Utilities to manage it with. One of the administrative
> > > utilities uploads photos from my local drive, resizes them to be more
> > > efficient on disk space, creates thumbnails and populates the database
> > > with as much "default" data as can be deduced.
> > > 
> > > After all of this was written, I decided to see if I could pull EXIF
> > > data to supply some of the technical data for the DB. To my surprise,
> > > the only EXIF data in the JPEG files was data in the File, Computed and
> > > Comments sections.
> > > 
> > > Why don't the gd utilities retain the original EXIF data? Is there any
> > > way to do so? I use the following gd utilities to resize and create the
> > > new JPEG image files:
> > > 
> > > imagecreatefromjpeg
> > > imagesx
> > > imagesy
> > > imagercreatetruecolor
> > > imagecopyresized
> > > imagejpeg
> > 
> > This is a known shortcoming of the GD library. You won't have that issue 
> > with ImageMagick: http://php.net/book.imagick
> > 
> > -Stuart
> 
> 
> -- 
> 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] What's faster using if else or arrays?

2011-04-30 Thread Stuart Dallas
On Saturday, 30 April 2011 at 03:17, Tamara Temple wrote:

> On Apr 29, 2011, at 8:32 AM, Robert Cummings wrote:
> 
> > On 11-04-29 08:04 AM, Steve Staples wrote:
> > > On Thu, 2011-04-28 at 19:19 -0400, Robert Cummings wrote:
> > > > On 11-04-28 06:37 PM, dholmes1...@gmail.com wrote:
> > > > > Thanks switch and case seems to be more faster for the job and a 
> > > > > lot cleaner
> > > > > --Original Message--
> > > > > From: Andre Polykanine
> > > > > To: dholmes1...@gmail.com
> > > > > Cc: php-general@lists.php.net
> > > > > Subject: Re: [PHP] What's faster using if else or arrays?
> > > > > Sent: Apr 28, 2011 6:17 PM
> > > > > 
> > > > > Hello Dholmes1031,
> > > > > 
> > > > > I would write it like this:
> > > > > switch($foo) {
> > > > >  case 5: $dothis; break;
> > > > > case 3: $dothat; break;
> > > > > default: $donothing; break;
> > > > > }
> > > > 
> > > > This sounds like a job for *dun dun dun* GOTO!
> > > > 
> > > > Kidding, of course ;)
> > > > 
> > > > Cheers,
> > > > Rob.
> > > > --
> > > 
> > > you should be removed and banned from this list for even just 
> > > THINKING
> > > about using a GOTO! :P
> > > 
> > > (yes, there are still *SOME* (and i use that loosely) benefits to the
> > > GOTO command, but in reality, no.)
> 
> People, people, don't you realize that break IS a goto?? It's just one 
> of limited scope.

By that logic, so is a function call.

Hey, hey... what do you call a group of gotos?

.

.

.

A CLASS!! Bwhahahahahahahahaha. Not!

Happy Saturday all :)

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/





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



Re: [PHP] Wiki formatting class or something similar

2011-04-30 Thread Peter Lind
On 30 April 2011 15:13, Stuart Dallas  wrote:
> On Friday, 29 April 2011 at 22:04, Andre Polykanine wrote:
> Hi everyone,
>> I allow my users to put some Html into their blogs. I filter it using
>> a great tool called HtmLawed and written by Dr. Santosh Patnaik (if
>> you're reading this, many thanks to you!).
>> However, I would like to give them a possibility to mark-up their text
>> in a more convenient way for beginners (such as Wiki or something
>> similar).
>> I searched through http://phpclasses.org/ but didn't find anything.
>> Could you suggest me something?
>> And one more question: maybe some of you already have a handy solution
>> to process smilies? Say, a user writes ":)" and this is replaced by an
>> image in my directory.
>> Thanks in advance!
>
> Markdown is a pretty good option for a wiki: 
> http://michelf.com/projects/php-markdown/
>
> Textile is another option (and supports tables which markdown does not): 
> http://textile.thresholdstate.com/
>

MarkItUp is a favourite plugin editor of mine - will allow you to work
with a lot of different syntaxes and users don't need to know them.

http://markitup.jaysalvat.com/home/

If you're considering sanitizing html instead of using a markup
language to convert into html, I'd read
http://blog.astrumfutura.com/2010/08/html-sanitisation-the-devils-in-the-details-and-the-vulnerabilities/
before settling on any tool to do the job. Far as I can tell, HtmLawed
isn't actually capable of sanitizing properly, according to the author
- unless it's since been updated to fix the problems mentioned in the
blog.

Regards
Peter

-- 

WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15


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



[PHP] Re: dynamic copyright in page footer?

2011-04-30 Thread Nathan Rixham

David Mehler wrote:

Hello,

I am trying to use php to put a copyright notice in a page footer. I'm
using the date function with the "Y" value for the year. Here's the
code:




echo implode(",", range(2011,date("Y")));

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



Re: [PHP] Re: dynamic copyright in page footer?

2011-04-30 Thread Mark Kelly
On Saturday 30 Apr 2011 at 14:28 Nathan Rixham wrote:

> echo implode(",", range(2011,date("Y")));

What an elegant solution! Thank you.

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



Re: [PHP] postgresql database access failure

2011-04-30 Thread Daniel Brown
Readers?  Sounds like you spend too much time writing newsletters
(to the wrong address, since php-general-digest-h...@lists.php.net is
a self-help command list for digest-form subscriptions).  ;-P

On Sat, Apr 30, 2011 at 04:41, e-letter  wrote:
>                        $db = pg_connect('dbname=databasename user=username');
>                $query = 'SELECT * FROM databasename';
>                $value=pg_fetch_result($query,1,0);
>                echo 'export of database is ',$value,'';
>        ?>
>        
>                why does this fail?

How is it failing?  What error(s) are you seeing on screen or in
your log files?  Noting that $value would contain an array, is that
the problem?  And why are you using ending quotes in your echo?  You
should just place the semicolon immediately after $value.

>        
>        
> 
>
> The following php code produces the user agent:
>
>                        echo '$_SERVER['HTTP_USER_AGENT']';
>        ?>

First of all, no it doesn't.  Placed inside single quotes, it'll
not only try to return it verbatim (i.e. - the variable would be
printed to screen), but it'll also cause a parse error, as you reuse
single quotes in the variable key container.

-- 

Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] postgresql database access failure

2011-04-30 Thread Daniel Brown
On Sat, Apr 30, 2011 at 12:23, Daniel Brown  wrote:
>>
>>        >                echo '$_SERVER['HTTP_USER_AGENT']';
>>        ?>
>
>    First of all, no it doesn't.  Placed inside single quotes, it'll
> not only try to return it verbatim (i.e. - the variable would be
> printed to screen), but it'll also cause a parse error, as you reuse
> single quotes in the variable key container.

Forgot the "second of all" before hitting send.

Second of all, what does this have to do with your PostgreSQL
problem?  Did I miss something?

-- 

Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] dynamic copyright in page footer?

2011-04-30 Thread Lars Nielsen
lør, 30 04 2011 kl. 11:18 +, skrev dholmes1...@gmail.com:
> Something simple like this would work 
> $date=date('Y');
> $startdate='2011';
> if($date == $startdate) {
> echo $startdate
> } else {
> Echo $startdate;
> Echo '-';
> echo  $date;
> 
> }
> Sent via BlackBerry from T-Mobile
> 
> -Original Message-
> From: David Mehler 
> Date: Sat, 30 Apr 2011 07:06:17 
> To: php-general
> Subject: [PHP] dynamic copyright in page footer?
> Hello,
> 
> I am trying to use php to put a copyright notice in a page footer. I'm
> using the date function with the "Y" value for the year. Here's the
> code:
> 
>  echo date ('Y');
> ?>
> 
> This works great for a site done in 2011 but next year I'm going to
> want to have 2011 and 2012 in the copyright notice, adding an
> additional year the site's up. I'd appreciate some suggestions i'm
> very likely overthinking this.
> 
> Thanks.
> Dave.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
Hi there,

I have been using the following little chunk:



Regards 
Lars Nielsen

http://www.lfweb.dk


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



Re: [PHP] Why Constants could Not be Array?

2011-04-30 Thread Andre Polykanine
Hello Walkinraven,

I use serialize for that.
define("MY_CONSTANT", serialize(array("1", "2", "hello")));

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Walkinraven 
To: php-general@lists.php.net
Date created: , 12:51:15 PM
Subject: [PHP] Why Constants could Not be Array?


  For needing a constants=array, I have to use
'public static $a = array(...)'

instead.

Why the language could not relax the restriction of constants?

-- 
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] dynamic copyright in page footer?

2011-04-30 Thread Andre Polykanine
Hello Dave,

echo "Copyright © Dave Mehler, 2011 — ".date("Y")."";

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: David Mehler 
To: php-general
Date created: , 2:06:17 PM
Subject: [PHP] dynamic copyright in page footer?


  Hello,

I am trying to use php to put a copyright notice in a page footer. I'm
using the date function with the "Y" value for the year. Here's the
code:



This works great for a site done in 2011 but next year I'm going to
want to have 2011 and 2012 in the copyright notice, adding an
additional year the site's up. I'd appreciate some suggestions i'm
very likely overthinking this.

Thanks.
Dave.

-- 
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] Why Constants could Not be Array?

2011-04-30 Thread Stuart Dallas
On Saturday, 30 April 2011 at 17:52, Andre Polykanine wrote:
Hello Walkinraven,
> 
> I use serialize for that.
> define("MY_CONSTANT", serialize(array("1", "2", "hello")));
> 
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile
> My blog: http://oire.org/menelion (mostly in Russian)
> Twitter: http://twitter.com/m_elensule
> Facebook: http://facebook.com/menelion

That's not a class constant. That type of constant is not defined until that 
line is executed (so an array is a valid value), whereas class constants are 
declared when the file is parsed.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


>  Original message 
> From: Walkinraven 
> To: php-general@lists.php.net
> Date created: , 12:51:15 PM
> Subject: [PHP] Why Constants could Not be Array?
> 
> 
>  For needing a constants=array, I have to use
> 'public static $a = array(...)'
> 
> instead.
> 
> Why the language could not relax the restriction of constants?
> 
> -- 
> 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Wiki formatting class or something similar

2011-04-30 Thread Andre Polykanine
Hello Peter,

And what would you recommend as an Html sanitizing tool?

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Peter Lind 
To: Stuart Dallas
Date created: , 4:26:41 PM
Subject: [PHP] Wiki formatting class or something similar


  On 30 April 2011 15:13, Stuart Dallas  wrote:
> On Friday, 29 April 2011 at 22:04, Andre Polykanine wrote:
> Hi everyone,
>> I allow my users to put some Html into their blogs. I filter it using
>> a great tool called HtmLawed and written by Dr. Santosh Patnaik (if
>> you're reading this, many thanks to you!).
>> However, I would like to give them a possibility to mark-up their text
>> in a more convenient way for beginners (such as Wiki or something
>> similar).
>> I searched through http://phpclasses.org/ but didn't find anything.
>> Could you suggest me something?
>> And one more question: maybe some of you already have a handy solution
>> to process smilies? Say, a user writes ":)" and this is replaced by an
>> image in my directory.
>> Thanks in advance!
>
> Markdown is a pretty good option for a wiki: 
> http://michelf.com/projects/php-markdown/
>
> Textile is another option (and supports tables which markdown does not): 
> http://textile.thresholdstate.com/
>

MarkItUp is a favourite plugin editor of mine - will allow you to work
with a lot of different syntaxes and users don't need to know them.

http://markitup.jaysalvat.com/home/

If you're considering sanitizing html instead of using a markup
language to convert into html, I'd read
http://blog.astrumfutura.com/2010/08/html-sanitisation-the-devils-in-the-details-and-the-vulnerabilities/
before settling on any tool to do the job. Far as I can tell, HtmLawed
isn't actually capable of sanitizing properly, according to the author
- unless it's since been updated to fix the problems mentioned in the
blog.

Regards
Peter

-- 

WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15



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



Re: [PHP] Wiki formatting class or something similar

2011-04-30 Thread Peter Lind
On 30 April 2011 21:26, Andre Polykanine  wrote:
> Hello Peter,
>
> And what would you recommend as an Html sanitizing tool?
>

I go by htmlpurifier when I need to sanitize html. I generally try to
avoid the issue though, by having users use other markup languages (I
like markdown but dislike textile). That's much faster and just as
secure - downside is that your users might not be as used to it.

Regards
Peter

-- 

WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15


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



[PHP] Spaces in filename or path

2011-04-30 Thread Tim Streater
Does it matter to PHP filesystem functions if a path/to/file/name contains 
spaces? IOW, is this handled OK by design or should I replaces such spaces by 
backslash-space or would doing that present problems?

Thanks  --  tim


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

Re: [PHP] Spaces in filename or path

2011-04-30 Thread Richard Quadling
On 30 April 2011 22:07, Tim Streater  wrote:
> Does it matter to PHP filesystem functions if a path/to/file/name contains 
> spaces? IOW, is this handled OK by design or should I replaces such spaces by 
> backslash-space or would doing that present problems?
>
> Thanks  --  tim

On Windows, PHP will happily access files and directories with spaces...



If you intend to pass the filename to a command line tool, then the
filename must be wrapped with double quotes ...



If you intend to pass the filename to a command line tool and the tool
has spaces in the name too, then you need to wrap both with quotes ...



If you are using a version of PHP before V5.3.0, please read
http://uk.php.net/manual/en/function.exec.php#101579. Your code would
need to be ...



I've added some _ to that so you can easily see the single and double
quotes ... (they aren't part of the real code, just there to show you
the quotes) ...




-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: Re: [PHP] Spaces in filename or path

2011-04-30 Thread Tim Streater
On 30 Apr 2011 at 22:33, Richard Quadling  wrote: 

> On 30 April 2011 22:07, Tim Streater  wrote:
>> Does it matter to PHP filesystem functions if a path/to/file/name contains
>> spaces? IOW, is this handled OK by design or should I replaces such spaces by
>> backslash-space or would doing that present problems?
>>
>> Thanks  --  tim
>
> On Windows, PHP will happily access files and directories with spaces...

Richard,

I'll be doing this under OS X. I will be passing such paths/names to shell 
scripts too, but AIUI I can use escapeshellarg () there. As long as PHP 
filesystem functions don't have a problem then I should be OK.

Cheers  --  tim


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

Re: Re: [PHP] Spaces in filename or path

2011-04-30 Thread Ashley Sheridan
"Tim Streater"  wrote:

>On 30 Apr 2011 at 22:33, Richard Quadling  wrote:
>
>> On 30 April 2011 22:07, Tim Streater  wrote:
>>> Does it matter to PHP filesystem functions if a path/to/file/name
>contains
>>> spaces? IOW, is this handled OK by design or should I replaces such
>spaces by
>>> backslash-space or would doing that present problems?
>>>
>>> Thanks  --  tim
>>
>> On Windows, PHP will happily access files and directories with
>spaces...
>
>Richard,
>
>I'll be doing this under OS X. I will be passing such paths/names to
>shell scripts too, but AIUI I can use escapeshellarg () there. As long
>as PHP filesystem functions don't have a problem then I should be OK.
>
>Cheers  --  tim
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

MacOS treats spaces the same as Linux. Like Richard said, you can use quotes if 
you're passing things to the shell, and also a backslash will work too. The 
only thing I would avoid if possible is spaces in paths that would reach the 
client side, i.e. in image paths, css files, etc, as I've heard historic 
browsers have trouble sometimes escaping the spaces automatically.


Thanks
Ash
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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



Re: [PHP] Re: dynamic copyright in page footer?

2011-04-30 Thread Sharl.Jimh.Tsin
it is very useful to me.thanks.

Best regards,
Sharl.Jimh.Tsin (From China **Obviously Taiwan INCLUDED**)



2011/4/30 Mark Kelly :
> On Saturday 30 Apr 2011 at 14:28 Nathan Rixham wrote:
>
>> echo implode(",", range(2011,date("Y")));
>
> What an elegant solution! Thank you.
>
> --
> 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