Re: functions, the best way to implement and arrange them..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux