Jump to content

html in php


Elton

Recommended Posts

I read the following:

 

quote:


it really is incredibly bad style to mix code and html though... if you are going to put html out in the middle of a load of code, you should prepare the html then print it.


If it works, though, is it actually a problem?

Anglers' Net Shopping Partners - Please Support Your Forum

CLICK HERE for all your Amazon purchases - books, photography equipment, DVD's and more!

CLICK HERE for Go Outdoors. HUGE discounts!

 

FOLLOW ANGLERS' NET ON TWITTER- CLICK HERE - @anglersnet

PLEASE 'LIKE' US ON FACEBOOK - CLICK HERE

Link to comment
Share on other sites

I work with PHP and HTML everyday and there is no problem mixing them up, in fact it works that way by design (otherwise PHP files would only contain PHP and would not parse with HTML in them).

 

It's tidier to break them apart where possible. It's easier not to from a coding point of view.

 

I am all for PHP questions - in my opinion an amazing server-side language that is highly under-rated by many Windows (ASP) programmers.

Ian W

 

Link to comment
Share on other sites

First of all Elton the bit about mixing php and html is just complete b0ll0cks!

 

You could if you wanted to, name all the web page type files on your site *.php and everything should still work, albeit with a small performance hit because the php module would have to parse every page.

 

Get into the habit of indenting you code properly. When I was an 'apprentice programmer' this was drummed into us. It makes your code easier to read, especially if someone other than the original author has to edit it, or you have to go and edit it yourself 9 months down the track.

The problem isn't what people don't know, it's what they know that just ain't so.
Vaut mieux ne rien dire et passer pour un con que de parler et prouver que t'en est un!
Mi, ch’fais toudis à m’mote

Link to comment
Share on other sites

Cheers, guys.

 

The thing I had to do hasn't bust yet, so it must be okay :)

Anglers' Net Shopping Partners - Please Support Your Forum

CLICK HERE for all your Amazon purchases - books, photography equipment, DVD's and more!

CLICK HERE for Go Outdoors. HUGE discounts!

 

FOLLOW ANGLERS' NET ON TWITTER- CLICK HERE - @anglersnet

PLEASE 'LIKE' US ON FACEBOOK - CLICK HERE

Link to comment
Share on other sites

PM me any PHP questions anytime!

 

Cory! Better to be neat where possible. I've worked in very hectic environments though where I've been guilty of not doing it and had plenty shoved my way where people clearly haven't done it!!!

 

A lot of readily available PHP scripts are also badly organised/indented - probably by design though to stop people tampering....

Ian W

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We and our partners use cookies on our website to give you the most relevant experience by remembering your preferences, repeat visits and to show you personalised advertisements. By clicking “I Agree”, you consent to the use of ALL the cookies. However, you may visit Cookie Settings to provide a controlled consent.