Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread tamouse mailing lists
OT Reply -- just frustrated with the way email screws up program
listings. It's a royal pain to have to strip out code and then put it
in an editor and tidy it up just to be able to make heads or tails out
of something. There are lots of code pasting sites around, but that
breaks up the continuity of the list archive. No solution, just
frustrated

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



RES: [PHP] Dynamic Content thoughts

2012-08-24 Thread Samuel Lopes Grigolato
Do you mean the  quotation marks? Have you tried to create a simple 
Notepad++ macro? I do this for things like formatting SQL from SQL Editor to 
SQL String in code, and vice versa.

Cheers.

-Mensagem original-
De: tamouse mailing lists [mailto:tamouse.li...@gmail.com] 
Enviada em: sexta-feira, 24 de agosto de 2012 12:02
Para: php-general@lists.php.net
Assunto: Re: [PHP] Dynamic Content thoughts

OT Reply -- just frustrated with the way email screws up program listings. It's 
a royal pain to have to strip out code and then put it in an editor and tidy it 
up just to be able to make heads or tails out of something. There are lots of 
code pasting sites around, but that breaks up the continuity of the list 
archive. No solution, just frustrated

--
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 Content thoughts

2012-08-24 Thread Matijn Woudt
On Fri, Aug 24, 2012 at 5:01 PM, tamouse mailing lists
tamouse.li...@gmail.com wrote:
 OT Reply -- just frustrated with the way email screws up program
 listings. It's a royal pain to have to strip out code and then put it
 in an editor and tidy it up just to be able to make heads or tails out
 of something. There are lots of code pasting sites around, but that
 breaks up the continuity of the list archive. No solution, just
 frustrated

You're absolutely right, it frustrates me too pretty often. Perhaps we
should make it a guideline to do both? The active followers will be
able to read the code at one of the code pasting sites, and the
archives still have the code.

- Matijn

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



Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread Jim Lucas

On 08/24/2012 08:01 AM, tamouse mailing lists wrote:

OT Reply -- just frustrated with the way email screws up program
listings. It's a royal pain to have to strip out code and then put it
in an editor and tidy it up just to be able to make heads or tails out
of something. There are lots of code pasting sites around, but that
breaks up the continuity of the list archive. No solution, just
frustrated



This list does allow attachments, but that breaks things too, because 
they are not shown on archive web sites.


--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
My test attachment
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread David OBrien
On Fri, Aug 24, 2012 at 11:16 AM, Jim Lucas li...@cmsws.com wrote:

 On 08/24/2012 08:01 AM, tamouse mailing lists wrote:

 OT Reply -- just frustrated with the way email screws up program
 listings. It's a royal pain to have to strip out code and then put it
 in an editor and tidy it up just to be able to make heads or tails out
 of something. There are lots of code pasting sites around, but that
 breaks up the continuity of the list archive. No solution, just
 frustrated


 This list does allow attachments, but that breaks things too, because they
 are not shown on archive web sites.

 --
 Jim Lucas

 http://www.cmsws.com/
 http://www.cmsws.com/examples/

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


In gmail if I see something is totally screwed up visually I click the
little dropdown where you'd select reply to all and then choose show
original...
It shows the source of the email in monospaced font so if looks like it was
meant to


Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread Matijn Woudt
On Fri, Aug 24, 2012 at 5:22 PM, Jim Lucas li...@cmsws.com wrote:
 Two simple guide lines will help everybody here.

 1) Limit your lines to 80 characters
 2) Use spaces instead of Tabs


Are we going to discuss coding guidelines again? The 80-character
limit is outdated, 100 or 120 is more common today.
And while I do agree with the spaces, do you also insist on 2, 4 or ..
spaces? ;)
Oh and I'd like everybody to put the opening brackets on the same line.. bla bla

My point is: It's not going to happen.

- Matijn

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



Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread Jim Lucas

On 08/24/2012 08:25 AM, Matijn Woudt wrote:

On Fri, Aug 24, 2012 at 5:22 PM, Jim Lucasli...@cmsws.com  wrote:

Two simple guide lines will help everybody here.

1) Limit your lines to 80 characters
2) Use spaces instead of Tabs



Are we going to discuss coding guidelines again? The 80-character
limit is outdated, 100 or 120 is more common today.
And while I do agree with the spaces, do you also insist on 2, 4 or ..
spaces? ;)
Oh and I'd like everybody to put the opening brackets on the same line.. bla bla

My point is: It's not going to happen.

- Matijn


This has absolutely nothing to do with your own personal coding styles. 
 This has only to do with how you are going to present code to the list 
members.


Personally, I let my code ramble on as long a line as it needs.  I use 
tabs (set to 8 chars) in my code.  That is because the other developers 
that I work with have editors that can display the tabs in whatever 
width they desire.  I also do not wrap at 80 chars.


But if you look back at any of my code examples that I have written, 
none of them are longer then 80 characters, and uses two spaces for 
indentation.  Simply because my email client is set to plain text and 
wraps at 80 chars.


--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/

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



Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread Matijn Woudt
On Fri, Aug 24, 2012 at 5:33 PM, Jim Lucas li...@cmsws.com wrote:
 On 08/24/2012 08:25 AM, Matijn Woudt wrote:

 On Fri, Aug 24, 2012 at 5:22 PM, Jim Lucasli...@cmsws.com  wrote:

 Two simple guide lines will help everybody here.

 1) Limit your lines to 80 characters
 2) Use spaces instead of Tabs


 Are we going to discuss coding guidelines again? The 80-character
 limit is outdated, 100 or 120 is more common today.
 And while I do agree with the spaces, do you also insist on 2, 4 or ..
 spaces? ;)
 Oh and I'd like everybody to put the opening brackets on the same line..
 bla bla

 My point is: It's not going to happen.

 - Matijn


 This has absolutely nothing to do with your own personal coding styles.
 This has only to do with how you are going to present code to the list
 members.

So you expect people to convert all their code to a 'mailing list
standard' before posting? Still not going to see that happen..


 Personally, I let my code ramble on as long a line as it needs.  I use tabs
 (set to 8 chars) in my code.  That is because the other developers that I
 work with have editors that can display the tabs in whatever width they
 desire.  I also do not wrap at 80 chars.

 But if you look back at any of my code examples that I have written, none of
 them are longer then 80 characters, and uses two spaces for indentation.
 Simply because my email client is set to plain text and wraps at 80 chars.

I can see that you do that indeed, but that does *not* guarantee that
it is also seen that way. I think most of us use a 'smart' mail
client, that automatically makes emails more readable by undoing these
stupid line breaks at 80 chars. Gmail for example shows your mail as
lines with approx 175 chars on my 17 notebook.. I'm not sure how
Gmail sends my messages, but looking at the 'Show original' option, it
seems it breaks long lines but might be at a different length too.

- Matijn

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



Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread tamouse mailing lists
On Thu, Aug 23, 2012 at 2:51 PM, admin ad...@buskirkgraphics.com wrote:
 Hello everyone,

 In my quest to build bigger and better dynamic content, I am
 putting forth a concept to see what you all think.

 Many times I come across customers who want drop down menus dynamically
 built from database tables.



 Old way Example:

 Echo 'SELECT ID=personneloption value='0'--Please  Select--/option';

 $query = SELECT * FROM personnel ORDER BY last_name;

 $result = mysql_query($query);

 If(mysql_num_rows($result) = 1)

 {

 While($row = mysql_fetch_assoc($result))

 {

 Echo option value='.$row['ID'].'.$row['first_name'].
 .$row['last_name']./option;

 }

 }

 Echo '/select';

 *



 I am purposing a Method for this that has some flexibility.



 Initialize Object:  $yourobject = new yourclass();

 Call method: // The call design is just so you have a better understanding
 of my concept

 $dropdown = $yourobject- dropmenu('personnell','ID',array(0 =
 'first_name', 1 = 'last_name'), 'last_name');



 Function dropmenu($table,$fieldforvalue,$fieldstodisplay,$fieldorder)  //
 Yes you could add some WHERE filters as well

 {

 $arraytoreturn = array();

 If(strlen($table) = 3){

 if(is_array($fieldstodisplay)){

 $count = 0;

 foreach($fieldstodisplay as $key=$values){

 if(strlen($values) =3){

 If($count == 0){

 $fields = $values;

 }else{

 $fields . = ,.$values;

 }

 $count++;

 }


 }

 }else{

 If(strlen(($fieldstodisplay) = 1){

 $fields = $fieldstodisplay;

 $fieldstodisplay = array(0
 =$fieldstodisplay);

 }else{

 Return $arraytoreturn; // Return nothing
 because no field was selected.

 }

 }

 }else{

 Return $arraytoreturn; // Return nothing because no table was selected.

 }

 If(strlen($fieldorder) = 3) {

 $orderfilter =  ORDER BY .$fieldorder. ;

 }else{

 $orderfilter = ;

 }

 $query = SELECT .$fields. FROM .$table. .$orderfilter. ;

 $result = mysql_query($query);

 If(mysql_num_rows($result) = 1)

 {

 $arraytoreturn[] = option value=0--Please Select--/option;

 While($row = mysql_fetch_assoc($result))

 {

 $display_fields   = ;

 Foreach($fieldstodisplay as $key=$values){

 $display_fields  .= $row[$values]. ;

 }

 If(strlen($fieldforvalue = 3){

 $arraytoreturn[] = option
 value='.$row[$fieldforvalue].'.$display_fields  ./option;

 }else{

 $arraytoreturn[] = option.$display_fields  ./option;

 }

 }

 Return $arraytoreturn;

 }else{

 Return $arraytoreturn; // Nothing to return.

 }

 }



 Now I can call the drop downs driven by database tables dynamically and It
 saves me a TON of time.

 Echo 'SELECT ID=personnel';

 Foreach($dropdown as $key=$values){

 Echo $values;

 }

 Echo '/select';





 Richard L. Buskirk

 Some of the world's greatest feats were accomplished by people not smart
 enough to know they were impossible

Some things you may want to consider in extending this:

* The separation of code and data is important to consider; this sort
of function, for me, falls into the grey area in between; I often have
built up the array of options and other elements of the select and
then have passed it onto the portion of the app that handles views,
keeping any sort of HTML out of the way of the database queries, etc.
Encapsulating this in a single class brings up the issues of data base
agnosticism as well.

* Often times, on a form, one may want to include a label for the
select statement.

* At some point, you may want to use the selected attribute in one
of the options.

My HTML selects typically have the following form:

label for=dyn_selectSelect the appropriate item:/label
select name=dyn_select id=dyn_select
  option value=opt1Item One/option
  option value=opt2 selected=selectedItem Two/option
/select

The code I use that generates this is at http://pastebin.com/SZYN5qgv

The call would be something like:

echo dynamic_select(array('opt1'='Item One','opt2'='Item
Two'),'dyn_select','Select the appropriate item:','opt2');

The first parameter can obviously be an array created from a database
query using whatever database methods you'd like: mysql, mysqli, pg_*,
PDO, etc.

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

Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread tamouse mailing lists
On Fri, Aug 24, 2012 at 10:11 AM, Samuel Lopes Grigolato
samuel.grigol...@gmail.com wrote:
 Do you mean the  quotation marks? Have you tried to create a simple 
 Notepad++ macro? I do this for things like formatting SQL from SQL Editor to 
 SQL String in code, and vice versa.

No, I mean the way the code is mangled with premature line breaks, bad
indenting, and other such things. As I tend to view my email via a
webmail interface (sucks, but there I am) it is subject to whatever
whims and fancies of the originator's program and gmail's output.

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



Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread tamouse mailing lists
On Fri, Aug 24, 2012 at 10:16 AM, Jim Lucas li...@cmsws.com wrote:
 On 08/24/2012 08:01 AM, tamouse mailing lists wrote:

 OT Reply -- just frustrated with the way email screws up program
 listings. It's a royal pain to have to strip out code and then put it
 in an editor and tidy it up just to be able to make heads or tails out
 of something. There are lots of code pasting sites around, but that
 breaks up the continuity of the list archive. No solution, just
 frustrated


 This list does allow attachments, but that breaks things too, because they
 are not shown on archive web sites.

Wow, I did not know it even allowed attachments.

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



Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread tamouse mailing lists
On Fri, Aug 24, 2012 at 10:47 AM, Matijn Woudt tijn...@gmail.com wrote:
 On Fri, Aug 24, 2012 at 5:33 PM, Jim Lucas li...@cmsws.com wrote:
 On 08/24/2012 08:25 AM, Matijn Woudt wrote:

 On Fri, Aug 24, 2012 at 5:22 PM, Jim Lucasli...@cmsws.com  wrote:

 Two simple guide lines will help everybody here.

 1) Limit your lines to 80 characters
 2) Use spaces instead of Tabs


 Are we going to discuss coding guidelines again? The 80-character
 limit is outdated, 100 or 120 is more common today.
 And while I do agree with the spaces, do you also insist on 2, 4 or ..
 spaces? ;)
 Oh and I'd like everybody to put the opening brackets on the same line..
 bla bla

 My point is: It's not going to happen.

 - Matijn


 This has absolutely nothing to do with your own personal coding styles.
 This has only to do with how you are going to present code to the list
 members.

 So you expect people to convert all their code to a 'mailing list
 standard' before posting? Still not going to see that happen..


 Personally, I let my code ramble on as long a line as it needs.  I use tabs
 (set to 8 chars) in my code.  That is because the other developers that I
 work with have editors that can display the tabs in whatever width they
 desire.  I also do not wrap at 80 chars.

 But if you look back at any of my code examples that I have written, none of
 them are longer then 80 characters, and uses two spaces for indentation.
 Simply because my email client is set to plain text and wraps at 80 chars.

 I can see that you do that indeed, but that does *not* guarantee that
 it is also seen that way. I think most of us use a 'smart' mail
 client, that automatically makes emails more readable by undoing these
 stupid line breaks at 80 chars. Gmail for example shows your mail as
 lines with approx 175 chars on my 17 notebook.. I'm not sure how
 Gmail sends my messages, but looking at the 'Show original' option, it
 seems it breaks long lines but might be at a different length too.

See, now this is what gets me. Gmail is folding my mail at some
indeterminant length that seems *much* shorter than even 80
characters, but it willingly lets email from non-gmail sources play
across the page as they see fit. I don't see why Gmail doesn't just
make it a QP item and not force line breaks upon me.

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



Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread tamouse mailing lists
On Fri, Aug 24, 2012 at 10:12 AM, Matijn Woudt tijn...@gmail.com wrote:
 On Fri, Aug 24, 2012 at 5:01 PM, tamouse mailing lists
 tamouse.li...@gmail.com wrote:
 OT Reply -- just frustrated with the way email screws up program
 listings. It's a royal pain to have to strip out code and then put it
 in an editor and tidy it up just to be able to make heads or tails out
 of something. There are lots of code pasting sites around, but that
 breaks up the continuity of the list archive. No solution, just
 frustrated

 You're absolutely right, it frustrates me too pretty often. Perhaps we
 should make it a guideline to do both? The active followers will be
 able to read the code at one of the code pasting sites, and the
 archives still have the code.

 - Matijn

I'm wondering if it might make sense to have a code-pasting site
specifically for PHP lists? Is that asking too much?

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



Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread tamouse mailing lists
On Fri, Aug 24, 2012 at 10:20 AM, David OBrien dgobr...@gmail.com wrote:
 In gmail if I see something is totally screwed up visually I click the
 little dropdown where you'd select reply to all and then choose show
 original...
 It shows the source of the email in monospaced font so if looks like it was
 meant to

*Sometimes* that works. If you do that with the sample from the OP, it
still has several indentation/alignment issues.

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



Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread Jim Lucas

On 08/24/2012 08:47 AM, Matijn Woudt wrote:

On Fri, Aug 24, 2012 at 5:33 PM, Jim Lucasli...@cmsws.com  wrote:

On 08/24/2012 08:25 AM, Matijn Woudt wrote:


On Fri, Aug 24, 2012 at 5:22 PM, Jim Lucasli...@cmsws.com   wrote:


Two simple guide lines will help everybody here.

1) Limit your lines to 80 characters
2) Use spaces instead of Tabs



Are we going to discuss coding guidelines again? The 80-character
limit is outdated, 100 or 120 is more common today.
And while I do agree with the spaces, do you also insist on 2, 4 or ..
spaces? ;)
Oh and I'd like everybody to put the opening brackets on the same line..
bla bla

My point is: It's not going to happen.

- Matijn



This has absolutely nothing to do with your own personal coding styles.
This has only to do with how you are going to present code to the list
members.


So you expect people to convert all their code to a 'mailing list
standard' before posting?


If it means that more eyes will even look at the code, then I would hope 
they would do anything possible to make that happen.


Still not going to see that happen..

Unfortunate.





Personally, I let my code ramble on as long a line as it needs.  I use tabs
(set to 8 chars) in my code.  That is because the other developers that I
work with have editors that can display the tabs in whatever width they
desire.  I also do not wrap at 80 chars.

But if you look back at any of my code examples that I have written, none of
them are longer then 80 characters, and uses two spaces for indentation.
Simply because my email client is set to plain text and wraps at 80 chars.


I can see that you do that indeed, but that does *not* guarantee that
it is also seen that way. I think most of us use a 'smart' mail
client, that automatically makes emails more readable by undoing these
stupid line breaks at 80 chars. Gmail for example shows your mail as
lines with approx 175 chars on my 17 notebook.. I'm not sure how
Gmail sends my messages, but looking at the 'Show original' option, it
seems it breaks long lines but might be at a different length too.

- Matijn



Well, not to talk bad about Gmail (I use it for personal accounts), but 
I like using a client that I do have some control over what it does to 
my email.  Making sure that it retains my formatting is one of my first 
requirements.


--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/

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



Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread Jim Lucas

On 08/24/2012 09:28 AM, tamouse mailing lists wrote:

On Fri, Aug 24, 2012 at 10:16 AM, Jim Lucasli...@cmsws.com  wrote:

On 08/24/2012 08:01 AM, tamouse mailing lists wrote:


OT Reply -- just frustrated with the way email screws up program
listings. It's a royal pain to have to strip out code and then put it
in an editor and tidy it up just to be able to make heads or tails out
of something. There are lots of code pasting sites around, but that
breaks up the continuity of the list archive. No solution, just
frustrated



This list does allow attachments, but that breaks things too, because they
are not shown on archive web sites.


Wow, I did not know it even allowed attachments.



The catch is, they must be txt files.

--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/

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



Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread tamouse mailing lists
On Fri, Aug 24, 2012 at 1:24 PM, Jim Lucas li...@cmsws.com wrote:
 Well, not to talk bad about Gmail (I use it for personal accounts), but I
 like using a client that I do have some control over what it does to my
 email.  Making sure that it retains my formatting is one of my first
 requirements.

I'd like that as well, however, I access my various gmail and other
email accounts from so many different machines, I can't rely on any
one particular client or even machine. Thus, I'm pretty much stuck
with the web interface.

FWIW, I am pretty sure sending out email from a standard client to a
gmail account doesn't suffer the same issues.

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



Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread Matijn Woudt
On Fri, Aug 24, 2012 at 8:24 PM, Jim Lucas li...@cmsws.com wrote:

 Personally, I let my code ramble on as long a line as it needs.  I use
 tabs
 (set to 8 chars) in my code.  That is because the other developers that I
 work with have editors that can display the tabs in whatever width they
 desire.  I also do not wrap at 80 chars.

 But if you look back at any of my code examples that I have written, none
 of
 them are longer then 80 characters, and uses two spaces for indentation.
 Simply because my email client is set to plain text and wraps at 80
 chars.


 I can see that you do that indeed, but that does *not* guarantee that
 it is also seen that way. I think most of us use a 'smart' mail
 client, that automatically makes emails more readable by undoing these
 stupid line breaks at 80 chars. Gmail for example shows your mail as
 lines with approx 175 chars on my 17 notebook.. I'm not sure how
 Gmail sends my messages, but looking at the 'Show original' option, it
 seems it breaks long lines but might be at a different length too.

 - Matijn


 Well, not to talk bad about Gmail (I use it for personal accounts), but I
 like using a client that I do have some control over what it does to my
 email.  Making sure that it retains my formatting is one of my first
 requirements.

That's where we have different requirements. My first priority is
speed, both in access (email clients tend to be slow), and in delivery
time. I really need emails to be delivered to my PC instantly, and
that's not the case with POP3 and IMAP. Even push mail to my Android
smartphone with original Gmail app is faster than POP or IMAP.

- Matijn

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



Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread Jim Lucas

On 08/24/2012 12:34 PM, Matijn Woudt wrote:

On Fri, Aug 24, 2012 at 8:24 PM, Jim Lucasli...@cmsws.com  wrote:


Personally, I let my code ramble on as long a line as it needs.  I use
tabs
(set to 8 chars) in my code.  That is because the other developers that I
work with have editors that can display the tabs in whatever width they
desire.  I also do not wrap at 80 chars.

But if you look back at any of my code examples that I have written, none
of
them are longer then 80 characters, and uses two spaces for indentation.
Simply because my email client is set to plain text and wraps at 80
chars.



I can see that you do that indeed, but that does *not* guarantee that
it is also seen that way. I think most of us use a 'smart' mail
client, that automatically makes emails more readable by undoing these
stupid line breaks at 80 chars. Gmail for example shows your mail as
lines with approx 175 chars on my 17 notebook.. I'm not sure how
Gmail sends my messages, but looking at the 'Show original' option, it
seems it breaks long lines but might be at a different length too.

- Matijn



Well, not to talk bad about Gmail (I use it for personal accounts), but I
like using a client that I do have some control over what it does to my
email.  Making sure that it retains my formatting is one of my first
requirements.


That's where we have different requirements. My first priority is
speed, both in access (email clients tend to be slow), and in delivery
time. I really need emails to be delivered to my PC instantly, and
that's not the case with POP3 and IMAP. Even push mail to my Android
smartphone with original Gmail app is faster than POP or IMAP.

- Matijn



IMAP is not fast enough?  I have my own mail server running SMTP  IMAP 
and I use Thunderbird w/IMAP and when my mail server receives an email 
within 1 to 2 seconds my client is notified.  I'm not sure how you can 
get much faster then that.


You realize that IMAP works completely differently then POP.  POP 
clients fetch the mail.  Normally on some preset time frame.  IMAP 
clients are notified by the server when a new message arrives.  As long 
as your IMAP client is open and logged into your account, that 
notification process will take less then a couple seconds.


I cannot see how IMAP is slow.

--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/

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



Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread Matijn Woudt
On Fri, Aug 24, 2012 at 9:48 PM, Jim Lucas li...@cmsws.com wrote:
 On 08/24/2012 12:34 PM, Matijn Woudt wrote:

 On Fri, Aug 24, 2012 at 8:24 PM, Jim Lucasli...@cmsws.com  wrote:


 Personally, I let my code ramble on as long a line as it needs.  I use
 tabs
 (set to 8 chars) in my code.  That is because the other developers that
 I
 work with have editors that can display the tabs in whatever width they
 desire.  I also do not wrap at 80 chars.

 But if you look back at any of my code examples that I have written,
 none
 of
 them are longer then 80 characters, and uses two spaces for
 indentation.
 Simply because my email client is set to plain text and wraps at 80
 chars.



 I can see that you do that indeed, but that does *not* guarantee that
 it is also seen that way. I think most of us use a 'smart' mail
 client, that automatically makes emails more readable by undoing these
 stupid line breaks at 80 chars. Gmail for example shows your mail as
 lines with approx 175 chars on my 17 notebook.. I'm not sure how
 Gmail sends my messages, but looking at the 'Show original' option, it
 seems it breaks long lines but might be at a different length too.

 - Matijn


 Well, not to talk bad about Gmail (I use it for personal accounts), but I
 like using a client that I do have some control over what it does to my
 email.  Making sure that it retains my formatting is one of my first
 requirements.


 That's where we have different requirements. My first priority is
 speed, both in access (email clients tend to be slow), and in delivery
 time. I really need emails to be delivered to my PC instantly, and
 that's not the case with POP3 and IMAP. Even push mail to my Android
 smartphone with original Gmail app is faster than POP or IMAP.

 - Matijn


 IMAP is not fast enough?  I have my own mail server running SMTP  IMAP and
 I use Thunderbird w/IMAP and when my mail server receives an email within 1
 to 2 seconds my client is notified.  I'm not sure how you can get much
 faster then that.

 You realize that IMAP works completely differently then POP.  POP clients
 fetch the mail.  Normally on some preset time frame.  IMAP clients are
 notified by the server when a new message arrives.  As long as your IMAP
 client is open and logged into your account, that notification process will
 take less then a couple seconds.

 I cannot see how IMAP is slow.


Might be of some other issues, don't know. Tried Outlook (Terrible,
especially with Gmail), and Thunderbird (Works OK, e-mails tend to
deliver after ~5 sec). With Gmail web interface (and Desktop
notifications in Chrome), I receive mails in less than a second. On my
Android phone I usually receive them within 1-2 sec, though that
depends on connection. Note that with fast, I mean, really fast ;)

- Matijn

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



[PHP] Dynamic Content thoughts

2012-08-23 Thread admin
Hello everyone,

In my quest to build bigger and better dynamic content, I am
putting forth a concept to see what you all think.

Many times I come across customers who want drop down menus dynamically
built from database tables.

 

Old way Example:

Echo 'SELECT ID=personneloption value='0'--Please  Select--/option';

$query = SELECT * FROM personnel ORDER BY last_name;

$result = mysql_query($query);

If(mysql_num_rows($result) = 1)

{

While($row = mysql_fetch_assoc($result))

{

Echo option value='.$row['ID'].'.$row['first_name'].
.$row['last_name']./option;

}

}

Echo '/select';

*

 

I am purposing a Method for this that has some flexibility.

 

Initialize Object:  $yourobject = new yourclass();

Call method: // The call design is just so you have a better understanding
of my concept

$dropdown = $yourobject- dropmenu('personnell','ID',array(0 =
'first_name', 1 = 'last_name'), 'last_name'); 

 

Function dropmenu($table,$fieldforvalue,$fieldstodisplay,$fieldorder)  //
Yes you could add some WHERE filters as well 

{

$arraytoreturn = array();

If(strlen($table) = 3){   

if(is_array($fieldstodisplay)){

$count = 0;

foreach($fieldstodisplay as $key=$values){

if(strlen($values) =3){

If($count == 0){

$fields = $values;

}else{

$fields . = ,.$values;

}  

$count++;

}


}

}else{

If(strlen(($fieldstodisplay) = 1){

$fields = $fieldstodisplay;

$fieldstodisplay = array(0
=$fieldstodisplay);

}else{

Return $arraytoreturn; // Return nothing
because no field was selected.

}

}

}else{

Return $arraytoreturn; // Return nothing because no table was selected.

}  

If(strlen($fieldorder) = 3) {

$orderfilter =  ORDER BY .$fieldorder. ;  

}else{

$orderfilter = ;

}

$query = SELECT .$fields. FROM .$table. .$orderfilter. ;

$result = mysql_query($query);

If(mysql_num_rows($result) = 1)

{

$arraytoreturn[] = option value=0--Please Select--/option;

While($row = mysql_fetch_assoc($result))

{

$display_fields   = ;

Foreach($fieldstodisplay as $key=$values){

$display_fields  .= $row[$values]. ;  

}  

If(strlen($fieldforvalue = 3){

$arraytoreturn[] = option
value='.$row[$fieldforvalue].'.$display_fields  ./option;

}else{

$arraytoreturn[] = option.$display_fields  ./option;

}

}

Return $arraytoreturn;

}else{

Return $arraytoreturn; // Nothing to return.

}

}

 

Now I can call the drop downs driven by database tables dynamically and It
saves me a TON of time.

Echo 'SELECT ID=personnel';

Foreach($dropdown as $key=$values){

Echo $values;

}

Echo '/select';

 

 

Richard L. Buskirk

Some of the world's greatest feats were accomplished by people not smart
enough to know they were impossible

 



Re: [PHP] Dynamic Content thoughts

2012-08-23 Thread Matijn Woudt
On Thu, Aug 23, 2012 at 9:51 PM, admin ad...@buskirkgraphics.com wrote:
 Hello everyone,

 In my quest to build bigger and better dynamic content, I am
 putting forth a concept to see what you all think.

 Many times I come across customers who want drop down menus dynamically
 built from database tables.



 Old way Example:



 *



 I am purposing a Method for this that has some flexibility.



 Initialize Object:  $yourobject = new yourclass();

 Call method: // The call design is just so you have a better understanding
 of my concept

 $dropdown = $yourobject- dropmenu('personnell','ID',array(0 =
 'first_name', 1 = 'last_name'), 'last_name');



 Function dropmenu($table,$fieldforvalue,$fieldstodisplay,$fieldorder)  //
snip



 Now I can call the drop downs driven by database tables dynamically and It
 saves me a TON of time.

 Echo 'SELECT ID=personnel';

 Foreach($dropdown as $key=$values){

 Echo $values;

 }

 Echo '/select';



Hi Richard,


First of all, I don't really see the problem with the first code, as
it's not that many LOC. OTOH comparing it to the enormous amount of
lines needed for your function it seems a bit overkill. If you combine
$query = .. and mysql_query($query), to a single line (which I
prefer), then you only have 4 lines of code in your first example. ( I
only count lines that do something, not the brackets etc). Your
function has about 40.
If you still want this function, I would change a few things.
1) Do all the echo stuff inside your function, or, only return the
data and print the option html stuff outside of your function.
You're now mixing both which seems wrong.
2) Use SQL as input, and if you wish to make it easy for yourself,
write a seperate function that writes SQL queries for you (or just use
a lib for it, there are probably plenty).
3) Use mysqli, mysql is deprecated.
4) Use mysqli_real_escape_string to sanitize your input before using
it on the database.

Hope this helps you,

- Matijn

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



RE: [PHP] Dynamic Content thoughts

2012-08-23 Thread admin
-Original Message-
From: Matijn Woudt [mailto:tijn...@gmail.com] 
Sent: Thursday, August 23, 2012 4:39 PM
To: admin
Cc: php-general@lists.php.net
Subject: Re: [PHP] Dynamic Content thoughts

On Thu, Aug 23, 2012 at 9:51 PM, admin ad...@buskirkgraphics.com wrote:
 Hello everyone,

 In my quest to build bigger and better dynamic 
 content, I am putting forth a concept to see what you all think.

 Many times I come across customers who want drop down menus 
 dynamically built from database tables.



 Old way Example:



 *



 I am purposing a Method for this that has some flexibility.



 Initialize Object:  $yourobject = new yourclass();

 Call method: // The call design is just so you have a better 
 understanding of my concept

 $dropdown = $yourobject- dropmenu('personnell','ID',array(0 = 
 'first_name', 1 = 'last_name'), 'last_name');



 Function dropmenu($table,$fieldforvalue,$fieldstodisplay,$fieldorder)  
 //
snip



 Now I can call the drop downs driven by database tables dynamically 
 and It saves me a TON of time.

 Echo 'SELECT ID=personnel';

 Foreach($dropdown as $key=$values){

 Echo $values;

 }

 Echo '/select';



Hi Richard,


First of all, I don't really see the problem with the first code, as it's not 
that many LOC. OTOH comparing it to the enormous amount of lines needed for 
your function it seems a bit overkill. If you combine $query = .. and 
mysql_query($query), to a single line (which I prefer), then you only have 4 
lines of code in your first example. ( I only count lines that do something, 
not the brackets etc). Your function has about 40.
If you still want this function, I would change a few things.
1) Do all the echo stuff inside your function, or, only return the data and 
print the option html stuff outside of your function.
You're now mixing both which seems wrong.
2) Use SQL as input, and if you wish to make it easy for yourself, write a 
seperate function that writes SQL queries for you (or just use a lib for it, 
there are probably plenty).
3) Use mysqli, mysql is deprecated.
4) Use mysqli_real_escape_string to sanitize your input before using it on the 
database.

Hope this helps you,

- Matijn

--
Thank you Matijn,
For coding style, I think we can agree on the fact each person has a 
different style and reasoning's for their own style.
My style on SQL statements was passed down to me from some very successful 
developers who felt the reason for creating a 
SQL statement in such a manor was to assist in informatics and Debugging.

While you're not getting the point in the Method being in the class and called 
when needed. It cuts coding size and time down by extremes when you have 
multiple drop downs that may or may not repeat on different views. 

Matijn was very correct on the combination of HTML and PHP in a Method and I do 
agree, many feel this is a giant no no. Many could simply pass the array to the 
view and create the drop down from there. The wonderful part of the method is 
that it has the flexibility to meet many coding styles and a vast range of 
abilities.

I do however feel the Mysql_real_escape_string to be un-necessary for the 
developer, being the end-user(GUI between the keyboard and Chair) will not be 
passing these fields to the Database. But escape away if you feel safer doing 
this with-in your own version of the method. 

As for the MYSQL VS MYSQLI in MOST benchmarks, I find the MYSQL extension to be 
slightly faster. 
Yes MYSQLI functions are more Object-oriented in some designs I feel MYSQL out 
performs MYSQLI in large database setups for a personal preference.
Again you may change the Design of the method to meets your needs MYSQL or 
MYSQLI doesn’t really take away from the concept.







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