Re: [PHP] session variables in OOP....

2002-06-14 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* and then W. Enserink declared
> Nick: thx for the tip, it removed the error, and might further be a good
> idea: except:
> do you know if I can declare session variables and use them in between the
> output buffer statements
> like this: (i tried it but it doesn't seem to work)??

Sorry, not sure, I've never actually had cause to use output buffering.
You might want to ask the question specifically in a new thread. In
fact: Please do, I'd be very interested to hear what the others think
;-)
- -- 
Nick Wilson //  www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE9ChHWHpvrrTa6L5oRAiucAJ9Zpydunune2hmPjaBvyMAE9GpYCQCfSJZy
/2SzYVUDutkYu5821iyjscI=
=rBgs
-END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session variables in OOP....

2002-06-14 Thread 1LT John W. Holmes

If you want to do it right, don' t output anything, obviously. Instead of
using ECHO, assign all output to a variable within your class. Then, at the
end of the processing, after everything is done, echo out that variable
(which will contain the entire page). Then you can set cookies, sessions,
whatever, at any point.

Or you can use output buffering...

---John Holmes...

- Original Message -
From: "Wilbert Enserink" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 14, 2002 7:44 AM
Subject: [PHP] session variables in OOP


Hi all,


I'm busy building a site which uses OOP.
Several classes are used to constuct different sections of the final page to
be displayed.
The overall class is called class.basepage.php
This is the page which outputs HTML and calls other classes to construct
other parts of the page.
Now I have this problem: In one of the objects I use session variables.
However i get the famous error :Cannot send session cookie - headers
already sent by (output started "


Is there a way to overcome this problem? I mean: the session variable is
registered in the main part of the page after the class $this->header is
called (which writes HTML)... now, I don't think I can register the
sessionvariable at the top of my script since the value of the session var
is determined in the main.class...or can I?

I hope you understand my problem and have some tips for me. Below is some
code snippets I'm using:

thx and regards

Wilbert Enserink



class.basebape.php---
  header(); ?>// includes a php file which writes HTMLcode
functioning as the "header" of the HTML page (i.e. navigation menu)
 main(); ?> // includes a php file (main.php) which writes the
main part of the HTML data
---

---main.php--
echo "a lot of HTML depending on queries and stuff";
session_register($variable);



output browser--
Warning: Cannot send session cookie - headers already sent by (output
started at
/opt/guide/www.designmatcher.com/HTML/wwwtest/class.basepage.php:125) in
/opt/guide/www.abc.com/HTML/wwwtest/phpincludes/main/main.php on line 400
-

-
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
[EMAIL PROTECTED]
-


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session variables in OOP....

2002-06-14 Thread W. Enserink

Hi all,


Nick: thx for the tip, it removed the error, and might further be a good
idea: except:
do you know if I can declare session variables and use them in between the
output buffer statements
like this: (i tried it but it doesn't seem to work)??

greetings Wilbert


include ("class.basepage.php");
ob_start();//start the outputbuffering
$object= new basepage; //object basepage which determines which HTML
to output (due to queries and calcultaions)
session_register($variable);
$extra_variable=$variable+1;
echo "$extra_variable";
ob_get_contents();//show the buffer
ob_end_flush() ;//clear the buffer




- Original Message -
From: "Nick Wilson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 14, 2002 1:59 PM
Subject: Re: [PHP] session variables in OOP


> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
>
> * and then Wilbert Enserink declared
> > I hope you understand my problem and have some tips for me. Below is
some code snippets I'm using:
>
> Actually it's a little tricky to understand ;-)
> Have you considered output buffering?
> - --
> Nick Wilson //  www.explodingnet.com
>
>
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.0.6 (GNU/Linux)
>
> iD8DBQE9Cdq/HpvrrTa6L5oRAqmzAJ99bcz64l6/lfcIqLz4iGKlTLeJHQCeOmsH
> e0lahzjczcVE3aFql/+G6+M=
> =Fl/c
> -END PGP SIGNATURE-
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

- 
Pas de Deux 
Van Mierisstraat 25 
2526 NM Den Haag 
tel 070 4450855 
fax 070 4450852 
http://www.pdd.nl 
[EMAIL PROTECTED] 
-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session variables in OOP....

2002-06-14 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* and then Wilbert Enserink declared
> I hope you understand my problem and have some tips for me. Below is some code 
>snippets I'm using:

Actually it's a little tricky to understand ;-)
Have you considered output buffering?
- -- 
Nick Wilson //  www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE9Cdq/HpvrrTa6L5oRAqmzAJ99bcz64l6/lfcIqLz4iGKlTLeJHQCeOmsH
e0lahzjczcVE3aFql/+G6+M=
=Fl/c
-END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] session variables in OOP....

2002-06-14 Thread Wilbert Enserink

Hi all,


I'm busy building a site which uses OOP. 
Several classes are used to constuct different sections of the final page to be 
displayed. 
The overall class is called class.basepage.php
This is the page which outputs HTML and calls other classes to construct other parts 
of the page.
Now I have this problem: In one of the objects I use session variables. However i get 
the famous error :Cannot send session cookie - headers already sent by (output 
started "


Is there a way to overcome this problem? I mean: the session variable is registered in 
the main part of the page after the class $this->header is called (which writes 
HTML)... now, I don't think I can register the sessionvariable at the top of my script 
since the value of the session var is determined in the main.class...or can I?

I hope you understand my problem and have some tips for me. Below is some code 
snippets I'm using:

thx and regards 

Wilbert Enserink



class.basebape.php---
  header(); ?>// includes a php file which writes HTMLcode functioning as 
the "header" of the HTML page (i.e. navigation menu)
 main(); ?> // includes a php file (main.php) which writes the main part 
of the HTML data
---

---main.php--
echo "a lot of HTML depending on queries and stuff";
session_register($variable);



output browser--
Warning: Cannot send session cookie - headers already sent by (output started at 
/opt/guide/www.designmatcher.com/HTML/wwwtest/class.basepage.php:125) in 
/opt/guide/www.abc.com/HTML/wwwtest/phpincludes/main/main.php on line 400
-

-
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
[EMAIL PROTECTED]
-