|
º¸Åë PHP¿¡¼ include ¸¦ Çϱâ À§Çؼ´Â ¾Æ·¡¿Í °°Àº ¹æ½ÄÀ» »ç¿ëÇÕ´Ï´Ù.
<? include ("test.html"); ?>
À§¿Í °°Àº ¹æ½ÄÀ¸·Î include¸¦ ÇÏ°Ô µÇ¸é test.html ÆÄÀÏÀ» °¡Á®¿À°Ô µË´Ï´Ù.
ÀúÈñ ¼Ö·ç¼Çµµ À§¿Í°°Àº ¹æ½ÄÀ¸·Î htmlÆÄÀÏÀ» È£Ãâ°¡´ÉÇÕ´Ï´Ù.
´Ù¸¸ À§¿Í°°ÀÌ È£ÃâÇÏ°Ô µÉ °æ¿ì ÀúÈñ ¼Ö·ç¼Ç¿¡¼ »ç¿ëÇÏ´Â ÃßÃâű׸¦ ÇØ´ç include µÈ ÆÄÀÏ¿¡¼ »ç¿ëÀÌ ºÒ°¡´ÉÇÕ´Ï´Ù.
Áï À§ÀÇ ¿¹¸¦ µé¾î test.html ÆÄÀÏ¿¡¼
{{°Ô½ÃÆǺ¸±â ÆäÀÌÁö´ç7°³,°¡·Î1°³,Á¦¸ñ±æÀÌ45ÀÚ,º»¹®±æÀÌ0ÀÚ,°øÁö»çÇ×,bbs_rows_output_03.html,´©¶ô0°³,,,0/0}}
À§¿Í°°Àº ÃßÃâűװ¡ »ç¿ë ºÒ°¡´ÉÇÏ°Ô µË´Ï´Ù.
À̸¦ »ç¿ë°¡´ÉÇÏ°Ô ÇϱâÀ§ÇÑ ¹æ¹ýÀ» ¾Ë·Áµå¸®µµ·Ï ÇÏ°Ú½À´Ï´Ù.
inc/lib.php ¶Ç´Â inc/board_function.php ÆÄÀÏ¿¡ ¾Æ·¡¼Ò½º¸¦ Ãß°¡ÇÕ´Ï´Ù.
// {{ÀÎŬ·çµå top_menu.html}}
function include_template($Template)
{
global $TPL, $skin_folder;
if( !(is_file("$skin_folder/$Template")) )
{
print "$skin_folder/$Template ÆÄÀÏÀÌ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù. ";
return;
}
$random = rand()%1000;
$TPL->define("ÀÎŬ·çµå_$random", "$skin_folder/$Template");
$content = $TPL->fetch("ÀÎŬ·çµå_$random");
print $content;
}
±×¸®°í inc/function.php ÆÄÀÏÀÇ ¾Æ·¡ ¹è¿¿¡ ´ÙÀ½°ú °°ÀÌ Ãß°¡ÇÕ´Ï´Ù.
$TemplateM_name = Array(
"¸ÞÀθŹ°",
"¸ÅÀå¸Å¹°",
"ÃÖ´ÙÆǸÅ",
...
»ý·«
...
"°Ô½ÃÆǺ¸±â",
"ÀÎŬ·çµå"
);
$TemplateM_func = Array(
"main_extraction",
"list_extraction",
"main_sell_extraction",
...
»ý·«
...
"board_extraction_list",
"include_template"
);
$TemplateM_name ¹è¿ ¸¶Áö¸·¿¡ "ÀÎŬ·çµå" ¸¦ Ãß°¡ÇØÁֽðí,
$TemplateM_func ¹è¿ ¸¶Áö¸·¿¡ "include_template" ¸¦ Ãß°¡ÇØÁÖ½Ã¸é µË´Ï´Ù.
±×¸®°í À§ ¿¹Á¦ÀÇ
<? include("test.html") ?>
À§ ¹æ½ÄÀ» ¾Æ·¡¿Í °°Àº ¹æ½ÄÀ¸·Î »ç¿ëÇÏ½Ã¸é µË´Ï´Ù.
{{ÀÎŬ·çµå test.html}}
ÀÌ·¸°Ô ÇϽøé test.html ÆÄÀÏ¿¡¼ ÀúÈñ ¼Ö·ç¼ÇÀÇ ÃßÃâű׵µ »ç¿ëÀÌ °¡´ÉÇØÁý´Ï´Ù.
|
|