Page 1 of 1

Help Combining Code

Posted: Tue Jul 03, 2012 3:47 pm
by chriscct7
Hi, I am working on a simple error system that will relay some PHP information only if debug is active (found if imported $global_debug is 1).
As you will note in my code: http://pastebin.com/03HtvpnY
I am using a ton of if else's. What I am trying to do is get it to where if $global_debug is 0 nothing is displayed (blank php file echoed) for security reasons and if it is active then the content will be displayed.
This is what it looks like without the if elses:
http://pastebin.com/V0acPdiT

So the second paste shows you what I want to have if the debug is 0 give or take.

Can someone help me combine this?

Re: Help Combining Code

Posted: Tue Jul 03, 2012 3:59 pm
by Celauran
Just wrap the form in an if statement. There's no need for the empty else {} block.

Code: Select all

<?php if ($global_debug == 1): ?>
form goes here
<?php endif; ?>

Re: Help Combining Code

Posted: Tue Jul 03, 2012 4:17 pm
by chriscct7
Worked Perfectly. Thanks for your help. This PHP tag looks interesting, and very useful. Do you know any Codex or reference material I could study it with?

-Chris

Re: Help Combining Code

Posted: Tue Jul 03, 2012 4:26 pm
by Celauran
Not quite sure what you mean. If you're referring to the if: endif; block, that's just an alternate syntax to braces.

Re: Help Combining Code

Posted: Tue Jul 03, 2012 4:28 pm
by chriscct7
Never seen that before.

-Chris