FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » php+html mixup in displaying multidimensional array in html tables
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: php+html mixup in displaying multidimensional array in html tables [message #176849 is a reply to message #176840] Sat, 28 January 2012 20:43 Go to previous messageGo to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
John wrote:

> I am new to this problem and shall be very grateful for any hint on how
> to a´void an unreadable code-salad, when trying to display a
> bidimensional array (thus with two indexes) on a html table.
> I refer to the continuous shifting between <?php and <html> every two
> lines.

You mean `<?php' and `?>'; there can be only one `<html>' tag in a (Valid)
HTML document.

Contrary to common misconception, several `<?php's and `?>'s in a file
parsed by PHP are healthy and appropriate, as it is the most efficient
method (stdin --> stdout) and the easiest to maintain (no quoting necessary;
parsing, that includes syntax highlighting and client-side validation, just
works both for HTML and PHP).

Only make sure that you do not mix too much program logic with the output
(loops are OK). Use the template approach (not necessarily a full-blown
template system like Smarty). And, as always, indent your code so that you
can tell sections apart.

RTFM: <http://www.php.net/manual/en/tutorial.firstpage.php>

> Is there a method which is 'quick an easy' to do the job ?

Yes. You have found it.


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Fast/Easy way to extract a column from multi-dimensional array?
Next Topic: Freelance PHP Developer
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 07:42:39 GMT 2024

Total time taken to generate the page: 0.04600 seconds