宝宝起名主题模板 V1.0
主题分类: 传统文化
演示地址: 暂无演示,查看截图
CMS版本: 最低 V 6.0
主题价格: 免费
发布日期: 2026-09-28 11:50:35
下载安装 下载安装逗号CMS进入后台--主题中心-安装宝宝起名主题模板即可。

宝宝起名主题模板 主题说明

简介:宝宝起名主题风格大气典雅,以红白为主色调,包含宝宝起名、姓名打分、老黄历查询等。由程序员和专业姓名学老师根据用户输入生辰八字真实排盘开发,速度快,结果好。

主题概览

宝宝起名主题是一款专为起名类网站设计的逗号CMS模板,风格大气典雅,以红白为主色调,适合宝宝起名、姓名打分、老黄历查询等场景,并集成了文章展示模块。内容调用 逗号API接口,该接口由程序员配合专业姓名学老师根据用户真实输入的姓氏及生辰八字排盘计算开发完成,速度快,结果好。

核心功能

  • 宝宝起名 — 输入姓氏、出生日期和性别,基于八字五行自动计算出吉祥好名
  • 调用API接口:https://api.douhao.com/jie/55.html,10积分/次,中级代理免费使用。

  • 姓名打分 — 输入姓名,从五格数理、三才配置、八字五行等维度综合评分
  • 调用API接口:https://api.douhao.com/jie/22.html,2积分/次,中级代理免费使用。

  • 老黄历 — 查询每日黄历,包含宜忌、吉神凶煞、时辰吉凶等详细内容
  • 调用API接口:https://api.douhao.com/jie/16.html,1积分/次,初级代理免费使用。

  • 文章展示 — 首页展示最新、推荐、热门文章三栏,支持分类筛选和文章详情
⚠️ 提示: 逗号API平台注册有赠送积分,为保证积分充足,建议充值一些积分或者推广逗号产品赚取积分,以免因积分不足无法调用!

代理权益列表:https://api.douhao.com/daili 。

也可以 充值积分 还可以 推广获积分

主题截图

首页截图
首页截图
起名页面截图
起名页面截图
姓名打分页面截图
姓名打分页面截图

安装方法

  1. 下载逗号CMS → 登录后台 → 主题管理 → 主题列表,找到「宝宝起名主题模板」主题,点击免费安装
  1. 进入后台 → 网站设置 → SEO 设置,配置首页、文章分类列表页、文章详情页的 SEO 信息。可选:打开模板/templates/jiri/header.php,修改配置各页面的 SEO 信息。
  2. 进入 后台 → 网站设置 → 顶部导航,配置顶部导航及链接。
  3. 进入后台 → 网站设置,设置联盟ID。改为你自己在伍柒联盟union.632757.com的ID(右上角),所有收益就像归于您自己名下。【必须是V7.0以上】
必看 修改起名结果数量、页面显示403、访问受限请按照下面方法操作
  1. 起名数量:打开模板 /templates/qiming/qiming.php:35行左右$limit = 500; $per_page = 10; 改为您想要的数量。limit 是总结果数,最大500个,per_page 为每页数量。
  2. 显示403:复制下面前端路由规则代码到:后台 → 管理 → 前端路由管理 → 全选覆盖路由规则 → 保存配置即可
  3. 测试显示访问受限:后台 → 统计安全 → 安全设置 → 关闭SQL注入。仅9月27日前下载的V6.9版本的部分IIS有此问题,若你遇到此问题未成功解决可以联系QQ:26505555588 反馈。

前端路由规则

<?php
function parse_rewrite_url($uri, $setting, $db, $prefix) {
    
    if ($uri === "/" || $uri === "/index.php") {
        return "qiming_index";
    }
    
    if ($uri === "/qiming.html") {
        return "qiming_result";
    }
    
    if ($uri === "/dafen.html") {
        return "qiming_dafen";
    }
    
    if ($uri === "/laohuangli.html") {
        return "qiming_laohuangli";
    }
    
    $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 __DIR__ . "/set/404.php";
                    exit;
                }
                $stmt->close();
            } else {
                http_response_code(404);
                require_once __DIR__ . "/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 __DIR__ . "/set/404.php";
                    exit;
                }
                $stmt->close();
            } else {
                http_response_code(404);
                require_once __DIR__ . "/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 __DIR__ . "/set/404.php";
                    exit;
                }
                $stmt->close();
            } else {
                http_response_code(404);
                require_once __DIR__ . "/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 __DIR__ . "/set/404.php";
                    exit;
                }
                $stmt->close();
            } else {
                http_response_code(404);
                require_once __DIR__ . "/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";
    }
    
    return "index";
}

function route_dispatch($action, $db, $prefix, $setting, $template_path) {
    
    if ($action === "qiming_index") {
        if (!isset($_GET["year"]) || !isset($_GET["month"])) {
            $_GET["year"] = date("Y");
            $_GET["month"] = date("n");
        }
        $year = intval($_GET["year"]);
        $month = intval($_GET["month"]);
        if ($month < 1) $month = 1;
        if ($month > 12) $month = 12;
        $_GET["year"] = $year;
        $_GET["month"] = $month;
        
        $seo = [
            "title" => "宝宝起名 - " . $setting["site_name"],
            "keywords" => "宝宝起名,取名,八字起名",
            "description" => "基于八字五行、音律字形、国学经典,为宝宝起个好名"
        ];
        include ROOT_PATH . "templates/qiming/header.php";
        include ROOT_PATH . "templates/qiming/index.php";
        include ROOT_PATH . "templates/qiming/footer.php";
        return true;
    }
    
    if ($action === "qiming_result") {
        $seo = [
            "title" => "宝宝起名结果 - " . $setting["site_name"],
            "keywords" => "宝宝起名,八字起名,周易起名,起名推荐",
            "description" => "基于八字五行、音律字形、国学经典,为宝宝生成吉祥好名"
        ];
        include ROOT_PATH . "templates/qiming/header.php";
        include ROOT_PATH . "templates/qiming/qiming.php";
        include ROOT_PATH . "templates/qiming/footer.php";
        return true;
    }
    
    if ($action === "qiming_dafen") {
        $seo = [
            "title" => "姓名打分 - " . $setting["site_name"],
            "keywords" => "姓名打分,名字评分,五格数理,三才配置",
            "description" => "基于五格数理、三才配置、八字五行,为姓名综合评分"
        ];
        include ROOT_PATH . "templates/qiming/header.php";
        include ROOT_PATH . "templates/qiming/dafen.php";
        include ROOT_PATH . "templates/qiming/footer.php";
        return true;
    }
    
    if ($action === "qiming_laohuangli") {
        $seo = [
            "title" => "老黄历 - " . $setting["site_name"],
            "keywords" => "老黄历,黄道吉日,择日,万年历,黄历查询",
            "description" => "提供每日黄历查询,包含宜忌、吉神凶煞、时辰吉凶等"
        ];
        include ROOT_PATH . "templates/qiming/header.php";
        include ROOT_PATH . "templates/qiming/laohuangli.php";
        include ROOT_PATH . "templates/qiming/footer.php";
        return true;
    }
    
    if ($action === "search") {
        $keyword = isset($_GET["keyword"]) ? trim($_GET["keyword"]) : "";
        if (!empty($keyword)) {
            if (!check_sensitive_words($keyword)) die("搜索内容包含敏感词");
            $keyword = str_replace(["%", "_"], ["\\%", "\\_"], $keyword);
            save_search_keyword($keyword);
            $articles = get_articles("title LIKE \"%" . $db->real_escape_string($keyword) . "%\"", 50);
        } else {
            $articles = [];
        }
        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 __DIR__ . "/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 __DIR__ . "/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 __DIR__ . "/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;
}

页面列表

配置前端路由后,以下页面均可正常访问:

页面 URL 说明
首页 / 起名主题首页
宝宝起名 /qiming.html 起名表单及结果页
姓名打分 /dafen.html 姓名综合评分
老黄历 /laohuangli.html 每日黄历查询
全部文章 /list.html 文章列表
文章分类 /category-{id}.html 分类文章列表
文章详情 /article-{id}.html 文章内容详情

配置 API

宝宝起名依赖「逗号API」接口宝宝起名:https://api.douhao.com/jie/55.html
每次调用将消耗10积分(注册有赠送50积分),中级代理就可以免费调用

代理权益列表:https://api.douhao.com/daili 。

也可以 充值积分 还可以 推广获积分

获取 API 密钥

  1. 访问 逗号API网站 注册账号
  2. 登录逗号API后台首页,进入「API密钥管理」
  3. 复制 API 密钥

配置 API 密钥

  1. 后台 → 系统管理 → 网站设置
  2. 在「逗号API密钥」输入框粘贴密钥
  3. 保存设置

接口参数一览

API接口api_idAPI接口网址
宝宝起名:55https://api.douhao.com/jie/55.html
姓名打分:22https://api.douhao.com/jie/22.html
老黄历日历详情16https://api.douhao.com/jie/16.html
如积分不足,请前往逗号API网站充值。账户积分与文章生成价格可在「AI自动撰文」页面查看。

更新日志

V1.1 新增搜索标签功能 2026-10-01
1、新增搜索标签功能2、新增顶部导航后台化设置功能3、新增对接联盟付费起名(必须在后台网站设置中设置联盟ID),优化部分细节注意:升级此版本逗号CMS必须为V7.0,否则顶部导航会错误。特别提醒:升级后到后台--网站设置--顶部导航设置,本版本更新较大,为全部文件覆盖,所有有改过模板的,请先做好备份!

常见问题

主题截图 1 / 1