Posts: 3,616
Threads: 287
Joined: Jan 2003
How? PHP is purely for page generation, not design.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 3,343
Threads: 83
Joined: Mar 2003
It's far easier to go through a for/next loop outputting "class="left"" when generating tables than going through the whole list and doing it manually. In fact, you can go class="' . $row++ % 2 . '" to make the classes be "row0" and "row1", thus enabling you to have different coloured cells alternating.
It's just quicker, and better if you're generating tables based on database results.
Posts: 3,616
Threads: 287
Joined: Jan 2003
Ah, I see.
Which brings up another of my questions: Does PHP have Perl's multiline output feature? That is, you declare an ECHO type thing, except you specify where to stop.
(pseudocode)
ECHO UNTIL finds_string "END OF ECHO"
<blah>
<blah>
<blah>
END OF ECHO;
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 2,020
Threads: 24
Joined: Jun 2002
I dont trust html or css borders, because they render different on different browsers. Try this:
Code:
<table border=0 cellpadding=x cellspacing=1 bgcolor=#000000>
<tr>
<td bgcolor=#FFFFFF>Blah blah</td>
<td bgcolor=#FFFFFF>Blah blah</td>
<td bgcolor=#FFFFFF>Blah blah</td>
</tr><tr>
<td bgcolor=#FFFFFF>Blah blah</td>
<td bgcolor=#FFFFFF>Blah blah</td>
<td bgcolor=#FFFFFF>Blah blah</td>
</tr><tr>
<td bgcolor=#FFFFFF>Blah blah</td>
<td bgcolor=#FFFFFF>Blah blah</td>
<td bgcolor=#FFFFFF>Blah blah</td>
</tr>
</table>
That's always been my foolproof way of bordered tables constant on any browser. you can set the background color with CSS if you like, the W3 peeps are always saying you shouldnt mess with table style sheets but they're just talking out of their arses.
Btw, PHP doesnt need that because it's integrated.
Code:
<?
//blah blah blah
?>
HTML HTML HTML
<?
// more php code
?>
And besides, when programming Perl, I try and avoid that bit of the language. It makes for sloppy coding. I normally try and modularize my code and make a template script, using a global hash to edit the parts with content and and render the page at the end of the script.
EDIT: oops, oracle beat me to the cellspacing border trick
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Posts: 3,343
Threads: 83
Joined: Mar 2003
Quote:EDIT: oops, oracle beat me to the cellspacing border trick
I found it out the hard way as well, after a few sites with css borders got the better of me
Posts: 394
Threads: 16
Joined: Jun 2003
oracle covered the php part i was going to say.
i scorn standard borders for tables though. one border is preferred, (like left, or right, or top or bottom, just as a section marker.) check out my portfolio and other works to see how i use tables (shameless plug now)
http://cartella.hokuten.net/
Quote:"Zack"]Ah, I see.
Which brings up another of my questions: Does PHP have Perl's multiline output feature? That is, you declare an ECHO type thing, except you specify where to stop.
(pseudocode)
ECHO UNTIL finds_string "END OF ECHO"
<blah>
<blah>
<blah>
END OF ECHO;
you could use a WHILE loop for this,
while ($string != "this") {
mysql_query for string or whatever
echo $string;
}
ammit potato!
Posts: 3,616
Threads: 287
Joined: Jan 2003
Meh, the whole point is to be able to quickly output HTML, without having any $html="sbas" and then $html .= "sdsdgsd".
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 838
Threads: 17
Joined: Jan 2002
eh isn't
(Perl)
Code:
[perl code here]
print <<<blob # Ok, long time no see Perl, but you get my point.
<p>this is a
<b>perl</b>
testing thing</p>
blob
[perl code here]
the same as
(PHP)
Code:
<?php
[php code]
?>
<p>this is a
<b>php</b>
testing thing</p>
<?php
[php code continues]
?>
From my point of view, the ability to jump in and out of php renders a php equalent of the Perl function unusable.
url=http://www.copy-pasta.com]CopyPasta[/url] -
FilePasta
Posts: 3,616
Threads: 287
Joined: Jan 2003
True, but what if you want to output vars?
This will print the "$cool" to the browser:
Code:
<?php
$cool="nice";
?>
$cool
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 1,752
Threads: 21
Joined: Jun 2002
PHP does, in fact, support multi-line echo:
Code:
echo <<<END
<p>this is a
<b>php</b>
testing thing</p>
END;