Re: [PHP] HTML errors

2011-01-13 Thread Pete Ford

On 12/01/11 14:13, Richard Quadling wrote:

On 12 January 2011 14:07, Steve Staples  wrote:

On Wed, 2011-01-12 at 13:40 +, Richard Quadling wrote:

On 12 January 2011 13:20, Steve Staples  wrote:

Jim,

Not to be a smart ass like Danial was (which was brilliantly written
though),  but you have your "example" formatted incorrectly.  You are
using commas instead of periods for concatenation, and it would have
thrown an error trying to run your example. :)

# corrected:
echo "{$replace}";

Steve Staples.


Steve,

The commas are not concatenation. They are separators for the echo construct.

I don't know the internals well enough, but ...

echo $a.$b.$c;

vs

echo $a, $b, $c;

On the surface, the first instance has to create a temporary variable
holding the results of the concatenation before passing it to the echo
construct.

In the second one, the string representations of each variable are
added to the output buffer in order with no need to create a temp var
first.

So, I think for large strings, using commas should be more efficient.

Richard.



Well... I have been learned.  I had no idea about doing it that way, I
apologize to you, Jim.

I guess my PHP-fu is not as strong as I had thought?

Thank you Richard for pointing out this to me,  I may end up using this
method from now on.  I have just always concatenated everything as a
force of habit.

Steve Staples.




I was never taught by nuns.



Eh? Oh I get it... (ugh!)
Surely PHP-fu is taught by monks?

--
Peter Ford, Developer phone: 01580 89 fax: 01580 893399
Justcroft International Ltd.  www.justcroft.com
Justcroft House, High Street, Staplehurst, Kent   TN12 0AH   United Kingdom
Registered in England and Wales: 2297906
Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS

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



[PHP] Rewriting string

2011-01-13 Thread David McGlone
Hi everyone,

I think the subject is right, or somewhere close. Anyway I am trying to 
perform a little trickery here with links. In the following code you can see 
where I am trying to replace the link on the current page so it's not a link 
when on that page. I think I got the general idea of what I need to do as you 
can see in the code I just don't know how to accomplish it, if it's possible.


$categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 
'testimonials');
foreach($categorys as $category){
$deadlink = $_GET['page'];
  
if ($deadlink == 'page') {

$replace = str_replace("_", " ", $category); 
echo "$deadlink";

} else {

$replace = str_replace("_", " ", $category); 
echo "$replace";

}
-- 
Blessings
David M.

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



Re: [PHP] Array Symbol Suggestion

2011-01-13 Thread Richard Quadling
On 12 January 2011 20:23,   wrote:
> Thanks for all the responses to my suggestion.  I realize this would be a 
> major change, so that's why I also mentioned it as an addition to the 
> language.
>
> I'm sure it's just what you're used to, but still being new to all this, it 
> just makes sense (to me anyway) to have different symbols for different 
> variable types:
> $scalar
> @array
> #hash
>
> Since the @ sign is already reserved, maybe there's another symbol that would 
> work better?  I don't know.  These are just ideas that I came up with while 
> reading and I thought I'd throw it out there to see what others thought.
>
> I like the idea of a naming convention, so that's what I'll do in my scripts. 
>  I also appreciate the heads up on is_string(), is_array(), and var_dump().
>
> Thanks again,
> Marc

PHP recently introduced namespaces to PHP5. One of the issues at the
time was the namespace separator. Do to all the common symbols already
being used, it was necessary to re-use one and the context dictates
its intent.

So whilst "\n" is the newline character, in the namespace string below

namespace my\namespaces\are\here;

the \n is not a newline.

With that, there are no common symbols available.



The Hungarian Notation [1] was what I was taught all those years ago
when I learnt standard C programming. I've kept that with me through
to PHP. Some say it is redundant in PHP. I suppose this is true, but
it works for me and doesn't really get in the way.

One thing to remember though is that PHP is a loosely typed language.
Having a mechanism which would somehow enforce the type based upon a
symbol would certainly be a different way of working for PHP.

This is mentioned in the [2] and is suggested to be a poor way of
working due to the lack of symbols in general.


Regards,

Richard.

[1] http://en.wikipedia.org/wiki/Hungarian_notation
[2] http://en.wikipedia.org/wiki/Hungarian_notation#Relation_to_sigils
-- 
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: [PHP] Rewriting string

2011-01-13 Thread Admin
Try this. 
After you create the array

If(in_array($_GET['page'],$categorys)){

}else{

}



Sent from my iPhone

On Jan 13, 2011, at 5:09 AM, David McGlone  wrote:

> Hi everyone,
> 
> I think the subject is right, or somewhere close. Anyway I am trying to 
> perform a little trickery here with links. In the following code you can see 
> where I am trying to replace the link on the current page so it's not a link 
> when on that page. I think I got the general idea of what I need to do as you 
> can see in the code I just don't know how to accomplish it, if it's possible.
> 
> 
> $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 
> 'testimonials');
> foreach($categorys as $category){
> $deadlink = $_GET['page'];
> 
> if ($deadlink == 'page') {
> 
> $replace = str_replace("_", " ", $category); 
> echo "$deadlink";
> 
> } else {
> 
> $replace = str_replace("_", " ", $category); 
> echo "$replace";
> 
> }
> -- 
> Blessings
> David 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



Re: [PHP] Closure and $this

2011-01-13 Thread Raymond Irving
Many thanks Larry.

I like the Closure::bind() method proposal.


Best regards
__
Raymond
Do more with less - http://raxanpdi.com

--- On Thu, 1/13/11, Larry Garfield  wrote:

From: Larry Garfield 
Subject: Re: [PHP] Closure and $this
To: php-general@lists.php.net
Date: Thursday, January 13, 2011, 1:57 AM

On Wednesday, January 12, 2011 11:37:19 pm Greg Bair wrote:
> On Wed, 12 Jan 2011 20:02:11 -0800 (PST)
> 
> Raymond Irving  wrote:
> > Hello,
> > Does anyone know if closures will ever support the $this keyword? 
> > I think it would be very useful when working with objects.
> > 
> > Best regards__RaymondDo more with less - http://raxanpdi.com
> 
> Probably not, and my understanding of why comes from this line from the
> docs (http://www.php.net/manual/en/functions.anonymous.php):
> 
> "Anonymous functions are currently implemented using the Closure class."
> 
> So, in other words, your closure does not belong to the class you
> declare it in, but the Closure class.
> 
>  Thus, if it supported the $this variable, it would refer not to the
>  class you want, but instead to the Closure class.
> 
> Just my understanding.  If it's not right, someone point it out.

Actually at one point early on they did support a $this, but the way it was 
bound to an object was half-assed and incomplete so it was removed entirely 
from 5.3.  The intent was to then properly think through how that binding 
should happen and re-introduce it properly in 5.4.  I believe a consensus was 
reached on how that should happen but I'm not sure what its implementation 
status is at present.

I believe this is the relevant RFC:

http://wiki.php.net/rfc/closures/object-extension

--Larry Garfield

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



[PHP] query strings and other delights

2011-01-13 Thread kbailey
I have circumstances which cause me to investigate get strings and  
such, and wish to start a thread discussing such matters. This relates  
to a cluster of functions iin php such as public array  
HttpQueryString::toArray ( void ) and it's bretherin and sisterin and  
otherin.


Being new to php, come here of the snake charming schhuol of python, I  
find there are rather interesting properties to h ow you get things  
done in this big tent.

SO; presume I want to send a querym, where there is a format:
http://www.foo.org/item1/delivery.php?item=name&code=DATA

we need to extract the string, bust it up, toss everything into a  
structure with data keyed with keywords, and march on. (I would have  
called that structure a dictionary, but that's under a different tent  
with the snake charmers).



I need to come up to speed with GET method and closely relating  
functions in php, Let's discuss this, and are there any good links to  
offer on the subject to pages of much interest and clue? Clue glue is  
in generous supply, but the feathers themselves are pretty scarce,  
snakes not having any.


Your turn! :-D

-kirk



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



Re: [PHP] query strings and other delights

2011-01-13 Thread Marc Guay
Give parse_str() a go.

http://ca.php.net/manual/en/function.parse-str.php

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



[PHP] Re: query strings and other delights

2011-01-13 Thread Nathan Rixham

kbai...@howlermonkey.net wrote:

Your turn! :-D


  $_GET

and if you do post.. (can you guess?)

  $_POST

usage:
  http://www.foo.org/item1/delivery.php?item=name&code=DATA

http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Rewriting string

2011-01-13 Thread Nathan Rixham

David McGlone wrote:

Hi everyone,

I think the subject is right, or somewhere close. Anyway I am trying to 
perform a little trickery here with links. In the following code you can see 
where I am trying to replace the link on the current page so it's not a link 
when on that page. I think I got the general idea of what I need to do as you 
can see in the code I just don't know how to accomplish it, if it's possible.



$categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 
'testimonials');

foreach($categorys as $category){
$deadlink = $_GET['page'];
  
if ($deadlink == 'page') {


for a short answer, all you need to do is change the above line to:

  if($deadlink == $category)

and as a slightly colourful variant:

$categorys = array('home', 'services', 'gallery', 'about_us', 
'contact_us', 'testimonials');

foreach($categorys as $category){
  $temp = str_replace("_", " ", $category);
  $_GET['page'] != $category && $temp = ''.$replace.'';

  echo "{$temp}" . PHP_EOL;
}

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



Re: [PHP] Re: query strings and other delights

2011-01-13 Thread kbailey
...Holy cow... nothing to extract the query string, it's automatically  
part of the environment. So I just do work with the $_GET string, it's  
in there already... yikes.



Quoting Nathan Rixham :


kbai...@howlermonkey.net wrote:

Your turn! :-D


  $_GET

and if you do post.. (can you guess?)

  $_POST

usage:
  http://www.foo.org/item1/delivery.php?item=name&code=DATA

OK, so $_GET is an array keyed to keywords; plug in the key, out comes  
the value. What if I just want the entire string?




Best,

Nathan

--
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] Array Symbol Suggestion

2011-01-13 Thread David Harkness
On Thu, Jan 13, 2011 at 2:23 AM, Richard Quadling wrote:

> The Hungarian Notation [1] was what I was taught all those years ago
> when I learnt standard C programming.


I learned it early on as well, and I never really liked it. Instead of
$iFish I would prefer a more descriptive name such as $fishCount. Sure, it's
a little longer to type, but it tells you what that number measures. In
today's world of objects and loosely-typed languages, a descriptive variable
name can be more important than a symbol or notation to hint at the type.

As for arrays, I always name the variable plural. And if it maps keys to
values instead of holding a list of items, I will typically name it
$foosByBar, e.g. $customersById. From that name I *know* it's array
already--no need for a prefix or special symbol.

$oPlayer, $sName, $iWidth...what's the point? The context in which the
variable is used can provide more meaning. If you stick to short
functions/methods that do one specific thing, you'll be able to tell that
$player is an object, $name is a string, and $width is an integer.

I highly recommend the book Clean Code: A Handbook of Agile
Software Craftsmanship by Robert C. Martin. [1] It has a lot of great advice
on keeping your code easy to understand, test, and maintain.

David

[1]
http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882


Re: [PHP] Re: query strings and other delights

2011-01-13 Thread Nathan Rixham

kbai...@howlermonkey.net wrote:
...Holy cow... nothing to extract the query string, it's automatically 
part of the environment. So I just do work with the $_GET string, it's 
in there already... yikes.


yup

OK, so $_GET is an array keyed to keywords; plug in the key, out comes 
the value. What if I just want the entire string?


$_SERVER['QUERY_STRING']

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



Re: [PHP] Array Symbol Suggestion

2011-01-13 Thread David Hutto
On Thu, Jan 13, 2011 at 12:59 PM, David Harkness
 wrote:
> On Thu, Jan 13, 2011 at 2:23 AM, Richard Quadling wrote:
>
>> The Hungarian Notation [1] was what I was taught all those years ago
>> when I learnt standard C programming.
>
>
> I learned it early on as well, and I never really liked it. Instead of
> $iFish I would prefer a more descriptive name such as $fishCount.


What info did you get on hook for the client?



Sure, it's
> a little longer to type, but it tells you what that number measures. In
> today's world of objects and loosely-typed languages, a descriptive variable
> name can be more important than a symbol or notation to hint at the type.
>
> As for arrays, I always name the variable plural. And if it maps keys to
> values instead of holding a list of items, I will typically name it
> $foosByBar, e.g. $customersById. From that name I *know* it's array
> already--no need for a prefix or special symbol.
>
> $oPlayer, $sName, $iWidth...what's the point? The context in which the
> variable is used can provide more meaning. If you stick to short
> functions/methods that do one specific thing, you'll be able to tell that
> $player is an object, $name is a string, and $width is an integer.
>
> I highly recommend the book Clean Code: A Handbook of Agile
> Software Craftsmanship by Robert C. Martin. [1] It has a lot of great advice
> on keeping your code easy to understand, test, and maintain.
>
> David
>
> [1]
> http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882
>



-- 
Sometimes...my mama...says I get over excited about technology.

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



[PHP] Re: query strings and other delights

2011-01-13 Thread Nathan Rixham

kbai...@howlermonkey.net wrote:

Your turn! :-D


just in case I totally misunderstood, and you simply have the string and 
want to rip out the component parts of the query string, then:


  Or similar, watch out for parse_str though as it'll swap out spaces and 
. for _ - which is nice.


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



Re: [PHP] Re: query strings and other delights

2011-01-13 Thread kbailey
Cool. SO, now it's in a string, I can chop, slice, dice, make  
gazillions of steak fries, and drive on. So, now we can munch a  
webpage with a query string as a KEY to unlock access to it, and use  
DIE to stop the process if it is not there, or is the correct key, so  
far making sense?




Quoting Nathan Rixham :


kbai...@howlermonkey.net wrote:
...Holy cow... nothing to extract the query string, it's  
automatically part of the environment. So I just do work with the  
$_GET string, it's in there already... yikes.


yup

OK, so $_GET is an array keyed to keywords; plug in the key, out  
comes the value. What if I just want the entire string?


$_SERVER['QUERY_STRING']






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



Re: [PHP] Array Symbol Suggestion

2011-01-13 Thread David Harkness
On Thu, Jan 13, 2011 at 10:07 AM, David Hutto  wrote:

> On Thu, Jan 13, 2011 at 12:59 PM, David Harkness
> > I learned it early on as well, and I never really liked it. Instead of
> > $iFish I would prefer a more descriptive name such as $fishCount.
>
> What info did you get on hook for the client?
>

The brain is so interesting. I have no idea where $iFish came from. I've
never done an application even remotely related to fishing or the fishing
industry. Not even a fish-based game. :)

David


Re: [PHP] Closure and $this

2011-01-13 Thread David Harkness
On Wed, Jan 12, 2011 at 10:57 PM, Larry Garfield wrote:

> I believe this is the relevant RFC:
>
> http://wiki.php.net/rfc/closures/object-extension
>

That was a good bedtime read last night, Larry. I prefer method A which is
nearly identical to Java's inner classes where $this would remain tied to
whatever it held when the closure was created and gain the object's scope. I
do like the idea of being able to explicitly bind the closure to a new
object as well.

That's all well and good come PHP 5.4 or 6.0, but for now you are limited to
holding a reference to $this without gaining its scope, i.e. you can only
access public members. Also, you must assign $this to a new variable because
you cannot pass $this in the use() clause.

$that = $this;
$closure = function(...) use ($that) { ... $that->property ...
$that->method() ... }

If you need access to a protected or private variable inside the closure,
you can pass a reference to it inside use(). Once again you need to first
assign the reference to a new variable and then pass that in to the closure.
Important: you must use the & operator in the use() clause as well as when
creating the reference.

class ClosureFactory
{
private $count = 0;

public function create() {
$ref = &$this->count;
return function() use (&$ref) {
return ++$ref;
};
}
}

$factory = new ClosureFactory();
$closure = $factory->create();

for ($i = 0; $i < 5; $i++) {
echo $closure();
}

Yields

12345

David


Re: [PHP] Re: Rewriting string

2011-01-13 Thread Admin
> $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 
> 'testimonials');
If(in_array($_GET['page'], $categories))
{
echo ''.str_replace("_"," 
",$_GET['page']).'';
}else{
echo ''.str_replace("_"," ",$_GET['page']).'';
}

I normally never write someones code for them but you are just not getting it.
The above code works use it.


> $deadlink = $_GET['page']; <-- useless
> 
> 
> 


On Jan 13, 2011, at 12:45 PM, Nathan Rixham  wrote:

> David McGlone wrote:
>> Hi everyone,
>> I think the subject is right, or somewhere close. Anyway I am trying to 
>> perform a little trickery here with links. In the following code you can see 
>> where I am trying to replace the link on the current page so it's not a link 
>> when on that page. I think I got the general idea of what I need to do as 
>> you can see in the code I just don't know how to accomplish it, if it's 
>> possible.
>> $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 
>> 'testimonials');
>> foreach($categorys as $category){
>> $deadlink = $_GET['page'];
>>  if ($deadlink == 'page') {
> 
> for a short answer, all you need to do is change the above line to:
> 
>  if($deadlink == $category)
> 
> and as a slightly colourful variant:
> 
> $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 
> 'testimonials');
> foreach($categorys as $category){
>  $temp = str_replace("_", " ", $category);
>  $_GET['page'] != $category && $temp = ''.$replace.'';
>  echo "{$temp}" . PHP_EOL;
> }
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


Re: [PHP] Re: Rewriting string

2011-01-13 Thread Nathan Rixham

Admin wrote:
$categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 
'testimonials');

If(in_array($_GET['page'], $categories))
{
echo ''.str_replace("_"," 
",$_GET['page']).'';
}else{
echo ''.str_replace("_"," ",$_GET['page']).'';
}

I normally never write someones code for them but you are just not getting it.
The above code works use it.


i assume you're joking - that code is simply going to give 6 list items 
all with the same value - $_GET['page']


please do check you know what you're talking about before you post.

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



Re: [PHP] Re: Rewriting string

2011-01-13 Thread Nathan Rixham

Nathan Rixham wrote:

Admin wrote:
$categorys = array('home', 'services', 'gallery', 'about_us', 
'contact_us', 'testimonials');

If(in_array($_GET['page'], $categories))
{
echo ''.str_replace("_"," 
",$_GET['page']).'';

}else{
echo ''.str_replace("_"," ",$_GET['page']).'';
}

I normally never write someones code for them but you are just not 
getting it.

The above code works use it.


i assume you're joking - that code is simply going to give 6 list items 
all with the same value - $_GET['page']


please do check you know what you're talking about before you post.


and ironically, that's wrong - it's only going to show it once, with or 
without a link, but isn't going to do what the OP wanted.


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



Re: [Fwd: Re: [PHP] Re: Rewriting string]

2011-01-13 Thread Daniel Brown
On Thu, Jan 13, 2011 at 16:31, Nathan Rixham  wrote:
> Dan, you misread, I fwd'd the email, that was Richards reply to me.
>
> You should know I don't reply to people in such a manner by now :)

Thought it was a bit odd, but in Gmail, it didn't show forwarding,
only a reply - seemingly written by you - underneath the headers, so I
thought it was a second reply by you to him.

So then seems there's more than one person who should know
what the $#%@ they're talking about before they reply.  ;-P

-- 

Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

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



[PHP] A bad design decision or pure genius?

2011-01-13 Thread li...@pruimphotography.com

Hey Everyone,

I have a question about php & javascript... Yes I know this forum is  
for php BUT I needed an opinion on where to look for stuff...


I have a application that I'm working on that uses google maps to  
display interactive maps (using javascript) on the website. I now have  
the need to display multiple maps on the same page and from what I can  
tell I have to create new instances and variables for all of them...


What I'm wondering is since I know very little javascript would it be  
bad to create a PHP function to write the java code for the proper  
number of maps I need to display? The map info is being pulled from a  
database where events are being added and could contain 2 or 200 maps...


Or should I learn javascript and figure out how to create a loop in  
there so that I can just loop it in the java and not repeat code?


Thanks for any assistance you can give!

Jason Pruim
pru...@gmail.com


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



Re: [PHP] A bad design decision or pure genius?

2011-01-13 Thread Joshua Kehn
On Jan 13, 2011, at 7:49 PM, li...@pruimphotography.com wrote:

> Hey Everyone,
> 
> I have a question about php & javascript... Yes I know this forum is for php 
> BUT I needed an opinion on where to look for stuff...
> 
> I have a application that I'm working on that uses google maps to display 
> interactive maps (using javascript) on the website. I now have the need to 
> display multiple maps on the same page and from what I can tell I have to 
> create new instances and variables for all of them...
> 
> What I'm wondering is since I know very little javascript would it be bad to 
> create a PHP function to write the java code for the proper number of maps I 
> need to display? The map info is being pulled from a database where events 
> are being added and could contain 2 or 200 maps...
> 
> Or should I learn javascript and figure out how to create a loop in there so 
> that I can just loop it in the java and not repeat code?
> 
> Thanks for any assistance you can give!
> 
> Jason Pruim
> pru...@gmail.com
> 
> 

Love the lists@ email address there.

My preference would be to invest some time in frontend (JavaScript) skills, as 
that would be the most "proper" way to implement it. If you don't have the 
time, might as well use whatever tools you are most comfortable with. Could 
turn into a bit of a mess though.

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com




Re: [PHP] A bad design decision or pure genius?

2011-01-13 Thread li...@pruimphotography.com


On Jan 13, 2011, at 7:54 PM, Joshua Kehn wrote:


On Jan 13, 2011, at 7:49 PM, li...@pruimphotography.com wrote:


Hey Everyone,

I have a question about php & javascript... Yes I know this forum  
is for php BUT I needed an opinion on where to look for stuff...


I have a application that I'm working on that uses google maps to  
display interactive maps (using javascript) on the website. I now  
have the need to display multiple maps on the same page and from  
what I can tell I have to create new instances and variables for  
all of them...


What I'm wondering is since I know very little javascript would it  
be bad to create a PHP function to write the java code for the  
proper number of maps I need to display? The map info is being  
pulled from a database where events are being added and could  
contain 2 or 200 maps...


Or should I learn javascript and figure out how to create a loop in  
there so that I can just loop it in the java and not repeat code?


Thanks for any assistance you can give!

Jason Pruim
pru...@gmail.com




Love the lists@ email address there.

My preference would be to invest some time in frontend (JavaScript)  
skills, as that would be the most "proper" way to implement it. If  
you don't have the time, might as well use whatever tools you are  
most comfortable with. Could turn into a bit of a mess though.


Hey Josh,

Yeah the lists@ address just makes it easier since I am syncing email  
with my smart phone I didn't want to get all of this list plus the  
many others I'm on to get synced... I doubt my phone could handle it  
hehehe.


In the long run I want to learn javascript... But this new requirement  
just popped up on me on a project that I was working on... So I was  
gauging what was going to be easier :)


Thanks for the response!



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



RE: [PHP] A bad design decision or pure genius?

2011-01-13 Thread Daevid Vincent
> -Original Message-
> From: li...@pruimphotography.com [mailto:li...@pruimphotography.com] 
> Sent: Thursday, January 13, 2011 4:50 PM
> To: php-general@lists.php.net
> Subject: [PHP] A bad design decision or pure genius? 
> 
> Hey Everyone,
> 
> I have a question about php & javascript... Yes I know this forum is  
> for php BUT I needed an opinion on where to look for stuff...
> 
> I have a application that I'm working on that uses google maps to  
> display interactive maps (using javascript) on the website. I 
> now have  
> the need to display multiple maps on the same page and from 
> what I can  
> tell I have to create new instances and variables for all of them...
> 
> What I'm wondering is since I know very little javascript 
> would it be  
> bad to create a PHP function to write the java code for the proper  
> number of maps I need to display? The map info is being 
> pulled from a  
> database where events are being added and could contain 2 or 
> 200 maps...
> 
> Or should I learn javascript and figure out how to create a loop in  
> there so that I can just loop it in the java and not repeat code?
> 
> Thanks for any assistance you can give!
> 
> Jason Pruim
> pru...@gmail.com

Not sure why you would need to show more than a single map at any given
time. Therefore why not use PHP to show a list of possible maps and when
the user clicks on one, use AJAX to populate a single map on demand?


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



Re: [PHP] A bad design decision or pure genius?

2011-01-13 Thread li...@pruimphotography.com


On Jan 13, 2011, at 8:53 PM, Daevid Vincent wrote:


-Original Message-
From: li...@pruimphotography.com [mailto:li...@pruimphotography.com]
Sent: Thursday, January 13, 2011 4:50 PM
To: php-general@lists.php.net
Subject: [PHP] A bad design decision or pure genius?

Hey Everyone,

I have a question about php & javascript... Yes I know this forum is
for php BUT I needed an opinion on where to look for stuff...

I have a application that I'm working on that uses google maps to
display interactive maps (using javascript) on the website. I
now have
the need to display multiple maps on the same page and from
what I can
tell I have to create new instances and variables for all of them...

What I'm wondering is since I know very little javascript
would it be
bad to create a PHP function to write the java code for the proper
number of maps I need to display? The map info is being
pulled from a
database where events are being added and could contain 2 or
200 maps...

Or should I learn javascript and figure out how to create a loop in
there so that I can just loop it in the java and not repeat code?

Thanks for any assistance you can give!

Jason Pruim
pru...@gmail.com


Not sure why you would need to show more than a single map at any  
given
time. Therefore why not use PHP to show a list of possible maps and  
when

the user clicks on one, use AJAX to populate a single map on demand?


Hey Daevid,

That is a great idea... The only issue is i don't know ajax yet :)

But it's on my list of things to do this year!

What I ended up doing is just putting a static image in which is  
generated automatically by google on the fly using the GPS coordinates  
that I supply, it places a marker on the image, and then it links into  
a full map where you can pan, zoom, get directions etc. etc.


So just needed to think out side the box a little bit!

And... For the archives... YES that would have been a bad design  
decision. It was a crutch to get me through until I can learn more  
javascript and start mastering that.


Thanks for the help! :)




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



Re: [PHP] Re: query strings and other delights

2011-01-13 Thread David Robley
kbai...@howlermonkey.net wrote:

> ...Holy cow... nothing to extract the query string, it's automatically
> part of the environment. So I just do work with the $_GET string, it's
> in there already... yikes.
> 
> 

You might find phpinfo() particularly useful as an indicator of how php is
configured and most of the built in variables such as environment
variables.

Also http://php.net/manual/en/language.variables.external.php
http://php.net/manual/en/reserved.variables.php

Spend a little while perusing the documentation at php.net - it is very
good. And php.net/function-name is a handy way of looking up a specific
function.



Cheers
-- 
David Robley

Diagonally parked in a parallel universe.
Today is Prickle-Prickle, the 14th day of Chaos in the YOLD 3177. 


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



[PHP] php-fpm does'nt work

2011-01-13 Thread mufenggu
hi, i just install nginx-0.8.54, php-5.3.5, mysql-5.5.8
in nginx.conf i pass .php file to php-fpm(127.0.0.1:9000)
i can get static file like index.html, but i got a blank page from
simple test.php file, there only one command:



and no errors print out, i set all display_errors=on, and it doesn't work.
i guess nginx can connect to php-fpm, but php-fpm seem to not intepret php file.

and i compile php against apache apxs2, it works!!!
can somebody help me out. thanks so much


Re: [PHP] php-fpm does'nt work

2011-01-13 Thread Sharl
check your nginx configuration.

mufenggu 编写:

>hi, i just install nginx-0.8.54, php-5.3.5, mysql-5.5.8
>in nginx.conf i pass .php file to php-fpm(127.0.0.1:9000)
>i can get static file like index.html, but i got a blank page from
>simple test.php file, there only one command:
>
>
>
>and no errors print out, i set all display_errors=on, and it doesn't work.
>i guess nginx can connect to php-fpm, but php-fpm seem to not intepret php 
>file.
>
>and i compile php against apache apxs2, it works!!!
>can somebody help me out. thanks so much