Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

PHP code best practices

Being new to PHP I would like how to organize my code better. I usually organize it the exact same page on every page. This are the parts I have recognized so far:

1) PHP code (example below)

<?php require_once( "../../webassist/security_assist/helper_php.php" ); ?>
<?php
if (!WA_Auth_RulePasses("Logged in to pcms2_users")){
      WA_Auth_RestrictAccess("../../logout.php");
}
?>

2) <html>  tag

3) <meta content>

4) <head>

5) <link .. to stylesheets>
6) <scrpt type ... >

7) </head>

8) <body>

9) All the 'body' code

10) </body>

11) </html>

Would that be accurate ?  or can I have the PHP code elsewhere as best practice, just looks weird to me that it is at the very top before my meta tags, etc.  I would usually have it between my meta tags and before the <head> content.

Any pointers for best practices are welcome.
SOLUTION
Avatar of Randy Poole
Randy Poole
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

Thank you  !
Avatar of Aleks

ASKER

Thank you  !