½ÃÀÛÆäÀÌÁö·Î Áñ°Üã±âÃß°¡
·Î±×ÀÎ
ȸ¿ø°¡ÀÔ l Ã⼮üũ l ¸¶ÀÌÆäÀÌÁö l CGIMALL
happycgi
ÀÚ·á½Ç »çÀÌÆ®µî·Ï ·©Å·100 ÇÁ·Î±×·¥¸®ºä °ü¸®ÀÚÃßõÀÚ·á Ãʺ¸°¡À̵å
Ä¿¹Â´ÏƼ
Àüü ÆîÃ帱â
Äü¸Þ´º¸µÅ© jquery , CSS , PHP , Javascript , ¹«·áÆùÆ® , ASP
»ó¼¼°Ë»ö
Ȩ > PHP > PHP ¼Ò½ºÃ¢°í > À¥ À¯Æ¿¸®Æ¼ > ASAPlate (ÅÛÇø´) 0.0.1 »ó¼¼Á¤º¸
»çÀÌÆ®µî·Ï
Ŭ¶ó¿ìµåű×
Javascript
PHP
HTML
ASP
mysql
CSS
mobile
jquery
image
slide
�޴�
������Ʈ
¸Þ´º
ÇöÀçÁ¢¼ÓÀÚ ¸í »õ·Î°íħ
ASAPlate (ÅÛÇø´) 0.0.1
¼Ò½ºÅë°èÁ¤º¸ ¿À·ù½Å°í ¹× ¹®ÀÇ
ÇØÇÇÆÀ
³×ƼÁð
Æ®À§ÅÍ·Î º¸³»±â ÆäÀ̽ººÏÀ¸·Î º¸³»±â
¼Ò½ººÐ·ù À¥ À¯Æ¿¸®Æ¼
´Ù¿î·Îµå Ƚ¼ö 720 ȸ
°£´Ü¼³¸í HTML °ú code ¸¦ ºÐ¸®½ÃÄÑ Á־ À§ÁöÀ¨ÇÁ·Î±×·¥µîÀ¸·Î µðÀÚÀÎÀ» ÆíÇÏ°Ô ¼öÁ¤ÇÒ¼ö ÀÖ´Â ÅÛÇø´ ¿£ÁøÀÔ´Ï´Ù.
Æò°¡Çϱâ ÈǸ¢ÇÔ ¸Å¿ìÁÁÀ½ ÁÁÀ½ ±¦ÂúÀ½ º¸Åë º°·Î
¼Ò½º´Ù¿î·Îµå µ¥¸ð ¹Ì¸®º¸±â°¡ ¾ø½À´Ï´Ù ½ºÅ©·¦Çϱâ
==============
¼Ò °³ (INTRO)
==============

FastTemplate ¸¦ ±â¹ÝÀ¸·Î ÇÑ ÅÛÇø´¿£Áø ÀÔ´Ï´Ù. Áï HTML °ú code ¸¦ ºÐ¸®½ÃÄÑ Á־
À§ÁöÀ¨ÇÁ·Î±×·¥µîÀ¸·Î µðÀÚÀÎÀ» ÆíÇÏ°Ô ¼öÁ¤ÇÒ¼ö ÀÖ½À´Ï´Ù.
»ç¿ë¹æ¹ýÀº ±âÁ¸ÀÇ ÅÛÇø´ ¿£Áø°ú À¯»çÇϸç, ´ÙÀ̳ª¹Í ÅÛÇø´µîµµ Áö¿øÇÕ´Ï´Ù.
FastTemplate´Â º°°³·Î °³¹ßµÇ´Â ÇÁ·ÎÁ§Æ®ÀÌ¸ç »ç¿ëÀÌ °£´ÜÇÏ¸ç ¼Ò½ºÀÇ ±æÀ̶ÇÇÑ
ª¾ÆÁö¸ç °£´ÜÇØ Á³³×¿ä.


==============
¶óÀ̼¾½º
==============

GNU GPL

==============
¼³Ä¡È¯°æ
==============

PHP °¡ ¼³Ä¡µÈ°÷ÀÌ¸é ¾îµðµç »ç¿ë°¡´É

=============
¼³ Ä¡
=============

¼³Ä¡´Â ¼Ò½º¸¦ ¿Ã·Á³õ°í ´Ù¸¥ ÇÁ·Î±×·¥À» °³¹ß½Ã °æ·Î¿¡ ¸Â°Ô include Çؼ­ »ç¿ëÇϸé
µË´Ï´Ù. ¾Æ·¡¿¡´Â ¿¹Á¦·Î ÆÄÀÏ°ú ¼Ò½º ÆÄÀÏÀÔ´Ï´Ù.

=============
¿¹ Á¦
=============

include("../class/class.ASAPlate.php");
$tpl = new ASAPlate(".");
$tpl->Load("main.html");
$tpl->Load("menu.html");
$tpl->Load("extra.html");
$tpl->Load("body.html");
if($mul==""){
$mul=1;
}
$tpl->Assign(TITLE, "I am the title");
$tpl->Assign(MULTIP, $mul);
for($a=1;$a<=10;$a++){
$tpl->assign(( array( NUMBER => $a,
RESULT => $a*$mul )));
$tpl->Parse(TABLA, TABLAS, true);
}
$tpl->Parse(BODY);
$tpl->Parse(MAIN);
$tpl->FastPrint(MAIN);
// Uncoment this to watch the internal working of EasyTemplate
/* echo("--------------------------------

");
reset($tpl->PARSEVARS);
while (list ($LineNumber, $Line) = each ($tpl->PARSEVARS)) {
echo "$LineNumber=",htmlspecialchars($Line),"

";
}*/
?>

=============
¼Ò ½º
=============


/***************************************************************************
* class.ASAPlate.php *
* this class that makes very easy to separate php source code from the *
* templates that generate the look and feel of a web page. *
* ------------------- *
* begin : 2002/01/03 *
* author : Jos?Pablo Ezequiel (Pupeno) Fern?dez *
* email : pupeno@pupeno.com.ar *
* versi?: 0.0.1
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/***************************************************************************
* This work is based on the class FastTemplate that you can find at *
* http://www.thewebmasters.net/php/FastTemplate.phtml and a modification *
* made to that class by Sebastian Grignoli *
***************************************************************************/
class ASAPlate {

/***************************************************************************
* Variables *
***************************************************************************/
var $ROOT = ""; // Holds path-to-templates
var $WIN32 = false; // Set to true if this is a WIN32 server
var $STRICT = true; // Strict template checking. Unresolved
vars in templates will generate a warning when found.
var $ERROR = ""; // Holds the last error message
var $PARSEVARS = array(); // Holds the array of Variable handles
PARSEVARS[HANDLE] == "value"


/***************************************************************************
* Constructor *
* Returns: EasyTemplate object *
* $PathToTemplates: where the templates could be found *
***************************************************************************/
function ASAPlate ($PathToTemplates = ""){
global $PHPErrorMsg;

if(!empty($PathToTemplates)){
$this->SetRoot($PathToTemplates);
}
} // end (new) EasyTemplate ()

/***************************************************************************
* All templates will be loaded from this "root" directory *
* Can be changed in mid-process by re-calling with a new *
* value. *
* $Root: the path to be root of the templates *
***************************************************************************/
function SetRoot ($Root){
$Trailer = substr($Root,-1);

if(!$this->WIN32){
if( (ord($Trailer)) != 47 ){
$Root = $Root.chr(47); // Let``s add the trailing "/" if it``s not there
}
if(is_dir($Root)){
$this->ROOT = $Root;
} else {
$this->ROOT = "";
$this->error("Specified ROOT dir [$Root] is not a directory");
}
} else {
// WIN32 box - no testing
if( (ord($trailer)) != 92 )
{
$Root = $Root.chr(92);
}
$this->ROOT = $Root;
}
}


// Strict and non strict ways are not yet implemented.
/***************************************************************************
* Strict template checking, if true sends warnings to STDOUT when *
* parsing a template with undefined variable references *
* Used for tracking down bugs-n-such. Use no_strict() to disable. *
***************************************************************************/
function Strict(){
$this->STRICT = true;
}

/***************************************************************************
* Silently discards (removes) undefined variable references *
* found in templates *
***************************************************************************/
function NoStrict (){
$this->STRICT = false;
}

/***************************************************************************
* A quick check of the template file before reading it. *
* This is -not- a reliable check, mostly due to inconsistencies *
* in the way PHP determines if a file is readable. *
***************************************************************************/
function IsSafe($FileName){
if(!file_exists($FileName)){
$this->Error("[$FileName] does not exist",0);
return false;
}
return true;
}

/**************************************************************************
* Show the error and exit if necesary *
* $ErrorMsg: Error Message to be printed *
* $Die: if it``s 1, it``s a fatal error and the script ends, otherwise it *
* doesn``t *
**************************************************************************/
function Error($ErrorMsg, $Die = 0){
$this->ERROR = $ErrorMsg;
printf("ERROR: $this->ERROR

");
if ($Die == 1){
exit;
}
return;
} // end Error()

/**************************************************************************
* Grabs a template from the root dir and *
* reads it into a (potentially REALLY) big string *
* Returns: false in case the file can``t be found, tru after opening *
* and parsing it. *
* $Template: The name of the file to be loaded *
**************************************************************************/
function Load($Template){
if(empty($this->ROOT)){
$this->Error("Cannot open template. Root not valid.",1);
return false;
}

$FileName = "$this->ROOT"."$Template";
/* if(!(IsSafe($FileName))){ CHECK WHY THIS DOESN``T WORK
return false;
}*/
$Contents = @file($FileName);

while (list ($LineNumber, $Line) = each ($Contents)) {
if (eregi("", $Line)){
$Section = "";
}
if($Section != ""){
$this->PARSEVARS["$Section"]=$this->PARSEVARS["$Section"].$Line;
}
if (eregi("", $Line)){
$TempVar = explode(" ", $Line);
$Section = $TempVar[3];
}
}
return true;
}


/***************************************************************************
* Assigns a value to a key for parsing, or an array *
* of values to keys. *
* $TPLArray: it could be a key for a value or an array with keys an values*
* $Trailer: it``s the value for a key when $TPLArray is not an array. *
***************************************************************************/
function Assign ($TPLArray, $Trailer=""){
if(gettype($TPLArray) == "array"){
while ( list ($Key,$Val) = each ($TPLArray) ){
if (!(empty($Key))){
// Empty values are allowed
// Empty Keys are NOT
$this->PARSEVARS["$Key"] = $Val;
}
}
} else {
// Empty values are allowed in non-array context now.
if (!empty($TPLArray)){
$this->PARSEVARS["$TPLArray"] = $Trailer;
}
}
}

/**************************************************************************
* Return the value of an assigned variable. *
* Christian Brandel cbrandel@gmx.de *
* Returns: the value of the given key *
* $TPLName: key for a value on the PARSEVARS array *
**************************************************************************/
function GetAssigned($TPLName = ""){
if(empty($TPLName)){
return false;
}
if(isset($this->PARSEVARS["$TPLName"])){
return ($this->PARSEVARS["$TPLName"]);
} else {
return false;
}
}

/***************************************************************************
* Parse a template *
* $Orig: the name of the template already on memory to be parsed. *
* $Dest: if it``s set, where the parsed template will be stored. *
* $Add: if it``s true, add instead of replacing the parsed template. *
***************************************************************************/
function Parse($Orig, $Dest="", $Add=false){
reset($this->PARSEVARS);
if($Dest == ""){
$Dest = $Orig;
}
$Temp = $this->PARSEVARS[$Orig];
while ( list ($Key,$Val) = each ($this->PARSEVARS) ){
if($Key==$Template){
continue;
}
if (!(empty($Key))){
if(gettype($Val) != "string"){
settype($Val,"string");
}
// php4 doesn``t like ``{$`` combinations.
$Key = ``{``."$Key".``}``;
$Temp = str_replace("$Key","$Val","$Temp");
}
}
if($Add){
$this->PARSEVARS[$Dest] = $this->PARSEVARS[$Dest].$Temp;
} else {
$this->PARSEVARS[$Dest] = $Temp;
}
}

/***************************************************************************
* FastPrint *
* $Template: the template to be printed *
***************************************************************************/
function FastPrint($Template){
if(!isset($this->PARSEVARS[$Template])){
$this->Error("Template [$Template] doesn``t exist", 1);
} else {
echo($this->PARSEVARS[$Template]);
}
}
}
?>


ÀÚ·áÃâó : http://www.codelib.co.kr

³×ƼÁð ÀÇ°ß   ÀÌ¿ëÇϽŠÀÚ·áÀÇ Èı⸦ ÀÚÀ¯·Ó°Ô ÀÛ¼ºÇϼ¼¿ä. (»ó¾÷ÀûÀÎ ±¤°í ¹× µµ¹è¼º ±Û µîÀº »çÀüÅ뺸¾øÀÌ »èÁ¦µÉ ¼ö ÀÖ½À´Ï´Ù.)
³»¿ë ¾ÆÀ̵ð ÀÇ°ß³²±â±â
µî·ÏµÈ ÀÇ°ßÀÌ ¾ø½À´Ï´Ù.
1
À̸§
³»¿ë
:³×¸Â¾Æ¿ä: :È­³ª´Â±º¿ä: :Àá¿Í: :¿ì¿ïÇØ: :À̰ǾƳÄ: :¿ÕÇÏÇÏ: ¿Õ¿ôÀ½~ ³î·¥~
Æò°¡Çϱâ ÈǸ¢ÇÔ ¸Å¿ìÁÁÀ½ ÁÁÀ½ ±¦ÂúÀ½ º¸Åë º°·Î
µµ¹è¹æÁöÅ°
 11499261 º¸ÀÌ´Â µµ¹è¹æÁöÅ°¸¦ ÀÔ·ÂÇϼ¼¿ä.