汇率网主题模板 主题说明
简介:专为汇率、外汇、货币换算类网站设计。主题内含 实时汇率换算、人民币汇率牌价、汇率知识文章 三大核心板块,采用暖橙 + 灰白的清爽配色,配合圆角卡片布局,数据清晰易读。
主题截图
首页截图
分类页截图
文章详情页截图
安装方法
- 下载逗号CMS → 登录后台 → 主题管理 → 主题列表,找到「兴趣圈子主题模板」主题,点击免费安装。
- 进入 后台 → 网站设置 → 顶部导航,配置顶部导航及链接。
- 进入 后台 → 网站设置 → 参数设置,配置首页、分类页、文章页的文章显示数量。
- 进入网站设置 → SEO 设置,配置首页、文章分类列表页、文章详情页的 SEO 信息。
- 可选:我们在img文件夹自带了所有国家的国旗,如果您想更换国家,图标直接更换为当前国家的代码.svg 即可。
配置 API
汇率网主题依赖「逗号API」提供实时汇率数据,共使用 2 个接口:
核心功能接口
- 实时汇率换算 — 输入金额,将一种货币换算为另一种货币,返回实时汇率、换算结果、更新时间
- 人民币汇率牌价 — 以人民币为基准,返回 40+ 常见货币的实时汇率列表
调用API接口:https://api.douhao.com/jie/6.html,0.1 积分/次 初级代理免费调用
获取 API 密钥
- 访问
逗号API网站注册账号 - 登录后台首页,复制「API密钥」
配置 API 密钥
- 您的网站后台 → 网站设置(或主题中心)
- 在「逗号API密钥」输入框粘贴密钥--保存设置
积分获取方式
接口参数一览
| 功能 | api_id | 入参字段 | 积分 |
|---|---|---|---|
| 实时汇率换算 | 6 | from / to / money | 0.1 积分/次 |
| 人民币汇率牌价 | 6 | from / format | 0.1 积分/次 |
如积分不足,请前往逗号API网站充值。账户积分与价格可在逗号API后台查看。
功能特色
实时汇率换算
输入金额、选择源货币和目标货币,一键获取实时汇率和换算结果,含更新时间。
人民币汇率牌价
以人民币为基准,展示 40+ 常见货币的牌价,支持「全部 / 常用」切换和关键词搜索。
本地国旗图标
货币前显示对应国家/地区国旗图标,本地 SVG 加载,无外部 CDN 依赖,速度快且稳定。
汇率知识板块
首页按文章分类独立成容器,每个分类为一个知识区,标题为分类名称,内容为对应文章。
搜索标签 + 友情链接
首页底部左右两栏布局,展示搜索标签和友情链接,样式统一,简洁清爽。
PC/手机自适应
一套模板自动适配各种屏幕,移动端隐藏更新时间列、导航合并为三横图标侧滑菜单。
页面列表
主题包含以下页面文件,全部位于 /templates/huilv/ 目录:
| 文件名 | 页面说明 | URL |
|---|---|---|
header.php | 公共头部(导航 + SEO + 移动端菜单) | - |
footer.php | 公共底部(含漂浮广告 + 活跃上报) | - |
index.php | 网站首页(汇率换算 + 牌价 + 知识 + 底部两栏) | / |
category.php | 文章分类列表页 / 搜索页 | /list.html、/category-x.html |
article.php | 文章详情页(含阅读全文广告联动) | /article-x.html |
search_rs.php | 热搜标签聚合页 | /rs |
style.css | 主题全局样式 | - |
其他资源
| 文件/目录 | 说明 |
|---|---|
/templates/huilv/img/ | 本地国旗 SVG 图片目录(如 cn.svg、us.svg) |
广告位配置
汇率网主题集成了 4 个广告位,位置如下:
| 广告位 | 调用位置 | 说明 |
|---|---|---|
banner(网站轮播图) | 首页顶部、列表页顶部、文章页顶部、热搜标签页顶部 | 轮播模式,支持多图轮播 |
header_banner(网站横幅) | 所有页面导航下方 | 随机模式,显示图片/代码/文字广告 |
footer_float(网站底部悬浮) | 所有页面底部 | 随机模式,底部悬浮广告,带关闭按钮 |
article_readmore(文章页阅读全文) | 文章页点击「阅读全文」时弹出 | 随机模式,与「网站设置 → 阅读全文」联动 |
如何配置广告?
- 后台 → 内容管理 → 广告管理
- 选择对应的广告位(如「网站横幅」),点击「广告设置」
- 点击「添加广告」,填写标题、选择投放页面、选择广告模板
- 设置排序、状态,保存
阅读全文广告联动
文章页的「阅读全文」广告与后台「网站设置 → 阅读全文」开关联动:
- 开启「阅读全文」后,文章页只显示前 2/3 内容,底部显示「阅读全文」按钮
- 若「文章页阅读全文」广告位有启用的广告,点击按钮会弹出广告弹窗,并倒计时 5 秒后自动显示全文
- 若没有广告,点击按钮直接显示全文
- 按 ESC 键可关闭广告弹窗并直接显示全文
如需不同页面显示不同广告图,可在后台新增广告位,然后将对应的调用代码放到相应页面即可。
前端路由规则
<?php
function parse_rewrite_url($uri, $setting, $db, $prefix) {
if ($uri === '/ubb' || $uri === '/ubb/') {
return 'ubb_index';
}
if (preg_match('/^\/ubb\/([a-zA-Z0-9_\-]+)\/?$/', $uri, $matches)) {
$_GET['slug'] = $matches[1];
return 'ubb_page';
}
if ($uri === '/rs' || $uri === '/rs/') {
return 'search_rs_index';
}
if (preg_match('/^\/rs\/(.+?)\/?$/', $uri, $matches)) {
$keyword = urldecode($matches[1]);
$keyword = trim($keyword);
if ($keyword !== '') {
$_GET['keyword'] = $keyword;
return 'search';
}
}
$article_prefix = preg_quote($setting['article_prefix'] ?? 'article-', '/');
if (preg_match('/^\/' . $article_prefix . '([0-9a-zA-Z]+)\.html$/', $uri, $matches)) {
$url_id = $matches[1];
if ($setting['url_mode'] == 1) {
$_GET['id'] = intval($url_id);
} else {
$field = ($setting['url_mode'] == 2) ? 'hash_id' : 'md5_id';
$stmt = $db->prepare("SELECT id FROM {$prefix}article WHERE $field = ? LIMIT 1");
if ($stmt) {
$stmt->bind_param("s", $url_id);
$stmt->execute();
$res = $stmt->get_result();
if ($res && $res->num_rows > 0) {
$row = $res->fetch_assoc();
$_GET['id'] = $row['id'];
} else {
http_response_code(404);
require_once ROOT_PATH . '/set/404.php';
exit;
}
$stmt->close();
} else {
http_response_code(404);
require_once ROOT_PATH . '/set/404.php';
exit;
}
}
return 'article';
}
$category_prefix = preg_quote($setting['category_prefix'] ?? 'category-', '/');
if (preg_match('/^\/' . $category_prefix . '([0-9a-zA-Z]+)\.html$/', $uri, $matches)) {
$url_id = $matches[1];
$cat_url_mode = $setting['category_url_mode'] ?? 1;
if ($cat_url_mode == 1) {
$_GET['id'] = intval($url_id);
} else {
$field = ($cat_url_mode == 2) ? 'hash_id' : 'md5_id';
$stmt = $db->prepare("SELECT id FROM {$prefix}category WHERE $field = ? LIMIT 1");
if ($stmt) {
$stmt->bind_param("s", $url_id);
$stmt->execute();
$res = $stmt->get_result();
if ($res && $res->num_rows > 0) {
$row = $res->fetch_assoc();
$_GET['id'] = $row['id'];
} else {
http_response_code(404);
require_once ROOT_PATH . '/set/404.php';
exit;
}
$stmt->close();
} else {
http_response_code(404);
require_once ROOT_PATH . '/set/404.php';
exit;
}
}
return 'category';
}
if (preg_match('/^\/product\.html$/', $uri)) {
return 'product_list';
}
$product_category_prefix = preg_quote($setting['product_category_prefix'] ?? 'product-category-', '/');
if (preg_match('/^\/' . $product_category_prefix . '([0-9a-zA-Z]+)\.html$/', $uri, $matches)) {
$url_id = $matches[1];
$product_cat_url_mode = $setting['product_category_url_mode'] ?? 1;
if ($product_cat_url_mode == 1) {
$_GET['id'] = intval($url_id);
} else {
$field = ($product_cat_url_mode == 2) ? 'hash_id' : 'md5_id';
$stmt = $db->prepare("SELECT id FROM {$prefix}product_category WHERE $field = ? LIMIT 1");
if ($stmt) {
$stmt->bind_param("s", $url_id);
$stmt->execute();
$res = $stmt->get_result();
if ($res && $res->num_rows > 0) {
$row = $res->fetch_assoc();
$_GET['id'] = $row['id'];
} else {
http_response_code(404);
require_once ROOT_PATH . '/set/404.php';
exit;
}
$stmt->close();
} else {
http_response_code(404);
require_once ROOT_PATH . '/set/404.php';
exit;
}
}
return 'product_list';
}
$product_prefix = preg_quote($setting['product_prefix'] ?? 'product-', '/');
if (preg_match('/^\/' . $product_prefix . '([0-9a-zA-Z]+)\.html$/', $uri, $matches)) {
$url_id = $matches[1];
$product_url_mode = $setting['product_url_mode'] ?? 1;
if ($product_url_mode == 1) {
$_GET['id'] = intval($url_id);
} else {
$field = ($product_url_mode == 2) ? 'hash_id' : 'md5_id';
$stmt = $db->prepare("SELECT id FROM {$prefix}product WHERE $field = ? LIMIT 1");
if ($stmt) {
$stmt->bind_param("s", $url_id);
$stmt->execute();
$res = $stmt->get_result();
if ($res && $res->num_rows > 0) {
$row = $res->fetch_assoc();
$_GET['id'] = $row['id'];
} else {
http_response_code(404);
require_once ROOT_PATH . '/set/404.php';
exit;
}
$stmt->close();
} else {
http_response_code(404);
require_once ROOT_PATH . '/set/404.php';
exit;
}
}
return 'product_detail';
}
if ($uri === '/list.html' || preg_match('/^\/list-([0-9]+)\.html$/', $uri, $matches)) {
if (isset($matches[1])) $_GET['page'] = intval($matches[1]);
return 'list';
}
if ($uri === '/' || $uri === '/index.php') {
return 'index';
}
return '404';
}
function route_dispatch($action, $db, $prefix, $setting, $template_path) {
if ($action === '404') {
http_response_code(404);
require_once ROOT_PATH . 'set/404.php';
exit;
}
if ($action === 'ubb_index') {
$seo_row = $db->query("SELECT * FROM {$prefix}seo WHERE page_name = 'ubb_index' LIMIT 1")->fetch_assoc();
$site_name = $setting['site_name'] ?? '逗号CMS';
if ($seo_row) {
$seo = [
'title' => str_replace('{site_name}', $site_name, $seo_row['title'] ?: ('留言本 - ' . $site_name)),
'keywords' => str_replace('{site_name}', $site_name, $seo_row['keywords']),
'description' => str_replace('{site_name}', $site_name, $seo_row['description']),
];
} else {
$seo = [
'title' => '留言本 - ' . $site_name,
'keywords' => '留言本,在线留言,反馈',
'description' => '欢迎使用在线留言本,选择您想要留言的页面'
];
}
include $template_path . 'header.php';
require ROOT_PATH . 'set/ubb/index.php';
include $template_path . 'footer.php';
return true;
}
if ($action === 'ubb_page') {
$slug = isset($_GET['slug']) ? trim($_GET['slug']) : '';
$page_info_row = $db->query("SELECT * FROM {$prefix}ubb_pages WHERE slug = '" . $db->real_escape_string($slug) . "' AND status = 1 LIMIT 1")->fetch_assoc();
$site_name = $setting['site_name'] ?? '逗号CMS';
if ($page_info_row) {
$seo_row = $db->query("SELECT * FROM {$prefix}seo WHERE page_name = 'ubb_page' LIMIT 1")->fetch_assoc();
$replace_map = [
'{page_name}' => $page_info_row['name'],
'{page_description}' => $page_info_row['description'] ?: $page_info_row['name'],
'{site_name}' => $site_name,
];
if ($seo_row) {
$seo = [
'title' => str_replace(array_keys($replace_map), array_values($replace_map), $seo_row['title'] ?: ($page_info_row['name'] . ' - ' . $site_name)),
'keywords' => str_replace(array_keys($replace_map), array_values($replace_map), $seo_row['keywords']),
'description' => str_replace(array_keys($replace_map), array_values($replace_map), $seo_row['description']),
];
} else {
$seo = [
'title' => $page_info_row['name'] . ' - ' . $site_name,
'keywords' => $page_info_row['name'],
'description' => $page_info_row['description'] ?: $page_info_row['name']
];
}
} else {
$seo = [
'title' => '留言页 - ' . $site_name,
'keywords' => '',
'description' => ''
];
}
include $template_path . 'header.php';
require ROOT_PATH . 'set/ubb/page.php';
include $template_path . 'footer.php';
return true;
}
if ($action === 'search_rs_index') {
$site_name = $setting['site_name'] ?? '逗号CMS';
$seo_row = $db->query("SELECT * FROM {$prefix}seo WHERE page_name = 'search_rs_index' LIMIT 1")->fetch_assoc();
if ($seo_row) {
$seo = [
'title' => str_replace('{site_name}', $site_name, $seo_row['title'] ?: ('热搜标签 - ' . $site_name)),
'keywords' => str_replace('{site_name}', $site_name, $seo_row['keywords']),
'description' => str_replace('{site_name}', $site_name, $seo_row['description']),
];
} else {
$seo = [
'title' => '热搜标签 - ' . $site_name,
'keywords' => '热搜,标签,热门搜索',
'description' => '网站热搜标签聚合页'
];
}
include $template_path . 'header.php';
include $template_path . 'search_rs.php';
include $template_path . 'footer.php';
return true;
}
if ($action === 'search') {
$_GET['action'] = 'search';
$keyword = isset($_GET['keyword']) ? trim($_GET['keyword']) : '';
$keyword_display = $keyword;
if (!empty($keyword)) {
if (!check_sensitive_words($keyword)) {
http_response_code(404);
require_once ROOT_PATH . 'set/404.php';
exit;
}
record_hot_search($keyword);
$keyword_escaped = str_replace(['%', '_'], ['\\%', '\\_'], $keyword);
save_search_keyword($keyword_escaped);
$keywords = split_search_keywords($keyword);
$page = isset($_GET['page']) ? max(1, intval($_GET['page'])) : 1;
$page_size = 20;
$search_result = search_articles_by_keywords($keywords, $page, $page_size);
$articles = $search_result['articles'];
$total = $search_result['total'];
$base_url = "/rs/" . rawurlencode($keyword) . "?";
$pagination = pagination($total, $page_size, $page, $base_url);
} else {
$articles = [];
$total = 0;
$pagination = '';
$search_result = ['keywords' => []];
}
$seo = get_seo('search', ['keyword' => $keyword_display]);
include $template_path . 'header.php';
include $template_path . 'category.php';
include $template_path . 'footer.php';
return true;
}
if ($action === 'list') {
$page = isset($_GET['page']) ? max(1, intval($_GET['page'])) : 1;
$page_size = 20;
$total = get_article_count();
$offset = ($page - 1) * $page_size;
$articles = get_articles('', "$offset, $page_size");
$base_url = "/list.html?";
$pagination = pagination($total, $page_size, $page, $base_url);
$seo = get_seo('category', ['category_name' => '全部文章']);
include $template_path . 'header.php';
include $template_path . 'category.php';
include $template_path . 'footer.php';
return true;
}
if ($action === 'category') {
$category_id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$page = isset($_GET['page']) ? max(1, intval($_GET['page'])) : 1;
$page_size = 20;
$category_name = '';
$categories = get_categories();
foreach ($categories as $cat) {
if ($cat['id'] == $category_id) {
$category_name = $cat['name'];
break;
}
}
if (!$category_name) {
http_response_code(404);
require_once ROOT_PATH . '/set/404.php';
exit;
}
$seo = get_seo('category', ['category_name' => $category_name]);
$where = "category_id = $category_id";
$total = get_article_count($where);
$offset = ($page - 1) * $page_size;
$articles = get_articles($where, "$offset, $page_size");
$base_url = "/" . ($setting['category_prefix'] ?? 'category-') . build_url_id('category', $category_id) . ".html?";
$pagination = pagination($total, $page_size, $page, $base_url);
include $template_path . 'header.php';
include $template_path . 'category.php';
include $template_path . 'footer.php';
return true;
}
if ($action === 'article') {
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$article = get_article($id);
if (!$article) {
http_response_code(404);
require_once ROOT_PATH . '/set/404.php';
exit;
}
update_views($id);
$category_name = '';
$categories = get_categories();
foreach ($categories as $cat) {
if ($cat['id'] == $article['category_id']) {
$category_name = $cat['name'];
break;
}
}
$seo = get_seo('article', [
'article_title' => $article['title'],
'article_description' => $article['description'] ?: mb_substr(strip_tags($article['content']), 0, 150),
'category_name' => $category_name
]);
include $template_path . 'header.php';
include $template_path . 'article.php';
include $template_path . 'footer.php';
return true;
}
if ($action === 'product_list') {
$category_id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$page = isset($_GET['page']) ? max(1, intval($_GET['page'])) : 1;
$page_size = 12;
$category_name = '全部产品';
if ($category_id > 0) {
$cats = $db->query("SELECT * FROM {$prefix}product_category ORDER BY sort ASC");
while ($cat = $cats->fetch_assoc()) {
if ($cat['id'] == $category_id) {
$category_name = $cat['name'];
break;
}
}
}
$seo = get_seo('product_list', ['category_name' => $category_name]);
if ($category_id > 0) {
$where = "WHERE category_id = $category_id";
$total = $db->query("SELECT COUNT(*) as t FROM {$prefix}product $where")->fetch_assoc()['t'];
} else {
$where = '';
$total = $db->query("SELECT COUNT(*) as t FROM {$prefix}product")->fetch_assoc()['t'];
}
$offset = ($page - 1) * $page_size;
$products = $db->query("SELECT * FROM {$prefix}product $where ORDER BY id DESC LIMIT $offset, $page_size");
$product_cats = $db->query("SELECT * FROM {$prefix}product_category ORDER BY sort ASC");
include $template_path . 'header.php';
include $template_path . 'product_list.php';
include $template_path . 'footer.php';
return true;
}
if ($action === 'product_detail') {
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$product = $db->query("SELECT p.*, c.name as category_name FROM {$prefix}product p LEFT JOIN {$prefix}product_category c ON p.category_id = c.id WHERE p.id = $id")->fetch_assoc();
if (!$product) {
http_response_code(404);
require_once ROOT_PATH . '/set/404.php';
exit;
}
$db->query("UPDATE {$prefix}product SET views = views + 1 WHERE id = $id");
$gallery = json_decode($product['gallery'], true);
if (!is_array($gallery)) $gallery = [];
$seo = get_seo('product_detail', [
'product_title' => $product['title'],
'product_description' => $product['description'],
'category_name' => $product['category_name'] ?? ''
]);
include $template_path . 'header.php';
include $template_path . 'product_detail.php';
include $template_path . 'footer.php';
return true;
}
if ($action === 'index') {
$seo = get_seo('index');
$ads = get_ads(5);
$recommend_articles = get_articles('is_recommend = 1', $seo['recommend_count']);
$latest_articles = get_articles('', $seo['latest_count']);
$latest_searches = get_latest_search(5);
include $template_path . 'header.php';
include $template_path . 'index.php';
include $template_path . 'footer.php';
return true;
}
return false;
}
逗号CMS