Re: [PHP] Re: What does mean?

2007-05-02 Thread Richard Lynch
On Tue, May 1, 2007 12:55 pm, Robert Cummings wrote:
 Are there perhaps editors that would DISPLAY multi-line quoted
 strings
 indented to the correct level without inserting extra spaces? Some
 editors wrap lines to the correct level, which is also much more
 readable, so what I'm thinking of is a bit similar to that.

 Then you'd have an editor that presents something other than what is
 actually there. Go see Microsoft, I'm sure they create rubbish like
 that.

All editors display something other than what is actually there, to
some degree... :-)

That said...

The problem with the editor auto-indenting lines that aren't indented
is what to do with lines that ARE indented...

True Source:
$email = EOM
  This is a paragraph that has been indented and
hard line-wrapped with something not unlike:
http://php.net/wordwrap
http://php.net/wordwrap
and has had URLs embedded in ways to make sure ALL
email clients will present at least ONE clickable link,
even the dreaded AOL 4.0
  Yes, I still have code that is hanging around
from when AOL 4.0 was new.
  Sorry.
EOM;

So what would your nifty editor do with that?

Indent it to match PHP indenting, and then add the whitespace of the
actual message?

I think that might work well, though lead to a lot of un-readable
right-shifted long text lines instead of the ugly indentation.

One think you could consider to avoid the ugliness is to put the
heredoc into a one-use function or in an incldue file that doesn't
have enough indenting for it to look ugly in the first place. :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Re: What does mean?

2007-05-02 Thread Edward Vermillion


On May 2, 2007, at 3:59 PM, Richard Lynch wrote:

[snip]




One think you could consider to avoid the ugliness is to put the
heredoc into a one-use function or in an incldue file that doesn't
have enough indenting for it to look ugly in the first place. :-)



That's what I do with 'em, and that's exactly why. Can't stand to  
have things not look right, even if it does cost a function call.


At least until costing a function call matters more than being able  
to change things without going cross-eyed.


Ed

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



Re: [PHP] Re: What does mean?

2007-05-01 Thread Robert Cummings
On Tue, 2007-05-01 at 20:40 +0800, Man-wai Chang wrote:
   END
   some code
  END
  It's heredoc syntax.
  http://us2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
   
  
 
 Bash redirection... :)

Syntax error ;)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



RE: [PHP] Re: What does mean?

2007-05-01 Thread Edward Kay
  END
  some code
 END
 Bash redirection... :)

 Syntax error ;) 

Key stuck on keyboardd :)

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



RE: [PHP] Re: What does mean?

2007-05-01 Thread Robert Cummings
On Tue, 2007-05-01 at 15:01 +0100, Edward Kay wrote:
   END
   some code
  END
  Bash redirection... :)
 
  Syntax error ;) 
 
 Key stuck on keyboardd :)

*lol*


-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Re: What does mean?

2007-05-01 Thread Mattias Thorslund
Man-wai Chang wrote:

 Bash uses only 2. PHP uses 3. And I am using this:

 $sql=
   select ...
 from 
 left join ...
   on 
 where .
 ;


Exactly. I never saw the point in complicating my life with heredocs
when both single- and double-quoted strings can contain multiple lines
anyway.

One thing that does bother me a little with multi-line strings of either
variety is that if I want to avoid inserting extra spaces in the string
at the beginning of each line after the first, I have to left-align the
whole thing and cannot indent it with the rest of my code:

if($something){
if($something_else){
   $myID = intval($_GET['rowID']);
   $sql_pretty =
SELECT
field1,
field2
 FROM
mytable
 WHERE
rowID = $myID;
$sql_ugly =
SELECT
field1,
field2
FROM
mytable
WHERE
rowID = $myID;
}
}

Are there perhaps editors that would DISPLAY multi-line quoted strings
indented to the correct level without inserting extra spaces? Some
editors wrap lines to the correct level, which is also much more
readable, so what I'm thinking of is a bit similar to that.

Mattias

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



Re: [PHP] Re: What does mean?

2007-05-01 Thread Robert Cummings
On Tue, 2007-05-01 at 08:36 -0700, Mattias Thorslund wrote:
 Man-wai Chang wrote:
 
  Bash uses only 2. PHP uses 3. And I am using this:
 
  $sql=
select ...
  from 
  left join ...
on 
  where .
  ;
 
 
 Exactly. I never saw the point in complicating my life with heredocs
 when both single- and double-quoted strings can contain multiple lines
 anyway.
 
 One thing that does bother me a little with multi-line strings of either
 variety is that if I want to avoid inserting extra spaces in the string
 at the beginning of each line after the first, I have to left-align the
 whole thing and cannot indent it with the rest of my code:
 
 if($something){
 if($something_else){
$myID = intval($_GET['rowID']);
$sql_pretty =
 SELECT
 field1,
 field2
  FROM
 mytable
  WHERE
 rowID = $myID;
 $sql_ugly =
 SELECT
 field1,
 field2
 FROM
 mytable
 WHERE
 rowID = $myID;
 }
 }
 
 Are there perhaps editors that would DISPLAY multi-line quoted strings
 indented to the correct level without inserting extra spaces? Some
 editors wrap lines to the correct level, which is also much more
 readable, so what I'm thinking of is a bit similar to that.

Then you'd have an editor that presents something other than what is
actually there. Go see Microsoft, I'm sure they create rubbish like
that.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Re: What does mean?

2007-05-01 Thread Mattias Thorslund
Robert Cummings wrote:
 On Tue, 2007-05-01 at 08:36 -0700, Mattias Thorslund wrote:
   
 Man-wai Chang wrote:
 
 Bash uses only 2. PHP uses 3. And I am using this:

 $sql=
   select ...
 from 
 left join ...
   on 
 where .
 ;
   
 Exactly. I never saw the point in complicating my life with heredocs
 when both single- and double-quoted strings can contain multiple lines
 anyway.

 One thing that does bother me a little with multi-line strings of either
 variety is that if I want to avoid inserting extra spaces in the string
 at the beginning of each line after the first, I have to left-align the
 whole thing and cannot indent it with the rest of my code:

 if($something){
 if($something_else){
$myID = intval($_GET['rowID']);
$sql_pretty =
 SELECT
 field1,
 field2
  FROM
 mytable
  WHERE
 rowID = $myID;
 $sql_ugly =
 SELECT
 field1,
 field2
 FROM
 mytable
 WHERE
 rowID = $myID;
 }
 }

 Are there perhaps editors that would DISPLAY multi-line quoted strings
 indented to the correct level without inserting extra spaces? Some
 editors wrap lines to the correct level, which is also much more
 readable, so what I'm thinking of is a bit similar to that.
 

 Then you'd have an editor that presents something other than what is
 actually there. Go see Microsoft, I'm sure they create rubbish like
 that.

 Cheers,
 Rob.
   

something other than what is actually there

Not at all, Rob! Have you seen how many editors dynamically wrap lines
(Quanta on KDE for instance)? Instead of placing the wrapped line right
smach along the left edge, it indents the following lines under the
first line. It is visually clear that there is no extra white space
because the extra indent has a different background color.

Like this (I used +'s to indicate a different background color, telling
you this isn't whitespace in your code):

if($something){
   $variable = This text message goes on and on and ever on and and
+++would run right off the edge of my screen but thankfully my editor
+++is smart enough to wrap the lines in a way that also does not
+++ruin the indentation.\n;
}

Now, I would wish for my editor to also indent multi-line strings in the
same fashion. Essentially, the lines of $sql_ugly in my example above
should be displayed in alignment with the indentation:

if($something){
   if($something_else){
  $myID = intval($_GET['rowID']);
  $sql =
++SELECT
++   field1,
++   field2
++FROM
++   mytable
++WHERE
++   rowID = $myID;
}
}

I doubt Microsoft develops an editor that I could use on my Linux system
for this...

Cheers,

Mattias

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



Re: [PHP] Re: What does mean?

2007-05-01 Thread Robert Cummings
On Tue, 2007-05-01 at 12:28 -0700, Mattias Thorslund wrote:
 Robert Cummings wrote:

 Now, I would wish for my editor to also indent multi-line strings in the
 same fashion. Essentially, the lines of $sql_ugly in my example above
 should be displayed in alignment with the indentation:
 
 if($something){
if($something_else){
   $myID = intval($_GET['rowID']);
   $sql =
 ++SELECT
 ++   field1,
 ++   field2
 ++FROM
 ++   mytable
 ++WHERE
 ++   rowID = $myID;
 }
 }

Aaaah, I see... still looks terrible :)

 I doubt Microsoft develops an editor that I could use on my Linux system
 for this...

Probably not.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Re: What does mean?

2007-05-01 Thread Tijnema !

I doubt Microsoft develops an editor that I could use on my Linux system
for this...

Cheers,

Mattias


You could use a silly editor from Microsoft, and then run it using Wine.

Tijnema

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