Re: <% init
| From: | Tim Sawyer | Date: | Mon, 23 Oct 2000 01:48:00 +0000 |
| Subject: | Re: <% init | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-21679@lists.php.net to get a copy of this message | ||
Not that simple. I'm setting a cookie and it won't work in a function. Here's
a code snip;
1 <?php
2 //Do the cookie thing.
3 if ($go) {
4 //write the cookies if Go button pressed, expires 90 days
5 setcookie("selvar[company]", $company, time() +7776000, "/");
6 setcookie("selvar[location]", $location, time() +7776000, "/");
7 } else {
8 //Initialize vars from cookie if not
9 $company=$selvar[company];
10 $location=$selvar[location];
11 }
12 ...
39 ?>
40 <html>
41 <head>
42 <title>...
Teodor Cimpoesu wrote:
> Hi Tim!
> On Sat, 21 Oct 2000, Tim Sawyer wrote:
>
> > HTML::Mason has an init construct <% init /%> that allows you to put
> > initialization code anywhere in your program, usually at the bottom.
> > That way non programmer content creation type people don't have to see a
> > bunch of initialization at the top of the file. Is there an equivalent
> > way to do that in PHP?
> yap.
> <%init()%>
> <html>
> <%
> //
> // page stuff
> //
> %>
> </html>
> <%function init() { // init stuff;} %>
>
> simple, isn't it ;)
>
> -- teodor
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
Tim Sawyer
:wq