Re: buffering to allow headers in code? [message #170169 is a reply to message #170167] |
Thu, 14 October 2010 16:32 |
MikeB
Messages: 65 Registered: September 2010
Karma:
|
Member |
|
|
Denis McMahon wrote:
> On 14/10/10 14:39, MikeB wrote:
>
>> What to do?
>
> Make any decisions about whether you need to send control headers before
> you start trying to output any html.
>
> What data is not available when you assemble the navbar that you wish to
> show in your navbar, and why is it not available?
>
> This sounds like you have a sequencing issue, and may need to switch
> round the order in which you are trying to do things. It should be
> possible to assemble all the information needed to generate the webpage
> before outputting any html.
>
This is an introductory PHP course.
We are creating a "dynamic" web page without AJAX (JavaScript) since
that will be in the intermediate course.
The site is a single file - index.php. Structured with a table (to avoid
learning CSS at the same time as PHP and SQL) for the header, footer and
three panes in between. The left-most pane is hte navigation, the center
is the Main and the right is the "news".
Each table cell has an include() for another file that makes up the
content of that cell. eg. include("nav.inc.php") for the navigation bar.
The main cell then has some conditional php code to decide on what
include to run, eg, one for "show summary of all recipes", or "show
details for a recipe", or "enter a new recipe/comment", etc. Also, of
course for registering and logging in.
Since I'm trying to display the name of the logged in user on the left
pane, that code is included before I run the code in the "main" cell,
hence my timing problem
THe class example sidesteps it by simply not putting the data in there.
Maybe I should just go back to the class example. Would be a lot less
headache.
|
|
|