我有一个问题。我正在构建一个多主题网站,我已经将css位置存储在主题下的用户数据库中。问题是尝试将.css文件位置放在.tpl(模板文件)的href中以使其正常工作。如果有可能获得href来读取数据库?
这是我的class_user.php中的代码
/* ------------------------------- */
/* themes */
/* ------------------------------- */
/**
* get_user_theme_ids
*
* @return array
*/
public function get_user_theme_ids() {
global $db;
$themes = array();
$get_themes = $db->query("SELECT user_id FROM users") or _error(SQL_ERROR_THROWEN);
if($get_themes->num_rows > 0) {
while($theme = $get_themes->fetch_assoc()) {
$themes[] = $theme['user_id'];
}
}
return $themes;
}
/**
* get_theme_location
*
* @return array
*/
public function get_themes_location() {
global $db;
$themes = array();
$get_themes = $db->query("SELECT * FROM users") or _error(SQL_ERROR_THROWEN);
if($get_themes->num_rows > 0) {
while($theme = $get_themes->fetch_assoc()) {
$theme['theme_location'] = get_url_text($theme['theme_id']);
$themes[] = $theme;
}
}
return $themes;
}
现在在我的head.tpl我有
<link rel="stylesheet" type='text/css' href="{$theme['theme_id']}" />
它不会将数据库中的文本输入到href中。我做错了什么?