Alright, I'll give you a little background. I'm a PHP Developer being forced into an ASP.NET world... all I want to do is create a simple OOP approach to layout (header/footer/session management type stuff, etc).
I can handle the content but can someone give me a quick outline of how to create a class in ASP.NET?
I'm used to this:
And you call it like this:Code:<?php /* ========================================================= Class Name: pagemaker Creator: Bennet Oberholzer Date: 9/13/2006 Usage: Preparing various portions of page interaction ========================================================= */ class pagemaker { var $page; var $editor; var $ajax; var $insert; var $title; var $page_type; var $errorcode; function __construct($page, $page_type, $install) { $this->page = $page; $this->page_type = $page_type; $this->editor = 0; $this->ajax = 0; $this->title = ""; $this->insert = ""; $this->install = $install; $this->logged_in = 0; $this->errorcode = -1; } /********************************************************************************************** FUNCTION head - opens connection, provides header graphic, sets up body element, includes nav ***********************************************************************************************/ function head() { global $config, $manage; $ehandle = new sql_handler(2, "", $_SERVER['HTTP_HOST'] . "/" . $_SERVER['PHP_SELF']); $this->errorcode = -1; if($_REQUEST['req'] != 'loginuser' && $_REQUEST['req'] != 'logout') $this->auto_login(); elseif($_REQUEST['req'] == 'loginuser') $this->manual_login(); $this->redirect = 0; $this->editor = 0; $this->ajax = 0; // stuff ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <meta name="author" content="B. Oberholzer" /> <link rel="stylesheet" type="text/css" href="style/sinorca-screen.css" media="screen" title="Sinorca (screen)" /> <?php // LOAD MODULE'S JS $query = "SELECT jsfiles FROM modules WHERE mod_name = '$this->page_type'"; $result = $ehandle->update_query($query); if($result && mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result); $jsarray = explode(';', $row['jsfiles']); for($i=0;$i<count($jsarray);$i++) echo '<script language="javascript" type="text/javascript" src="'.$mod_loc.'/'.$jsarray[$i].'"></script>'; } <?php } // LOAD AJAX FRAMEWORK IF NEEDED if($this->ajax == 1) echo "<script language=\"javascript\" type=\"text/javascript\" src=\"js/qm.js\"></script>"; } /********************************************************************************************** FUNCTION foot - provides update specific information and closes off the page ***********************************************************************************************/ function foot() { global $config, $manage; ?> <div id="footer"> // stuff </div> <?php } } ?>
I'm not asking for someone to recreate that in ASP, but can someone give me a quick outline or point me in the direction of a tut that can show me how to recreate that in ASP.NET?Code:$pg = new pagemaker($_SERVER['PHP_SELF'], $_REQUEST['req'], $loc['install_folder']); $pg->head();




Reply With Quote