FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » buffering to allow headers in code?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: buffering to allow headers in code? [message #170174 is a reply to message #170169] Thu, 14 October 2010 21:42 Go to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On 14/10/10 17:32, MikeB wrote:

> 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.

The page is generated. At the point that the page is generated, you are
either logged in, or not logged in.

If you are not logged in, then presumably an option to log in is
displayed, and then presumably the whole page is reprocessed from the start.

But, this time round, you can:

(a) invoke a session handler
(b) process the log in details before you do anything else
(c) store the log in state and username in a session variable

before processing the nav menu.

Now, if you did that first, when you get down to doing nav, you can test
the logged_in session variable, and if the user is logged_in, use the
username session variable in generating your navigation bar.

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Mesothelioma
Next Topic: Good code or bad code?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 22:11:20 GMT 2024

Total time taken to generate the page: 0.03854 seconds