473,800 Members | 2,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Control structures

pgt
I need to cease the execution of some code if a couple of conditions are not
met.

exit; destroys the rest of my page of course, so I *think* I need some sort
of "wrapper", perhaps in a control structure?

The page works flawlessly otherwise (and reporting is set to
error_reporting (E_ALL); )
<body>
<div>
<?php
if (error checking here)
{echo 'error message';}
elseif (secondary error checking here)
{echo 'more error messages';}
// exit; <!--destroys rest of the page, so can't use-->
?>

<CONTAINER>
<?php
// other stuff
?>
</CONTAINER>

<!-- other html -->
</div>
</body>
I need to NOT execute anything within 'CONTAINER' when the if/elseif
statements are not met, but I DO need to continue with the html above the
closing div, so the rest of the page displays normally.

How to "wrap" this? Or ... ?
Nov 5 '07 #1
2 1183
On Nov 5, 3:42 pm, "pgt" <pgt...@gmail.n otwrote:
I need to cease the execution of some code if a couple of conditions are not
met.

exit; destroys the rest of my page of course, so I *think* I need some sort
of "wrapper", perhaps in a control structure?

The page works flawlessly otherwise (and reporting is set to
error_reporting (E_ALL); )

<body>
<div>
<?php
if (error checking here)
{echo 'error message';}
elseif (secondary error checking here)
{echo 'more error messages';}
// exit; <!--destroys rest of the page, so can't use-->
?>

<CONTAINER>
<?php
// other stuff
?>
</CONTAINER>

<!-- other html -->
</div>
</body>

I need to NOT execute anything within 'CONTAINER' when the if/elseif
statements are not met, but I DO need to continue with the html above the
closing div, so the rest of the page displays normally.

How to "wrap" this? Or ... ?
<body>
<div>
<?php
$skip=false;
if (error checking here)
{echo 'error message';$skip= true;}
elseif (secondary error checking here)
{echo 'more error messages';$skip =true;}
// exit; <!--destroys rest of the page, so can't use-->
?>

<CONTAINER>
<?php
if (!$skip){
// other stuff
}
?>
</CONTAINER>

<!-- other html -->
</div>
</body>

I think that does what you want? I just added a new variable $skip...

Nov 5 '07 #2
pgt

"yawnmoth" <te*******@yaho o.comwrote in message
news:11******** *************@o 38g2000hse.goog legroups.com...
On Nov 5, 3:42 pm, "pgt" <pgt...@gmail.n otwrote:
>I need to cease the execution of some code if a couple of conditions are
not
met.

exit; destroys the rest of my page of course, so I *think* I need some
sort
of "wrapper", perhaps in a control structure?

The page works flawlessly otherwise (and reporting is set to
error_reportin g(E_ALL); )

<body>
<div>
<?php
if (error checking here)
{echo 'error message';}
elseif (secondary error checking here)
{echo 'more error messages';}
// exit; <!--destroys rest of the page, so can't use-->
?>

<CONTAINER>
<?php
// other stuff
?>
</CONTAINER>

<!-- other html -->
</div>
</body>

I need to NOT execute anything within 'CONTAINER' when the if/elseif
statements are not met, but I DO need to continue with the html above the
closing div, so the rest of the page displays normally.

How to "wrap" this? Or ... ?

<body>
<div>
<?php
$skip=false;
if (error checking here)
{echo 'error message';$skip= true;}
elseif (secondary error checking here)
{echo 'more error messages';$skip =true;}
// exit; <!--destroys rest of the page, so can't use-->
?>

<CONTAINER>
<?php
if (!$skip){
// other stuff
}
?>
</CONTAINER>

<!-- other html -->
</div>
</body>

I think that does what you want? I just added a new variable $skip...

Thank you so much. Couldn't see the wood because the forest got in the way
;-)

Much appreciated :-))



Nov 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
1729
by: Olivier Parisy | last post by:
Hi all, I am new to Python (I just finished Guido's tutorial). I was very surprised to learn there that the StopIteration is used to end for loops in a standard iterator setting. I come from C++, where the use of exceptions as control structures is frowned upon for efficiency reasons. What is the Python canon on this topic ? Are exceptions
1
2738
by: kazack | last post by:
Hi all it's me again with another question as I got further in my book. The chapter I am in covers structres, abstract data and classes. I only read through to the end of the coverage on structures. Trying to comprehend this is harder than I thought it was going to be. I should of just skipped this chapter and went right into pointers since they seem to be easier to use. But anyways here i smy question: you define a structure...
3
2523
by: Paul | last post by:
Hi everyone, I'm hoping someone in the group has had experience with this problem: I was looking through the list of ActiveX controls in Access 97 and found a Microsoft Tree Control which looks pretty cool. I could set up the properties with no problem, but my question is...how do you give it a control source? For the life of me, I can't seem to find out how to populate it.
2
2676
by: Carolyn Vo | last post by:
I have been looking and looking but can't seem to find out how to get the row selected in a web control datagrid (NOT a web form datagrid!!!), and how to highlight the selected row. I'm sure this question comes up all the time but I can't find the solution(s) anywhere. From what I understand, the web control datagrid doesn't have any row selected or row highlighting capabilities. What kind of hack am I going to have to put into place?...
2
4382
by: Tom Shelton | last post by:
I was goofing around tonight and decided to write a little IP address control. I had written a simple one a long time ago, but I decided I should try to write one that was half way correct :) Anyway, here is the result of about an hour and half of work... // IPControl.cs using System; using System.Collections; using System.ComponentModel; using System.Drawing;
1
2628
by: Christopher A. Kelly | last post by:
I need to figure out how to control any 3rd party application by simulating mouse click and key presses. I need to take a partial window title and get the handle then be able to send the necessary input to the application, I have been trying for weeks to figure this out and can't. In trade i am posting a master volume class that i modified and added functions to. Imports System
4
1670
by: Yoram Biberman | last post by:
I have a few questions concerning concurrency control. I shall thank whoever can help me. Question #1 ========= Assume the following (concurrent) schedule, in which both transactions run in a serializable isolation level: T1 begin T2 begin T1 modifies an item A
2
4927
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is being updated by some other process through remoting. When the page loads, I init the tree, and in my browser I can see the initialized tree. The problem is that every time that I receive update to tree from the remote process,
2
2410
by: thomasfarrow | last post by:
At work, our development team has a development standards document that insists Structures should never be used. I'm looking to change this standard but need a suitable argument in order to make the change. I know that Structures are value types, sit on the stack, and are generally more efficient to manipulate than reference types (i.e. Classes). Structures cannot use inheritance, the finalize method or default constructors. Can anyone...
0
1503
by: Derek Martin | last post by:
On Fri, Jul 18, 2008 at 12:21:49PM -0700, mark floyd wrote: One wonders why... :) Even if Python didn't offer a way to write a for loop in a similar fashion (someone else replied about that already), why should it be a problem? In general control structures can be rewritten as some other kind of control structure. For example, this does exactly what your
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10255
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10036
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9092
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7582
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2948
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.