2013-09-08 2 views
0

콧수염을 기반으로하는 머리말 템플릿이 있습니다. CSS 파일을 동적으로로드해야합니다. 이것은 내가 헤더 템플릿을로드하는 방법입니다PHP 콧수염 CSS 파일을 동적으로 추가하십시오.

:

if(file_exists(_LANG_DIR_ . 'common.lang.php')) 
      include(_LANG_DIR_ . 'common.lang.php'); 

     $header_tpl = $mustache->loadTemplate('inc/header'); 
     echo $header_tpl->render($common_page_lang); 

$common_page_langcommon.lang.php에서 배열입니다. 배열은 다음과 같습니다.

$common_page_lang = array(
'css_files' => Link::GetInstance()->css_files, <-- this returns an array 
'footer_loaded_text' => 'Footer Loaded!', 
'site_title' => $dynamic_title,); 

css_files는 페이지에 필요한 모든 CSS를 포함하는 배열 목록입니다.

서식 파일의 배열에서 CSS 목록을로드하는 방법이 있습니까?

<!DOCTYPE html> 
<html> 
<head> 
    <link rel="stylesheet" type="text/css" href="{{css_files}}" /> <-- this needs to be loaded as many as the $css_files array 
    <title>{{site_title}}</title> 
</head> 

<body> 

답변

0

당신은 "암시 반복자"라고 찾고 그것은 다음과 같습니다 무엇 : 약 의미

{{# css_files }} 
    <link rel="stylesheet" type="text/css" href="{{ . }}" /> 
{{/ css_files }} 

, foreach ($css_files as $.)

관련 문제