Re: functions, the best way to implement and arrange them..
| From: | Taco Mathijs Hillenaar-Meerveld | Date: | Wed, 13 Jul 2011 08:09:24 +0000 |
| Subject: | Re: functions, the best way to implement and arrange them.. | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-47917@lists.php.net to get a copy of this message | ||
yes, it was a structure like that i was looking for. so a class is a group
of functions?
i have heard about 'wrappers' to and from what i've heard it is the same
thing?
On Tue, Jul 12, 2011 at 11:36 PM, Karl DeSaulniers <karl@designdrumm.com>wrote:
>
> On Jul 12, 2011, at 7:28 AM, Taco Mathijs Hillenaar-Meerveld wrote:
>
> It might be a simple question for the local die-hards among here, but i'm
>> really wondering about how
>> developers arrange their scripts and keep their map structures.
>>
>> today i was looking for the best way to keep my scripts clear and to put
>> them into maps so i have a clear overview.
>> the same thing i would do for the scripts, using the functions i have and
>> throwing them in 1 or more php documents.
>>
>> i can not find it how it should be done. is it a good idea to put a couple
>> of functions in just 1 document?
>> like sessions and login/logout functions?
>>
>> in my idea i would only need to include a document in the header of my
>> website and then i'm done, right?
>>
>> some thoughts, ideas and tips would be appreciated.
>>
>> kind regards
>>
>> taco
>>
>
>
> Hi T,
> One way I've found is to set up separate pages.
> session.php
> database.php
> forms.php
> etc..
>
> Then in each you create a class named the same
>
> EG for session.php
> <?php
> class Session
> {
> /session vars
> var $username = "";
>
> function Session(){
> //constructor
> }
> //call your different session functions
> //set username for eg.
> }
> $session = new Session;
> ?>
>
> Then call on, say, the username var from a page.
>
> Eg: view_acct.php
> <?php include("scripts/session.php")**;
> <html>
> ...
> <input name="username" value="<?php echo($session->username);
> ?>" />
> ...
> </html>
>
> A very loose example, but hope it puts you on a good path..
> Best,
>
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>