├── 插件多语言.md ├── theme ├── 三元运算.md ├── 包含文件.md ├── 原样输出.md ├── 前台模板多语言.md ├── base.md ├── public.md ├── empty标签.md ├── js_components.md ├── tags │ ├── for.md │ ├── nest.md │ ├── php.md │ ├── assign.md │ ├── between.md │ ├── compare.md │ ├── empty.md │ ├── if_else.md │ ├── volist.md │ ├── define.md │ ├── defined.md │ ├── present.md │ ├── switch.md │ ├── foreach.md │ └── tc_include.md ├── base │ ├── operator.md │ ├── var_echo.md │ ├── literal.md │ ├── ternary_operator.md │ ├── use_functions.md │ ├── default_value_echo.md │ ├── constant.md │ ├── comments.md │ ├── include.md │ ├── global_var.md │ ├── multi_lang.md │ ├── assets_import.md │ └── structure.md ├── public │ ├── ad.md │ ├── last_join.md │ ├── like.md │ ├── slide.md │ ├── last_comment.md │ ├── password_reset.md │ ├── forgot_password.md │ ├── favorite.md │ ├── login.md │ ├── guestbook.md │ ├── link.md │ ├── register.md │ ├── nav.md │ └── comment.md ├── js │ ├── js-date.md │ ├── js-datetime.md │ ├── js-ajax-delete.md │ ├── js-ajax-dialog-btn.md │ ├── js-count-btn.md │ ├── js-favorite-btn.md │ └── js-ajax-form.md └── tag.md ├── images ├── README.md ├── j_0008.gif ├── j_0012.gif ├── j_0050.gif ├── 54857e9f9b316.png ├── 54aa90907a9f6.png ├── 54aa91de3ca54.png ├── 54aa9283b5d3a.png ├── 565e8c0ad7253.jpg ├── alipay_qrcode.png ├── 5695949f3e2f1.png.jpg ├── 56959873764f7.png.jpg ├── view_5695911cf31e7.png.jpg ├── 20141209121334548676ee3afc8.png ├── 20141228110052549f7264dacbe.png ├── 20141228110052549f7264daf74.png ├── 031A9AF4-CA48-4FAB-873E-D2735B010D26.png ├── 8BDF3EE2-A11B-4437-ABA6-F65DF9DC46C0.png └── FD2DB1F5-D7E8-4CC4-8003-A003A0480FFE.png ├── model ├── README.md ├── more_help.md ├── instancing.md └── definition.md ├── restful-api.md ├── spchecklang.md ├── view ├── README.md ├── display.md ├── assign.md ├── fetch.md ├── theme_detail.md └── theme.md ├── _book ├── images │ ├── README.md │ ├── j_0008.gif │ ├── j_0012.gif │ ├── j_0050.gif │ ├── 54857e9f9b316.png │ ├── 54aa90907a9f6.png │ ├── 54aa91de3ca54.png │ ├── 54aa9283b5d3a.png │ ├── 565e8c0ad7253.jpg │ ├── alipay_qrcode.png │ ├── 5695949f3e2f1.png.jpg │ ├── 56959873764f7.png.jpg │ ├── view_5695911cf31e7.png.jpg │ ├── 20141209121334548676ee3afc8.png │ ├── 20141228110052549f7264dacbe.png │ ├── 20141228110052549f7264daf74.png │ ├── 031A9AF4-CA48-4FAB-873E-D2735B010D26.png │ ├── 8BDF3EE2-A11B-4437-ABA6-F65DF9DC46C0.png │ └── FD2DB1F5-D7E8-4CC4-8003-A003A0480FFE.png ├── model │ └── README.md ├── spchecklang.md ├── theme │ ├── 三元运算.md │ ├── 前台模板多语言.md │ ├── 包含文件.md │ ├── 原样输出.md │ ├── empty标签.md │ └── base │ │ └── assets_import.md ├── view │ └── README.md ├── portal │ ├── 文章列表相册功能制作.md │ ├── 瀑布流文章列表模板制作.md │ ├── cover.jpg │ ├── template │ │ ├── QQ截图20160411184412.png │ │ ├── QQ截图20160411185412.png │ │ └── wen_zhang_xiang_ce_zhi_zuo.md │ └── functions │ │ └── sp_sql_posts_paged_bykeyword.md ├── 钩子,插件与模板.md ├── base │ ├── backup_restore.md │ └── x_v_difference.md ├── cover.jpg ├── gitbook │ ├── images │ │ ├── favicon.ico │ │ └── apple-touch-icon-precomposed-152.png │ ├── fonts │ │ └── fontawesome │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ └── fontawesome-webfont.woff2 │ ├── gitbook-plugin-ad │ │ ├── plugin.css │ │ └── plugin.js │ ├── gitbook-plugin-tbfed-pagefooter │ │ └── footer.css │ ├── gitbook-plugin-github │ │ └── plugin.js │ ├── gitbook-plugin-editlink │ │ └── plugin.js │ ├── gitbook-plugin-anchors │ │ └── plugin.css │ ├── gitbook-plugin-search │ │ ├── search.css │ │ ├── search-engine.js │ │ └── search.js │ ├── gitbook-plugin-lunr │ │ └── search-lunr.js │ ├── gitbook-plugin-prism │ │ ├── prism-tomorrow.css │ │ ├── prism-okaidia.css │ │ ├── prism-funky.css │ │ ├── prism-dark.css │ │ ├── prism.css │ │ ├── prism-solarizedlight.css │ │ ├── prism-twilight.css │ │ └── prism-coy.css │ └── gitbook-plugin-duoshuo │ │ └── duoshuo.js └── functions │ ├── sp_file_write.md │ ├── sp_is_sae.md │ ├── sp_get_asset_upload_path.md │ └── sp_verifycode_img.md ├── deploy.md ├── foundation.md ├── portal ├── 文章列表相册功能制作.md ├── 瀑布流文章列表模板制作.md ├── base.md ├── functions.md ├── template.md ├── cover.jpg ├── template │ ├── QQ截图20160411184412.png │ ├── QQ截图20160411185412.png │ ├── hot_articles.md │ ├── page.md │ ├── seo.md │ ├── wen_zhang_xiang_ce_zhi_zuo.md │ ├── article.md │ ├── wen_zhang_lie_biao_zhi_ding_gong_neng_zhi_zuo.md │ ├── list.md │ ├── wen_zhang_lie_biao_tui_jian_gong_neng_zhi_zuo.md │ └── get_articles.md ├── functions │ ├── sp_sql_post.md │ ├── sp_sql_page.md │ ├── sp_sql_posts_bycatid.md │ ├── sp_get_term.md │ ├── sp_get_child_terms.md │ ├── sp_get_terms.md │ ├── sp_sql_posts.md │ ├── sp_sql_posts_paged.md │ ├── sp_sql_posts_paged_bycatid.md │ └── sp_sql_posts_paged_bykeyword.md ├── wenzhang_xiang_ce_zhi_zuo_md.md ├── spgetbreadcrumb.md ├── spgetallchildterms.md └── base │ ├── structure.md │ └── theme_structure.md ├── theme.md ├── view.md ├── 钩子,插件与模板.md ├── admin.md ├── advanced.md ├── core_functions.md ├── extends.md ├── model.md ├── portal.md ├── special.md ├── special ├── fileupload.md ├── safe.md ├── cookie.md ├── session.md ├── cache.md ├── pagination.md ├── multi_lang.md └── verifycode.md ├── admin ├── menu.md ├── rbac.md ├── thirdpart_auth.md ├── admin_index_url.md ├── smtp.md └── forgot_admin_pw.md ├── .gitignore ├── base ├── backup_restore.md ├── get_methods.md ├── debug_mode.md ├── environmental_requirement.md ├── x_v_difference.md ├── coding_standards.md └── install.md ├── cover.jpg ├── controller ├── empty_action.md ├── input.md ├── redirect.md ├── ajax_return.md ├── empty_controller.md └── request_type.md ├── deploy ├── url_rewrite.md └── production.md ├── config.md ├── functions ├── sp_param_lable.md ├── sp_password.md ├── sp_auth_encode.md ├── sp_get_current_user.md ├── sp_set_dynamic_config.md ├── sp_is_user_login.md ├── sp_auth_code.md ├── sp_get_plugin_config.md ├── sp_random_string.md ├── sp_file_write.md ├── sp_get_host.md ├── sp_get_current_userid.md ├── sp_clear_cache.md ├── sp_update_current_user.md ├── sp_get_current_admin_id.md ├── sp_get_plugin_class.md ├── sp_is_sae.md ├── sp_get_asset_upload_path.md ├── sp_get_cmf_settings.md ├── sp_get_theme_path.md ├── sp_get_favorite_key.md ├── sp_get_comments.md ├── sp_getcontent_imgs.md ├── sp_get_relative_url.md ├── sp_check_verify_code.md ├── sp_scan_dir.md ├── sp_content_page.md ├── sp_send_email.md ├── sp_plugin_url.md ├── sp_getad.md ├── sp_asset_relative_url.md ├── hook.md ├── sp_get_users.md ├── sp_check_user_action.md ├── comments.md ├── sp_auth_check.md ├── sp_is_mobile.md ├── sp_verifycode_img.md ├── sp_getslide.md ├── leuu.md └── sp_get_menu.md ├── sp_check_lang.md ├── spisweixin.md ├── spgetcurrenttheme.md ├── spgetimagepreviewurl.md ├── spgetuseravatarurl.md ├── plugin.md ├── spsetoption.md ├── spgetimageurl.md ├── spgetassetuploadpath.md ├── spgetfileextension.md ├── spgetfiledownloadurl.md ├── spcheckmobileverifycode.md ├── spcomparepassword.md ├── plugin ├── flow.md ├── controller.md ├── hook.md ├── model.md ├── admin_controller.md ├── class.md └── config.md ├── preface.md ├── bootstrap.md ├── extends ├── base_class.md ├── admin_menu.md ├── thirdpart_lib.md └── application_flow.md ├── app.md ├── README.md ├── lian_jie_shu_ju_ku.md ├── advanced └── qiniu.md ├── url.md ├── book.json └── controller.md /插件多语言.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /theme/三元运算.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /theme/包含文件.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /theme/原样输出.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /model/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /restful-api.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spchecklang.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /theme/前台模板多语言.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /view/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_book/images/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_book/model/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_book/spchecklang.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_book/theme/三元运算.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_book/theme/前台模板多语言.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_book/theme/包含文件.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_book/theme/原样输出.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_book/view/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /deploy.md: -------------------------------------------------------------------------------- 1 | # 部署 2 | 3 | -------------------------------------------------------------------------------- /foundation.md: -------------------------------------------------------------------------------- 1 | # 基础 2 | -------------------------------------------------------------------------------- /portal/文章列表相册功能制作.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /portal/瀑布流文章列表模板制作.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /theme.md: -------------------------------------------------------------------------------- 1 | # 模板 2 | 3 | -------------------------------------------------------------------------------- /view.md: -------------------------------------------------------------------------------- 1 | # 视图 2 | 3 | -------------------------------------------------------------------------------- /钩子,插件与模板.md: -------------------------------------------------------------------------------- 1 | #钩子,插件与模板 -------------------------------------------------------------------------------- /_book/portal/文章列表相册功能制作.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_book/portal/瀑布流文章列表模板制作.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_book/钩子,插件与模板.md: -------------------------------------------------------------------------------- 1 | #钩子,插件与模板 -------------------------------------------------------------------------------- /admin.md: -------------------------------------------------------------------------------- 1 | # 后台管理 2 | 3 | -------------------------------------------------------------------------------- /advanced.md: -------------------------------------------------------------------------------- 1 | # 进阶 2 | 3 | -------------------------------------------------------------------------------- /core_functions.md: -------------------------------------------------------------------------------- 1 | # 系统函数 2 | -------------------------------------------------------------------------------- /extends.md: -------------------------------------------------------------------------------- 1 | # 系统扩展 2 | 3 | -------------------------------------------------------------------------------- /model.md: -------------------------------------------------------------------------------- 1 | # 模型 2 | 3 | 模型定义 -------------------------------------------------------------------------------- /portal.md: -------------------------------------------------------------------------------- 1 | # 门户应用 2 | 3 | -------------------------------------------------------------------------------- /portal/base.md: -------------------------------------------------------------------------------- 1 | # 基础 2 | 3 | -------------------------------------------------------------------------------- /special.md: -------------------------------------------------------------------------------- 1 | # 专题 2 | 3 | -------------------------------------------------------------------------------- /special/fileupload.md: -------------------------------------------------------------------------------- 1 | # 文件上传 -------------------------------------------------------------------------------- /theme/base.md: -------------------------------------------------------------------------------- 1 | # 基础 2 | 3 | -------------------------------------------------------------------------------- /admin/menu.md: -------------------------------------------------------------------------------- 1 | # 后台菜单管理 2 | 3 | -------------------------------------------------------------------------------- /admin/rbac.md: -------------------------------------------------------------------------------- 1 | # 管理员权限管理 2 | 3 | -------------------------------------------------------------------------------- /theme/public.md: -------------------------------------------------------------------------------- 1 | # 公共模板 2 | 3 | -------------------------------------------------------------------------------- /portal/functions.md: -------------------------------------------------------------------------------- 1 | # 函数库 2 | 3 | -------------------------------------------------------------------------------- /portal/template.md: -------------------------------------------------------------------------------- 1 | # 门户模板制作 2 | 3 | -------------------------------------------------------------------------------- /theme/empty标签.md: -------------------------------------------------------------------------------- 1 | # Empty标签 2 | 3 | -------------------------------------------------------------------------------- /theme/js_components.md: -------------------------------------------------------------------------------- 1 | # 前端组件 2 | 3 | -------------------------------------------------------------------------------- /_book/theme/empty标签.md: -------------------------------------------------------------------------------- 1 | # Empty标签 2 | 3 | -------------------------------------------------------------------------------- /admin/thirdpart_auth.md: -------------------------------------------------------------------------------- 1 | # 第三方登录配置 2 | 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | _book 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /base/backup_restore.md: -------------------------------------------------------------------------------- 1 | # 备份与恢复 2 | 3 | 后台->扩展工具->备份管理 -------------------------------------------------------------------------------- /_book/base/backup_restore.md: -------------------------------------------------------------------------------- 1 | # 备份与恢复 2 | 3 | 后台->扩展工具->备份管理 -------------------------------------------------------------------------------- /cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/cover.jpg -------------------------------------------------------------------------------- /special/safe.md: -------------------------------------------------------------------------------- 1 | # 安全 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1840 -------------------------------------------------------------------------------- /_book/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/cover.jpg -------------------------------------------------------------------------------- /theme/tags/for.md: -------------------------------------------------------------------------------- 1 | # for 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1807 -------------------------------------------------------------------------------- /theme/tags/nest.md: -------------------------------------------------------------------------------- 1 | # 标签嵌套 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1817 -------------------------------------------------------------------------------- /theme/tags/php.md: -------------------------------------------------------------------------------- 1 | # php 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1819 -------------------------------------------------------------------------------- /controller/empty_action.md: -------------------------------------------------------------------------------- 1 | # 空操作 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1723 -------------------------------------------------------------------------------- /controller/input.md: -------------------------------------------------------------------------------- 1 | # 输入变量 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1721 4 | -------------------------------------------------------------------------------- /deploy/url_rewrite.md: -------------------------------------------------------------------------------- 1 | # URL重写 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1866 -------------------------------------------------------------------------------- /images/j_0008.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/j_0008.gif -------------------------------------------------------------------------------- /images/j_0012.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/j_0012.gif -------------------------------------------------------------------------------- /images/j_0050.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/j_0050.gif -------------------------------------------------------------------------------- /portal/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/portal/cover.jpg -------------------------------------------------------------------------------- /theme/base/operator.md: -------------------------------------------------------------------------------- 1 | # 使用运算符 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1798 -------------------------------------------------------------------------------- /theme/base/var_echo.md: -------------------------------------------------------------------------------- 1 | # 变量输出 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1794 -------------------------------------------------------------------------------- /theme/tags/assign.md: -------------------------------------------------------------------------------- 1 | # Assign标签 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1815 -------------------------------------------------------------------------------- /theme/tags/between.md: -------------------------------------------------------------------------------- 1 | # 范围判断标签 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1810 -------------------------------------------------------------------------------- /theme/tags/compare.md: -------------------------------------------------------------------------------- 1 | # 比较标签 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1809 -------------------------------------------------------------------------------- /theme/tags/empty.md: -------------------------------------------------------------------------------- 1 | # Empty标签 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1813 -------------------------------------------------------------------------------- /theme/tags/if_else.md: -------------------------------------------------------------------------------- 1 | # if else 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1811 -------------------------------------------------------------------------------- /theme/tags/volist.md: -------------------------------------------------------------------------------- 1 | # volist 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1805 -------------------------------------------------------------------------------- /controller/redirect.md: -------------------------------------------------------------------------------- 1 | # 跳转和重定向 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1720 4 | -------------------------------------------------------------------------------- /theme/base/literal.md: -------------------------------------------------------------------------------- 1 | # 原样输出 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1820 4 | -------------------------------------------------------------------------------- /theme/base/ternary_operator.md: -------------------------------------------------------------------------------- 1 | # 三元运算 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1802 -------------------------------------------------------------------------------- /theme/base/use_functions.md: -------------------------------------------------------------------------------- 1 | # 使用函数 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1796 -------------------------------------------------------------------------------- /theme/tags/define.md: -------------------------------------------------------------------------------- 1 | # Define标签 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1816 4 | -------------------------------------------------------------------------------- /theme/tags/defined.md: -------------------------------------------------------------------------------- 1 | # Defined标签 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1814 -------------------------------------------------------------------------------- /theme/tags/present.md: -------------------------------------------------------------------------------- 1 | # Present标签 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1812 -------------------------------------------------------------------------------- /_book/portal/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/portal/cover.jpg -------------------------------------------------------------------------------- /controller/ajax_return.md: -------------------------------------------------------------------------------- 1 | # AJAX返回 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1719 4 | -------------------------------------------------------------------------------- /controller/empty_controller.md: -------------------------------------------------------------------------------- 1 | # 空控制器 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1724 4 | -------------------------------------------------------------------------------- /controller/request_type.md: -------------------------------------------------------------------------------- 1 | # 请求类型 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1722 4 | -------------------------------------------------------------------------------- /special/cookie.md: -------------------------------------------------------------------------------- 1 | # Cookie支持 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1873 4 | 5 | -------------------------------------------------------------------------------- /special/session.md: -------------------------------------------------------------------------------- 1 | # SESSION支持 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1872 4 | 5 | -------------------------------------------------------------------------------- /theme/base/default_value_echo.md: -------------------------------------------------------------------------------- 1 | # 默认值输出 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1797 -------------------------------------------------------------------------------- /theme/tags/switch.md: -------------------------------------------------------------------------------- 1 | # switch 2 | 3 | 请参考:http://www.kancloud.cn/manual/thinkphp/1808 4 | 5 | -------------------------------------------------------------------------------- /_book/images/j_0008.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/j_0008.gif -------------------------------------------------------------------------------- /_book/images/j_0012.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/j_0012.gif -------------------------------------------------------------------------------- /_book/images/j_0050.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/j_0050.gif -------------------------------------------------------------------------------- /images/54857e9f9b316.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/54857e9f9b316.png -------------------------------------------------------------------------------- /images/54aa90907a9f6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/54aa90907a9f6.png -------------------------------------------------------------------------------- /images/54aa91de3ca54.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/54aa91de3ca54.png -------------------------------------------------------------------------------- /images/54aa9283b5d3a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/54aa9283b5d3a.png -------------------------------------------------------------------------------- /images/565e8c0ad7253.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/565e8c0ad7253.jpg -------------------------------------------------------------------------------- /images/alipay_qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/alipay_qrcode.png -------------------------------------------------------------------------------- /_book/images/54857e9f9b316.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/54857e9f9b316.png -------------------------------------------------------------------------------- /_book/images/54aa90907a9f6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/54aa90907a9f6.png -------------------------------------------------------------------------------- /_book/images/54aa91de3ca54.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/54aa91de3ca54.png -------------------------------------------------------------------------------- /_book/images/54aa9283b5d3a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/54aa9283b5d3a.png -------------------------------------------------------------------------------- /_book/images/565e8c0ad7253.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/565e8c0ad7253.jpg -------------------------------------------------------------------------------- /_book/images/alipay_qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/alipay_qrcode.png -------------------------------------------------------------------------------- /images/5695949f3e2f1.png.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/5695949f3e2f1.png.jpg -------------------------------------------------------------------------------- /images/56959873764f7.png.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/56959873764f7.png.jpg -------------------------------------------------------------------------------- /_book/gitbook/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/gitbook/images/favicon.ico -------------------------------------------------------------------------------- /_book/images/5695949f3e2f1.png.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/5695949f3e2f1.png.jpg -------------------------------------------------------------------------------- /_book/images/56959873764f7.png.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/56959873764f7.png.jpg -------------------------------------------------------------------------------- /config.md: -------------------------------------------------------------------------------- 1 | # 配置 2 | 3 | ThinkPHP支持多种配置格式,ThinkCMF默认使用php数组的形式,其它使用方式请参考: 4 | http://www.kancloud.cn/manual/thinkphp/1678 -------------------------------------------------------------------------------- /images/view_5695911cf31e7.png.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/view_5695911cf31e7.png.jpg -------------------------------------------------------------------------------- /model/more_help.md: -------------------------------------------------------------------------------- 1 | # 更多模型 2 | 3 | ThinkCMF支持所有ThinkPHP模型用法,其它使用方式请参考: 4 | http://www.kancloud.cn/manual/thinkphp/1727 5 | -------------------------------------------------------------------------------- /special/cache.md: -------------------------------------------------------------------------------- 1 | # 缓存 2 | 3 | ThinkPHP支持多种缓存方式,ThinkCMF同样适用,详细方式请参考: 4 | http://www.kancloud.cn/manual/thinkphp/1834 5 | -------------------------------------------------------------------------------- /_book/images/view_5695911cf31e7.png.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/view_5695911cf31e7.png.jpg -------------------------------------------------------------------------------- /images/20141209121334548676ee3afc8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/20141209121334548676ee3afc8.png -------------------------------------------------------------------------------- /images/20141228110052549f7264dacbe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/20141228110052549f7264dacbe.png -------------------------------------------------------------------------------- /images/20141228110052549f7264daf74.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/20141228110052549f7264daf74.png -------------------------------------------------------------------------------- /portal/template/QQ截图20160411184412.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/portal/template/QQ截图20160411184412.png -------------------------------------------------------------------------------- /portal/template/QQ截图20160411185412.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/portal/template/QQ截图20160411185412.png -------------------------------------------------------------------------------- /_book/images/20141209121334548676ee3afc8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/20141209121334548676ee3afc8.png -------------------------------------------------------------------------------- /_book/images/20141228110052549f7264dacbe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/20141228110052549f7264dacbe.png -------------------------------------------------------------------------------- /_book/images/20141228110052549f7264daf74.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/20141228110052549f7264daf74.png -------------------------------------------------------------------------------- /_book/portal/template/QQ截图20160411184412.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/portal/template/QQ截图20160411184412.png -------------------------------------------------------------------------------- /_book/portal/template/QQ截图20160411185412.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/portal/template/QQ截图20160411185412.png -------------------------------------------------------------------------------- /_book/gitbook/fonts/fontawesome/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/gitbook/fonts/fontawesome/FontAwesome.otf -------------------------------------------------------------------------------- /functions/sp_param_lable.md: -------------------------------------------------------------------------------- 1 | # sp_param_lable() 2 | ```php 3 | 7 | ``` -------------------------------------------------------------------------------- /images/031A9AF4-CA48-4FAB-873E-D2735B010D26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/031A9AF4-CA48-4FAB-873E-D2735B010D26.png -------------------------------------------------------------------------------- /images/8BDF3EE2-A11B-4437-ABA6-F65DF9DC46C0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/8BDF3EE2-A11B-4437-ABA6-F65DF9DC46C0.png -------------------------------------------------------------------------------- /images/FD2DB1F5-D7E8-4CC4-8003-A003A0480FFE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/images/FD2DB1F5-D7E8-4CC4-8003-A003A0480FFE.png -------------------------------------------------------------------------------- /_book/gitbook/fonts/fontawesome/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/gitbook/fonts/fontawesome/fontawesome-webfont.eot -------------------------------------------------------------------------------- /_book/gitbook/fonts/fontawesome/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/gitbook/fonts/fontawesome/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /_book/images/031A9AF4-CA48-4FAB-873E-D2735B010D26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/031A9AF4-CA48-4FAB-873E-D2735B010D26.png -------------------------------------------------------------------------------- /_book/images/8BDF3EE2-A11B-4437-ABA6-F65DF9DC46C0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/8BDF3EE2-A11B-4437-ABA6-F65DF9DC46C0.png -------------------------------------------------------------------------------- /_book/images/FD2DB1F5-D7E8-4CC4-8003-A003A0480FFE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/images/FD2DB1F5-D7E8-4CC4-8003-A003A0480FFE.png -------------------------------------------------------------------------------- /_book/gitbook/fonts/fontawesome/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/gitbook/fonts/fontawesome/fontawesome-webfont.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/fontawesome/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/gitbook/fonts/fontawesome/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-ad/plugin.css: -------------------------------------------------------------------------------- 1 | .page-inner-top { 2 | margin: 0 15px 30px; 3 | } 4 | 5 | .page-inner-bottom { 6 | margin: 30px 15px 0; 7 | } 8 | -------------------------------------------------------------------------------- /_book/gitbook/images/apple-touch-icon-precomposed-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thinkcmf/cmfx_doc/HEAD/_book/gitbook/images/apple-touch-icon-precomposed-152.png -------------------------------------------------------------------------------- /functions/sp_password.md: -------------------------------------------------------------------------------- 1 | # sp_password() 2 | 3 | ```php 4 | 9 | ``` -------------------------------------------------------------------------------- /functions/sp_auth_encode.md: -------------------------------------------------------------------------------- 1 | # sp_authencode() 2 | 3 | > V1.1.1新增 4 | 5 | ```php 6 | 11 | ``` -------------------------------------------------------------------------------- /deploy/production.md: -------------------------------------------------------------------------------- 1 | # 迁移到正式环境 2 | 3 | 请执行以下步骤: 4 | 5 | 1.debug打开; 6 | 7 | 2.把整个程序打包; 8 | 9 | 3.传到服务器; 10 | 11 | 4.数据库备份到服务器; 12 | 13 | 5.改data/conf/db.php的数据库用户名密码; 14 | 15 | 6.测试; 16 | 17 | 7.debug关闭; -------------------------------------------------------------------------------- /functions/sp_get_current_user.md: -------------------------------------------------------------------------------- 1 | # sp_get_current_user() 2 | 3 | ```php 4 | sp_get_current_user() 5 | ``` 6 | 功能: 7 | 获取当前登录用户信息,包括users表里详细信息; 8 | 9 | 参数: 10 | 无 11 | 12 | 返回: 13 | 数组,用户包括users表里详细信息 -------------------------------------------------------------------------------- /functions/sp_set_dynamic_config.md: -------------------------------------------------------------------------------- 1 | # sp_set_dynamic_config() 2 | 3 | > V1.1.1新增 4 | 5 | ```php 6 | ".html"); 8 | $result=sp_set_dynamic_config($data); 9 | ?> 10 | ``` -------------------------------------------------------------------------------- /functions/sp_is_user_login.md: -------------------------------------------------------------------------------- 1 | # sp_is_user_login() 2 | 3 | X1.0新增 4 | 5 | sp_is_user_login() 6 | 功能: 7 | 8 | 判断用户是否已经登录 9 | 10 | 11 | 12 | 参数: 13 | 14 | 无 15 | 16 | 返回: 17 | 18 | 类型布尔 true/false 19 | 20 | -------------------------------------------------------------------------------- /functions/sp_auth_code.md: -------------------------------------------------------------------------------- 1 | # sp_authcode() 2 | 3 | > V1.1.1新增 4 | 5 | ```php 6 | 11 | ``` 12 | 13 | -------------------------------------------------------------------------------- /functions/sp_get_plugin_config.md: -------------------------------------------------------------------------------- 1 | # sp_get_plugin_config() 2 | > X1.4.0新增 3 | 4 | ```php 5 | sp_get_plugin_config($name) 6 | ``` 7 | 8 | 功能: 9 | 获取插件配置 10 | 11 | 参数: 12 | `$name`:插件名 13 | 14 | 返回: 15 | 类型数组,插件配置信息 -------------------------------------------------------------------------------- /functions/sp_random_string.md: -------------------------------------------------------------------------------- 1 | # sp_random_string() 2 | ```php 3 | 10 | ``` -------------------------------------------------------------------------------- /functions/sp_file_write.md: -------------------------------------------------------------------------------- 1 | # sp_file_write() 2 | 3 | > V1.1.1新增 4 | 5 | ```php 6 | 12 | ``` 13 | -------------------------------------------------------------------------------- /functions/sp_get_host.md: -------------------------------------------------------------------------------- 1 | # sp_get_host() 2 | 3 | > X1.0新增 4 | 5 | ```php 6 | sp_get_host() 7 | ``` 8 | 9 | 功能: 10 | 返回带协议的域名 11 | 12 | 参数: 13 | 无 14 | 15 | 返回: 16 | 类型string 17 | 带协议的域名,如http://www.thinkcmf.com 18 | -------------------------------------------------------------------------------- /_book/functions/sp_file_write.md: -------------------------------------------------------------------------------- 1 | # sp_file_write() 2 | 3 | > V1.1.1新增 4 | 5 | ```php 6 | 12 | ``` 13 | -------------------------------------------------------------------------------- /functions/sp_get_current_userid.md: -------------------------------------------------------------------------------- 1 | # sp_get_current_userid() 2 | 3 | ```php 4 | sp_get_current_userid() 5 | ``` 6 | 7 | 功能: 8 | 获取当前登录用户ID 9 | 10 | 参数: 11 | 无 12 | 13 | 返回: 14 | int,当前登录的用户id,如果未登录返回0 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /theme/public/ad.md: -------------------------------------------------------------------------------- 1 | # 广告位制作 2 | 3 | 在文章底部加一个广告: 4 | 5 | 到后台扩展工具->网站广告->添加广告名称 为'portal_article_bottom'的广告,同时加上广告代码; 6 | 7 | 模板里代码如下: 8 | ```php 9 |
10 | {:sp_getad("portal_article_bottom")} 11 |
12 | ``` 13 | 14 | -------------------------------------------------------------------------------- /theme/js/js-date.md: -------------------------------------------------------------------------------- 1 | # js-date 2 | 3 | 日期选择组件 4 | ```html 5 | 6 | ``` 7 | 8 | 功能: 9 | 10 | 加上js-date类名的text input标签在用户输入时间时,会弹出一个日历让用户选择日期 -------------------------------------------------------------------------------- /functions/sp_clear_cache.md: -------------------------------------------------------------------------------- 1 | # sp_clear_cache() 2 | 3 | ```php 4 | sp_clear_cache() 5 | ``` 6 | ######功能: 7 | 清除缓存 8 | 9 | ######参数: 10 | 无 11 | 12 | ######返回: 13 | 无 14 | 15 | ```php 16 | 19 | ``` -------------------------------------------------------------------------------- /functions/sp_update_current_user.md: -------------------------------------------------------------------------------- 1 | #sp_update_current_user() 2 | > X1.0新增 3 | 4 | ```php 5 | sp_update_current_user($user) 6 | ``` 7 | 8 | 功能: 9 | 更新session里当前登录用户的信息 10 | 11 | 参数: 12 | `$user`:当前登录用户的最新信息 13 | 14 | 返回: 15 | 无 16 | -------------------------------------------------------------------------------- /functions/sp_get_current_admin_id.md: -------------------------------------------------------------------------------- 1 | #sp_get_current_admin_id() 2 | 3 | > X1.4.0新增 4 | 5 | ```php 6 | sp_get_current_admin_id() 7 | ``` 8 | 功能: 9 | 获取当前登录管理员id,同get_current_admin_id() 10 | 11 | 参数: 12 | 无 13 | 14 | 返回: 15 | 类型int,管理员的id -------------------------------------------------------------------------------- /functions/sp_get_plugin_class.md: -------------------------------------------------------------------------------- 1 | # sp_get_plugin_class() 2 | 3 | > X1.4.0新增 4 | 5 | ```php 6 | sp_get_plugin_class($name) 7 | ``` 8 | 功能: 9 | 获取插件类的类名 10 | 11 | 参数: 12 | `$name`:插件类名 13 | 14 | 返回: 15 | 类型string 16 | 如:plugins\Demo\DemoPlugin -------------------------------------------------------------------------------- /functions/sp_is_sae.md: -------------------------------------------------------------------------------- 1 | # sp_is_sae() 2 | 3 | > X1.5.0新增 4 | 5 | ```php 6 | sp_is_sae() 7 | ``` 8 | 9 | 功能: 10 | 判断是否为SAE 11 | 12 | 参数: 13 | 无 14 | 15 | 返回: 16 | 类型boolean true|false 17 | 18 | 使用: 19 | ```php 20 | $is_sae=sp_is_sae(); 21 | ``` -------------------------------------------------------------------------------- /_book/functions/sp_is_sae.md: -------------------------------------------------------------------------------- 1 | # sp_is_sae() 2 | 3 | > X1.5.0新增 4 | 5 | ```php 6 | sp_is_sae() 7 | ``` 8 | 9 | 功能: 10 | 判断是否为SAE 11 | 12 | 参数: 13 | 无 14 | 15 | 返回: 16 | 类型boolean true|false 17 | 18 | 使用: 19 | ```php 20 | $is_sae=sp_is_sae(); 21 | ``` -------------------------------------------------------------------------------- /theme/js/js-datetime.md: -------------------------------------------------------------------------------- 1 | # js-datetime 2 | 3 | 时间选择组件 4 | ```html 5 | 6 | ``` 7 | 8 | 功能: 9 | 10 | 加上js-datetime类名的text input标签在用户输入时间时,会弹出一个日历让用户选择时间 -------------------------------------------------------------------------------- /functions/sp_get_asset_upload_path.md: -------------------------------------------------------------------------------- 1 | #sp_get_asset_upload_path() 2 | > V1.1.1新增 3 | 4 | ```php 5 | 10 | ``` 11 | -------------------------------------------------------------------------------- /_book/functions/sp_get_asset_upload_path.md: -------------------------------------------------------------------------------- 1 | #sp_get_asset_upload_path() 2 | > V1.1.1新增 3 | 4 | ```php 5 | 10 | ``` 11 | -------------------------------------------------------------------------------- /functions/sp_get_cmf_settings.md: -------------------------------------------------------------------------------- 1 | # sp_get_cmf_settings() 2 | > X1.2新增 3 | 4 | ```php 5 | sp_get_cmf_settings($key); 6 | ``` 7 | 功能: 8 | 获取cmf的设置;如果key为空则返回所有设置,如果key不为空,则返回相应key的设置 9 | 10 | 参数: 11 | `$key`:默认为空,设置的key 12 | 13 | 返回: 14 | 如果key为空则返回所有设置,如果key不为空,则返回相应key的设置 -------------------------------------------------------------------------------- /sp_check_lang.md: -------------------------------------------------------------------------------- 1 | # sp\_check\_lang\(\) 2 | 3 | > X2.2.0新增 4 | 5 | ```php 6 | sp_check_lang() 7 | ``` 8 | 9 | 功能: 10 | 判断当前的语言包,并返回语言包名 11 | 12 | 参数: 13 | 无 14 | 15 | 返回: 16 | 类型string 包名,如:zh-cn 17 | 18 | 使用: 19 | 20 | ```php 21 | $lang=sp_check_lang(); 22 | ``` 23 | 24 | -------------------------------------------------------------------------------- /functions/sp_get_theme_path.md: -------------------------------------------------------------------------------- 1 | # sp_get_theme_path() 2 | 3 | > X1.1新增 4 | 5 | ```php 6 | sp_get_theme_path() 7 | ``` 8 | 9 | ######功能: 10 | 获取当前模板的地址 11 | 12 | ######参数: 13 | 无 14 | 15 | ######返回: 16 | 类型string 17 | 18 | 当前模板的地址,如当前模板是`simplebootx`,则返回`/themes/simplebootx/` 19 | -------------------------------------------------------------------------------- /portal/functions/sp_sql_post.md: -------------------------------------------------------------------------------- 1 | # sp_sql_post() 2 | 3 | 示例: 4 | ```php 5 | X1.0新增 4 | 5 | ```php 6 | sp_get_favorite_key($table,$object_id) 7 | ``` 8 | 9 | 功能: 10 | 用于生成收藏内容用的安全key,收藏时必用 11 | 12 | 参数: 13 | `$table`:收藏内容所在表,不带表前缀 14 | `$object_id`:收藏内容的id 15 | 16 | 返回: 17 | 类型string,收藏内容用的安全key -------------------------------------------------------------------------------- /spisweixin.md: -------------------------------------------------------------------------------- 1 | # sp_is_weixin() 2 | 3 | > X2.2.0新增 4 | 5 | ```php 6 | sp_is_weixin() 7 | ``` 8 | 9 | ###### 功能: 10 | 判断是否为微信访问 11 | 12 | ###### 参数: 13 | 无 14 | 15 | ###### 返回: 16 | 类型boolean,true为微信访问 17 | 18 | ###### 使用: 19 | ```php 20 | $is_weixin = sp_is_weixin(); 21 | ``` 22 | 23 | 24 | -------------------------------------------------------------------------------- /functions/sp_get_comments.md: -------------------------------------------------------------------------------- 1 | # sp_get_comments() 2 | 3 | > X1.2新增 4 | 5 | ```php 6 | sp_get_comments($tag,$where); 7 | ``` 8 | 功能: 9 | 获取评论; 10 | 11 | 参数: 12 | `$tag`:查询标签,默认:field:\*;limit:0,5;order:createtime desc; 13 | `$where`:查询where数组,按照thinkphp where array格式; 14 | 15 | 返回: 16 | 数组,评论 -------------------------------------------------------------------------------- /functions/sp_getcontent_imgs.md: -------------------------------------------------------------------------------- 1 | # sp_getcontent_imgs() 2 | 3 | 示例: 4 | 5 | ```php 6 | 11 | ``` 12 | 13 | 返回字段说明: 14 | `title`:图片的title属性 15 | `alt`:图片的alt属性 16 | `src`:图片的资源路径 -------------------------------------------------------------------------------- /portal/functions/sp_sql_page.md: -------------------------------------------------------------------------------- 1 | # sp_sql_page() 2 | ```php 3 | sp_sql_page($id) 4 | ``` 5 | 6 | 功能: 7 | 获取指定id的页面 8 | 9 | 参数: 10 | `$id`:页面的id 11 | 12 | 返回: 13 | 类型数组,符合条件的页面 14 | 15 | 示例: 16 | ```php 17 | 官方网站 :[http://www.thinkcmf.com](http://www.thinkcmf.com)可获取最新版本 6 | > git@osc :[http://git.oschina.net/thinkcmf/ThinkCMFX](http://git.oschina.net/thinkcmf/ThinkCMFX) 7 | > github :[https://github.com/thinkcmf/cmfx](https://github.com/thinkcmf/cmfx) 8 | 9 | -------------------------------------------------------------------------------- /theme/js/js-ajax-delete.md: -------------------------------------------------------------------------------- 1 | # js-ajax-delete 2 | 3 | ajax 删除组件 4 | ```html 5 | 删除 6 | ``` 7 | 8 | 功能: 9 | 10 | 加上js-ajax-delete类名的a标签在单击后,会出现一个对话框,提示用户一些信息(信息内容为data-msg的属性值),用户确定后会进行一个 ajax 请求,请求的 url为 11 | 12 | href 属性的值,请求成功返回后,会刷新当前界面。 13 | 14 | -------------------------------------------------------------------------------- /theme/js/js-ajax-dialog-btn.md: -------------------------------------------------------------------------------- 1 | # js-ajax-dialog-btn 2 | 3 | ajax 对话框组件 4 | ```html 5 | 还原 6 | ``` 7 | 8 | 功能: 9 | 加上js-ajax-dialog-btn类名的a标签在单击后,会出现一个对话框,提示用户一些信息(信息内容为data-msg的属性值),用户确定后会进行一个 ajax 请求,请求的 url为 10 | 11 | href 属性的值,请求成功返回后,会刷新当前界面。 -------------------------------------------------------------------------------- /base/debug_mode.md: -------------------------------------------------------------------------------- 1 | # 调试模式 2 | 3 | ThinkCMF调试模式的开关在程序根目录index.php文件里 4 | ![ThinkCMFX调试模式](../images/20141228110052549f7264dacbe.png) 5 | 6 | APP_DEBUG默认是开启的,方便开发者调试; 7 | 开发完成可以改成false,关闭调试模式,进入生产环境! 8 | 9 | 调试模式下会有如下的图标: 10 | ![QQ截图20141228110026.png](../images/20141228110052549f7264daf74.png) 11 | 关闭调试模式后它就会消失! -------------------------------------------------------------------------------- /portal/wenzhang_xiang_ce_zhi_zuo_md.md: -------------------------------------------------------------------------------- 1 | # 文章相册制作 2 | 3 | ```php 4 | $smeta=json_decode($vo['smeta'], true); 5 |
6 | < 7 | 8 | 9 |
10 | 作者:小夏 11 | 12 | ``` -------------------------------------------------------------------------------- /functions/sp_get_relative_url.md: -------------------------------------------------------------------------------- 1 | # sp_get_relative_url() 2 | 3 | > X1.0新增 4 | 5 | ```php 6 | sp_get_relative_url($url) 7 | ``` 8 | 功能: 9 | 获取域名后的地址,如http://thinkcmf.com/news.html,转化后为/news.html 10 | 11 | 参数: 12 | `$url`:要转化的url 13 | 14 | 返回: 15 | 类型string; 16 | 域名后的地址,如http://thinkcmf.com/news.html,转化后为/news.html 17 | 18 | -------------------------------------------------------------------------------- /portal/spgetbreadcrumb.md: -------------------------------------------------------------------------------- 1 | # sp_get_breadcrumb() 2 | 3 | > X2.2.0新增 4 | 5 | ```php 6 | sp_get_breadcrumb($term_id) 7 | ``` 8 | 9 | ###### 功能: 10 | 获取面包屑数据 11 | 12 | ###### 参数: 13 | `$term_id`: 当前文章所在分类id,或者当前分类的id 14 | 15 | ###### 返回: 16 | 类型array,面包屑数据 17 | 18 | ###### 使用: 19 | ```php 20 | $breadcrumb = sp_get_breadcrumb(3); 21 | ``` -------------------------------------------------------------------------------- /theme/base/constant.md: -------------------------------------------------------------------------------- 1 | # 模板常量 2 | 3 | `__ROOT__`: 4 | 网站根目录,不带/; 5 | 6 | `__WEB_ROOT__`: 7 | 网站资源根目录,不带/,如果以前版本用`__ROOT__`来定位网站资源,x2.2.0以后最好用这个常量,方便以后cdn切换 8 | 9 | `__TMPL__`: 10 | 当前模板根目录,带/; 11 | 如:前台 simplebootx 模板根目录是/themes/simplebootx/ 12 | 后台 simplebootx模板根目录是/admin/themes/simplebootx/ 13 | 14 | `__PUBLIC__`: 15 | public目录,不带/; -------------------------------------------------------------------------------- /theme/js/js-count-btn.md: -------------------------------------------------------------------------------- 1 | # js-count-btn 2 | 3 | 前台数量操作组件 4 | 5 | ```html 6 | 7 | 8 | 0 9 | 10 | ``` 11 | 12 | 功能: 13 | 加上js-count-btn类名的a标签为可以实现数量增加的 ajax操作;ajax执行成功返回后对其内类名包含count的标签进行数量加1操作; 14 | ajax 请求的 url 为 a标签的 href 属性; -------------------------------------------------------------------------------- /theme/tags/foreach.md: -------------------------------------------------------------------------------- 1 | # foreach 2 | 3 | foreach标签 4 | 5 | 属性 6 | `name`:表示数据源; 7 | `item`:表示循环变量; 8 | 9 | ```html 10 | 11 | {$vo.name} {$key} 12 | 13 | ``` 14 | 15 | 更改属性key的变量名: 16 | ```html 17 | 18 | {$vo.name} {$k} 19 | 20 | ``` 21 | -------------------------------------------------------------------------------- /spgetcurrenttheme.md: -------------------------------------------------------------------------------- 1 | # sp_get_current_theme() 2 | 3 | > X2.2.0新增 4 | 5 | ```php 6 | sp_get_current_theme($default_theme='') 7 | 8 | ``` 9 | 10 | ###### 功能: 11 | 获取当前主题名 12 | 13 | ###### 参数: 14 | `$default_theme`: 指定的默认主题 15 | 16 | ###### 返回: 17 | 类型string,主题名 18 | 19 | ###### 使用: 20 | ```php 21 | $theme = sp_get_current_theme(); 22 | ``` 23 | -------------------------------------------------------------------------------- /portal/spgetallchildterms.md: -------------------------------------------------------------------------------- 1 | # sp_get_all_child_terms() 2 | 3 | > X2.2.0新增 4 | 5 | ```php 6 | sp_get_all_child_terms($term_id) 7 | ``` 8 | 9 | ###### 功能: 10 | 指定分类下的所有子分类 11 | 12 | ###### 参数: 13 | `$term_id`: 分类id 14 | 15 | ###### 返回: 16 | 类型array,指定分类下的所有子分类 17 | 18 | ###### 使用: 19 | ```php 20 | $terms = sp_get_all_child_terms(1); 21 | ``` 22 | 23 | 24 | -------------------------------------------------------------------------------- /theme/base/comments.md: -------------------------------------------------------------------------------- 1 | # 模板注释 2 | js注释: 3 | 4 | ```html 5 | 8 | ``` 9 | 10 | css注释 11 | 12 | ```html 13 | 16 | ``` 17 | 18 | html注释 19 | ```html 20 |
21 | 22 |
23 | ``` 24 | 25 | php标签里的注释 26 | ```html 27 | 28 | /*一定要用这个方法,用//会在debug关时出问题*/ 29 | 30 | ``` 31 | -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-tbfed-pagefooter/footer.css: -------------------------------------------------------------------------------- 1 | .page-footer { 2 | margin-top: 50px; 3 | border-top: 1px solid #ccc; 4 | overflow: hidden; 5 | padding: 10px 0; 6 | font-size: 12px; 7 | color: #808080; 8 | } 9 | .page-footer a { 10 | color: #808080!important; 11 | text-decoration: underline!important; 12 | } 13 | .footer-modification { 14 | float: right; 15 | } 16 | -------------------------------------------------------------------------------- /functions/sp_check_verify_code.md: -------------------------------------------------------------------------------- 1 | # sp_check_verify_code() 2 | 3 | > X1.6.0新增 4 | 5 | ```php 6 | sp_check_verify_code() 7 | ``` 8 | 9 | 功能: 10 | 验证码检查,验证完后销毁验证码增加安全性 11 | 12 | 参数: 13 | 无 14 | 15 | 返回: 16 | 类型boolean true|false; 17 | 18 | 使用: 19 | ```php 20 | 注:表单提交时验证码name为verify;支持POST和GET方法 -------------------------------------------------------------------------------- /functions/sp_scan_dir.md: -------------------------------------------------------------------------------- 1 | # sp_scan_dir() 2 | 3 | > X1.4.0新增 4 | 5 | ```php 6 | sp_scan_dir($pattern,$flags) 7 | ``` 8 | 功能: 9 | 替代scan_dir的方法 10 | 11 | 参数: 12 | `$pattern`:检索模式 搜索模式 *.txt,*.doc; (同glog方法) 13 | `$flags`:返回模式 同glog方法 14 | 15 | 返回: 16 | 类型数组 17 | 18 | 使用方法: 19 | 20 | ```php 21 | //扫描application目录 22 | $files=sp_scan_dir('application/*');//返回application目录下所有文件 23 | ``` -------------------------------------------------------------------------------- /spgetimagepreviewurl.md: -------------------------------------------------------------------------------- 1 | # sp_get_image_preview_url() 2 | 3 | > X2.2.0新增 4 | 5 | ```php 6 | sp_get_image_preview_url($file,$style='watermark') 7 | ``` 8 | 9 | ###### 功能: 10 | 获取图片预览链接 11 | 12 | ###### 参数: 13 | `$file`: 数据库中保存的文件名 14 | `$style`:样式(七牛) 15 | 16 | ###### 返回: 17 | 类型string,图片预览链接 18 | 19 | ###### 使用: 20 | ```php 21 | $url = sp_get_image_preview_url('portal/23232.png'); 22 | ``` 23 | -------------------------------------------------------------------------------- /spgetuseravatarurl.md: -------------------------------------------------------------------------------- 1 | # sp_get_user_avatar_url() 2 | 3 | > X2.2.0新增 4 | 5 | ```php 6 | sp_get_user_avatar_url($avatar) 7 | ``` 8 | 9 | ###### 功能: 10 | 获取用户头像地址 11 | 12 | ###### 参数: 13 | `$avatar`: 数据库中保存的用户头像文件路径 14 | 15 | ###### 返回: 16 | 类型string,用户头像地址 17 | 18 | 19 | ###### 使用: 20 | ```php 21 | $url = sp_get_user_avatar_url('avatart/2231rweqrqwer.png'); 22 | echo $url;//输出用户头像地址 23 | ``` 24 | -------------------------------------------------------------------------------- /plugin.md: -------------------------------------------------------------------------------- 1 | # 插件 2 | 3 | 插件是用于实现简单的显示及数据处理的功能扩展。插件是可以开启关闭的,但不会影响原有系统的代码; 4 | 5 | 插件结构: 6 | 7 | 插件结构图 8 | 9 | ![](images/54aa90907a9f6.png) 10 | 11 | 12 | 以Demo插件为例: 13 | 14 | Controller //控制器目录 15 | 16 | Model //插件自定义模型目录 17 | View //模板目录,可以配置多个主题 18 | config.php //模板配置文件 19 | 20 | DemoPlugin.class.php 插件主文件,格式为:插件名+Plugin.class.php 21 | 22 | README.txt 说明文件 23 | 24 | lisense.txt 授权协议文件 25 | 26 | -------------------------------------------------------------------------------- /spsetoption.md: -------------------------------------------------------------------------------- 1 | # sp_set_option() 2 | 3 | > X2.2.0新增 4 | 5 | ```php 6 | sp_set_option($key,$data) 7 | ``` 8 | 9 | ###### 功能: 10 | 设置系统配置,通用 11 | 12 | ###### 参数: 13 | `$key`: 配置的键名,英文下划线小写,最好加上自己的应用或插件名作为前级 14 | `$data`:配置的值,数组 15 | 16 | ###### 返回: 17 | 类型boolean,true设置成功 18 | 19 | ###### 使用: 20 | ```php 21 | $result = sp_set_option('portal_custom_settings',array('test'=>1)); 22 | 23 | ``` 24 | 25 | 26 | -------------------------------------------------------------------------------- /spgetimageurl.md: -------------------------------------------------------------------------------- 1 | # sp_get_image_url() 2 | 3 | 4 | > X2.2.0新增 5 | 6 | ```php 7 | sp_get_image_url($file,$style='') 8 | ``` 9 | 10 | ###### 功能: 11 | 转化数据库保存图片的文件路径,为可以访问的url 12 | 13 | ###### 参数: 14 | `$file`: 数据库中保存的文件名 15 | 16 | `$style`:样式(七牛) 17 | 18 | 19 | ###### 返回: 20 | 类型string,图片可以访问的url 21 | 22 | 23 | ###### 使用: 24 | ```php 25 | $url = sp_get_image_url('portal/23232.png'); 26 | ``` 27 | 28 | 29 | -------------------------------------------------------------------------------- /functions/sp_content_page.md: -------------------------------------------------------------------------------- 1 | # sp_content_page() 2 | 3 | > X1.0新增 4 | 5 | ```php 6 | sp_content_page($content,$pagetpl') 7 | ``` 8 | 功能: 9 | 对文本内容进行分页处理,返回当前页的内容,和分页html 10 | 11 | 参数: 12 | `$content`:要处理的文本内容;里面含有百度编辑器的分页标记; 13 | `$pagetpl`:分页模板;默认值{first}{prev}{list}{next}{last} 14 | 15 | 返回: 16 | 类型数组 17 | ```php 18 | array( 19 | "content"=>"",//当前页内容 20 | "page"=>""产生的分页html 21 | ); 22 | ``` 23 | -------------------------------------------------------------------------------- /theme/tags/tc_include.md: -------------------------------------------------------------------------------- 1 | # tc_include 2 | 3 | tc_include是前台模板包含文件的方法,用于替换原来的include的标签,实现更多功能 4 | 5 | 用法: 6 | ```html 7 | 8 | 9 | 10 | 11 | ``` -------------------------------------------------------------------------------- /base/environmental_requirement.md: -------------------------------------------------------------------------------- 1 | # 环境要求 2 | 3 | ThinkCMFX可以支持Windows/Unix服务器环境,需要PHP5.3.0以上版本支持, 可运行于包括Apache、IIS和nginx在内的多种WEB服务器和模式,支持Mysql、 MsSQL、PgSQL、Sqlite、Oracle、Ibase、Mongo以及PDO等多种数据库和连接,推荐LAMP构架。框架本身没有什么特别模块要求,具体的应用系统运行环境要求视开发所涉及的模块。 ThinkCMF底层运行的内存消耗极低,而本身的文件大小也是轻量级的,因此不会出现 空间和内存占用的瓶颈。对于刚刚接触PHP或者ThinkCMF的新手,我们推荐使用集成开发 环境WAMPServer(wampserver是一个集成了Apache、PHP和MySQL的开发 套件,而且支持不同PHP版本、MySQL版本和Apache版本的切换)来使用ThinkCMF 进行本地开发和测试。 -------------------------------------------------------------------------------- /functions/sp_send_email.md: -------------------------------------------------------------------------------- 1 | # sp_send_email() 2 | > X1.0新增 3 | 4 | ```php 5 | sp_send_email($address,$subject,$message) 6 | ``` 7 | 8 | 功能: 9 | 发送邮件 10 | 11 | 参数: 12 | `$address`:收件人地址 13 | `$subject`:邮件主题 14 | `$message`:邮件内容 15 | 16 | 返回: 17 | 类型数组,发送状态和信息 18 | 19 | ```php 20 | array( 21 | "error"=>"1",//有错误 22 | "message"=>""错误信息 23 | ); 24 | array( 25 | "error"=>"0",//成功发送,无错误 26 | ); 27 | ``` -------------------------------------------------------------------------------- /spgetassetuploadpath.md: -------------------------------------------------------------------------------- 1 | # sp_get_asset_upload_path() 2 | 3 | > X1.6.0新增 4 | 5 | ```php 6 | sp_get_asset_upload_path($file,$style='') 7 | ``` 8 | 9 | ###### 功能: 10 | 转化数据库保存的文件路径,为可以访问的url 11 | 12 | ###### 参数: 13 | `$file`: 数据库保存的文件路径 14 | `$style`:样式(七牛) 15 | 16 | ###### 返回: 17 | 类型string,文件可以访问的url 18 | 19 | 20 | ###### 使用: 21 | ```php 22 | $url = sp_get_asset_upload_path('portal/23232.png'); 23 | ``` 24 | 25 | 26 | -------------------------------------------------------------------------------- /admin/admin_index_url.md: -------------------------------------------------------------------------------- 1 | # 后台地址是啥? 2 | 后台地址是啥? 3 | 4 | 1.thinkcmf 默认后台地址是/admin 5 | 6 | 2.如果在后台开启后台地址加密码的功能,那地址就是/?g=admin&upw=系统为你生成的加密码 7 | ![](../images/j_0012.gif) 8 | ![](../images/j_0008.gif) 9 | 10 | 后台地址加密码开启了,但我没有记呀? 11 | 12 | 没办法其实 Dean 也无能为力呀! 13 | 14 | 好吧...我太好了 15 | 16 | 1.打开 data/conf/config.php文件,记得别用 windows 的记事本打开 17 | 18 | 2.找到SP_SITE_ADMIN_URL_PASSWORD,复制它的值 19 | 20 | 3.访问/?g=admin&upw={你第二步得到的值} 21 | -------------------------------------------------------------------------------- /theme/base/include.md: -------------------------------------------------------------------------------- 1 | # 包含文件 2 | 3 | ## tc_include 4 | 5 | tc_include是前台模板包含文件的方法,用于替换原来的include的标签,实现更多功能 6 | 7 | 用法: 8 | 9 | ```html 10 | 11 | 12 | 13 | 14 | ``` -------------------------------------------------------------------------------- /spgetfileextension.md: -------------------------------------------------------------------------------- 1 | # sp_get_file_extension() 2 | 3 | > X2.2.0新增 4 | 5 | ```php 6 | sp_get_file_extension($filename) 7 | ``` 8 | 9 | ###### 功能: 10 | 获取文件扩展名 11 | 12 | 13 | ###### 参数: 14 | `$filename`: 文件名 15 | 16 | ###### 返回: 17 | 类型string,文件扩展名 18 | 19 | 20 | ###### 使用: 21 | 22 | ```php 23 | $suffix = sp_get_file_extension('23232.png'); 24 | ``` 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /base/x_v_difference.md: -------------------------------------------------------------------------------- 1 | # V版本和X版本 2 | 3 | 两个版本区别 4 | 5 | | | ThinkCMF V版本 | ThinkCMF X版本 | 6 | | ---------- | ------------- | -------------- | 7 | | ThinkPHP | ThinkPHP 3.1.3 | ThinkPHP 3.2.3 | 8 | | php支持版本 | php5.2+ | php5.3+ | 9 | | 类库加载方式 | include, require| include,require+命名空间| 10 | 11 | 两个版本相同点都是ThinkCMF,他们实现的功能基本一致,只是实现方法不同,相同的函数参数都会统一! 12 | 相同功能的版本,X版本会先于V版本发布! 13 | 14 | > 注:ThinkCMF V 已经不再维护,请尝试使用最新版 15 | 16 | -------------------------------------------------------------------------------- /_book/base/x_v_difference.md: -------------------------------------------------------------------------------- 1 | # V版本和X版本 2 | 3 | 两个版本区别 4 | 5 | | | ThinkCMF V版本 | ThinkCMF X版本 | 6 | | ---------- | ------------- | -------------- | 7 | | ThinkPHP | ThinkPHP 3.1.3 | ThinkPHP 3.2.3 | 8 | | php支持版本 | php5.2+ | php5.3+ | 9 | | 类库加载方式 | include, require| include,require+命名空间| 10 | 11 | 两个版本相同点都是ThinkCMF,他们实现的功能基本一致,只是实现方法不同,相同的函数参数都会统一! 12 | 相同功能的版本,X版本会先于V版本发布! 13 | 14 | > 注:ThinkCMF V 已经不再维护,请尝试使用最新版 15 | 16 | -------------------------------------------------------------------------------- /spgetfiledownloadurl.md: -------------------------------------------------------------------------------- 1 | # sp_get_file_download_url() 2 | 3 | > X2.2.0新增 4 | 5 | ```php 6 | sp_get_file_download_url($file,$expires=3600) 7 | ``` 8 | 9 | ###### 功能: 10 | 获取文件下载链接 11 | 12 | ###### 参数: 13 | `$file`: 数据库保存的文件路径 14 | 15 | `$expires`:文件过期时间(七牛) 16 | 17 | ###### 返回: 18 | 19 | 类型string,文件下载链接 20 | 21 | ###### 使用: 22 | 23 | ```php 24 | $url = sp_get_file_download_url('portal/23232.png'); 25 | ``` 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /functions/sp_plugin_url.md: -------------------------------------------------------------------------------- 1 | # sp_plugin_url() 2 | 3 | > X1.4.0新增 4 | 5 | ```php 6 | sp_plugin_url($url,$param,$domain) 7 | ``` 8 | 9 | 功能: 10 | 生成访问插件的url 11 | 12 | 参数: 13 | `$url`: url 格式:插件名://控制器名/方法 14 | `$param`:额外参数,默认为空数组 15 | `$domain`:是否添加域名,默认false 16 | 17 | 返回: 18 | 类型url 19 | 20 | 模板使用: 21 | ```php 22 | {:sp_plugin_url('Demo://Index/index',array('id'=>2),true)} 23 | {:sp_plugin_url('Demo://List/index',array('id'=>2))} 24 | ``` 25 | -------------------------------------------------------------------------------- /spcheckmobileverifycode.md: -------------------------------------------------------------------------------- 1 | # sp\_check\_mobile\_verify\_code\(\) 2 | 3 | > X2.3.0新增(暂时无法使用) 4 | 5 | ```php 6 | sp_check_mobile_verify_code($mobile='',$verifycode='') 7 | ``` 8 | 9 | 功能: 10 | 手机验证码检查,验证完后销毁验证码增加安全性 11 | 12 | 参数: 13 | `$mobile`: 手机号 14 | `$verifycode`:验证码 15 | 返回: 16 | 类型boolean 17 | true:手机验证码正确,false:手机验证码错误 18 | 19 | 使用: 20 | ```php 21 | $is_right_mobile_code = sp_check_mobile_verify_code('15121000000','123456'); 22 | ``` 23 | 24 | -------------------------------------------------------------------------------- /functions/sp_getad.md: -------------------------------------------------------------------------------- 1 | # sp_getad() 2 | ```php 3 | sp_getad(); 4 | ``` 5 | 6 | ######功能: 7 | 根据广告名称获取广告内容 8 | 9 | ######参数: 10 | `$ad_name`:广告名称 11 | 12 | ######返回: 13 | 格式 string,广告内容 14 | 15 | ######示例: 16 | ```php 17 | 26 | {:sp_getad('top_ad')} 27 | 28 | ``` 29 | -------------------------------------------------------------------------------- /spcomparepassword.md: -------------------------------------------------------------------------------- 1 | # sp\_compare\_password\(\) 2 | 3 | > X2.1.0新增 4 | 5 | ```php 6 | sp_compare_password($password,$password_in_db) 7 | ``` 8 | 9 | ###### 功能: 10 | CMF密码比较方法,所有涉及用户密码比较的地方都用这个方法 11 | 12 | ###### 参数: 13 | `$password`: 用户输入的密码 14 | `$password_in_db`:数据库保存的经过加密后的密码串 15 | 16 | ###### 返回: 17 | 类型boolean,密码相同,返回true 18 | 19 | ###### 使用: 20 | ```php 21 | $is_right = sp_compare_password('123456','###adfasfasdkfjaslkdjflksajerwqe'); 22 | ``` 23 | 24 | -------------------------------------------------------------------------------- /theme/public/last_join.md: -------------------------------------------------------------------------------- 1 | # 最新加入组件制作 2 | ```html 3 | $last_users=sp_get_users("field:*;limit:0,8;order:create_time desc;"); 4 | 13 | ``` 14 | -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-github/plugin.js: -------------------------------------------------------------------------------- 1 | require([ 'gitbook' ], function (gitbook) { 2 | gitbook.events.bind('start', function (e, config) { 3 | var githubURL = config.github.url; 4 | 5 | gitbook.toolbar.createButton({ 6 | icon: 'fa fa-github', 7 | label: 'GitHub', 8 | position: 'right', 9 | onClick: function() { 10 | window.open(githubURL) 11 | } 12 | }); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /functions/sp_asset_relative_url.md: -------------------------------------------------------------------------------- 1 | # sp_asset_relative_url() 2 | 3 | 4 | > V1.1.1新增 5 | 6 | ```php 7 | sp_asset_relative_url($asset_url) 8 | ``` 9 | 10 | ###### 功能: 11 | 获取文件相对路径 12 | 13 | ###### 参数: 14 | `$asset_url`:文件URL 15 | 16 | ###### 返回 17 | 类型字符串,带协议的绝对地址直接返回原来的值,否则会转化为相对于系统upload 目录的文件路径 18 | 19 | ###### 实例 20 | ```php 21 | X1.4.0新增 4 | 5 | ```php 6 | hook($hook,$param) 7 | ``` 8 | ######功能: 9 | 添加钩子 10 | 11 | ######参数: 12 | `$hook`:钩子名称 13 | `$param`:传入参数,默认为空数组 14 | 15 | ######返回: 16 | 无 17 | 18 | ######模板使用: 19 | ```php 20 | {:hook('footer')} 21 | {:hook('sider',array('text'=>'hello ThinkCMF')} 22 | ``` 23 | 24 | ######控制器方法里使用: 25 | ```php 26 | //不带参数 27 | hook('your_hook_name'); 28 | 29 | //带参数 30 | hook('your_hook_name',array('text'=>'Hello ThinkCMF')); 31 | 32 | ``` 33 | -------------------------------------------------------------------------------- /portal/functions/sp_sql_posts_bycatid.md: -------------------------------------------------------------------------------- 1 | # sp_sql_posts_bycatid() 2 | 3 | > X1.2新增 4 | ```php 5 | sp_sql_posts_bycatid($cid,$tag,$where) 6 | ``` 7 | 8 | 功能: 9 | 根据分类文章分类ID 获取该分类下所有文章(包含子分类中文章),调用方式同sp_sql_posts 10 | 11 | 参数: 12 | `$cid`:分类id 13 | `$tag`:查询标签,以字符串方式传入,例:"order:post_date desc,listorder desc;"field:调用post指定字段,如(id,post_title...) 默认全部 14 | ;limit:数据条数,默认值为10,可以指定从第几条开始,如3,8(表示共调用8条,从第3条开始);order:推荐方式(post_date) (desc/asc/rand()) 15 | `$where`:按照thinkphp where array格式 16 | 17 | 返回: 18 | 类型数组,符合条件的文章列表 -------------------------------------------------------------------------------- /theme/public/like.md: -------------------------------------------------------------------------------- 1 | # 点赞组件 2 | 3 | 点赞组件 4 | ```html 5 | {$post_like} 6 | ``` 7 | 8 | 分解组件: 9 | ```html 10 | 11 | href="{:U('article/do_like',array('id'=>$vo['object_id']))}" 12 | ``` 13 | js类名: 14 | 15 | js-count-btn 16 | 20 | 21 | 22 | 此组件可复用,只要链接是数量操作,开发者可以在自己的应用里添加相应操作 -------------------------------------------------------------------------------- /plugin/flow.md: -------------------------------------------------------------------------------- 1 | # 插件开发流程 2 | 3 | 1. 确定功能,先给插件起名,英文名和中文名 如:Demo,插件演示,然后在plugins目录里添加这个插件目录 4 | 5 | 2. 确定是否要后台配置文件,如果需要在插件根目录加上config.php,格式可看文档“插件配置文件” 6 | 7 | 3. 创建插件主类文件,查看“插件类主文件” 8 | 9 | 4. 确定是否要模板,如需要请根目录添加View目录 10 | 11 | 5. 确定是否可以外部访问,如需要请加Controller目录,再添加Controller文件 12 | 13 | 6. 给自己的模板(themes/simplebootx)添加钩子,把{:hook('钩子名')}放到模板相应位置,再在模板根目录添加hooks.html文件,让系统可以获取你模板里的钩子,如themes/simplebootx/hooks.html文件,文件中以英文逗号分隔钩子,不能有空格; 14 | hooks.html文件可以这样: 15 | footer_end,footer 16 | 17 | 7. 到后台扩展工具-》插件管理刷新界面就会看到你新添加的插件 18 | 19 | 20 | -------------------------------------------------------------------------------- /theme/base/global_var.md: -------------------------------------------------------------------------------- 1 | # 全局变量 2 | 3 | ThinkCMF封装了前台模板开发时常用的一些变量,这些变量是全局的,你在前台模板任何时候都能直接调用: 4 | 5 | ```php 6 | {$site_name} /站点名称 7 | {$site_host} /站点域名 8 | {$site_root} /安装目录 9 | {$site_icp} /备案信息 10 | {$site_admin_email} /管理员邮箱 11 | {$site_tongji} /页面统计代码 12 | {$site_seo_title} /SEO标题 13 | {$site_seo_keywords} /SEO关键字 14 | {$site_seo_description} /SEO描述 15 | {$site_copyright} /版权信息 16 | ``` -------------------------------------------------------------------------------- /theme/public/slide.md: -------------------------------------------------------------------------------- 1 | # 幻灯片制作 2 | 3 | 在后台扩展工具》幻灯片分类 添加分类标识为"portal\_index"的分类,然后在此分类添加幻灯片; 4 | ```php 5 | cat_name:幻灯片类型名称 6 | cat_idname:幻灯片标示 7 | slide_name:幻灯片名称 8 | slide_pic:幻灯片图片地址 9 | slide_url:幻灯片URL 10 | slide_des:幻灯片描述 11 | slide_content:幻灯片内容 12 | 13 | 14 | $home_slides=sp_getslide("portal_index"); 15 | 16 | 17 | 18 | {$vo.slide_name} 19 | 20 | 21 | 22 | 23 | ``` 24 | 25 | -------------------------------------------------------------------------------- /view/display.md: -------------------------------------------------------------------------------- 1 | # 模板渲染 2 | 3 | 在控制器里模板渲染最常用的方法是display,在CMF中支持如下的模板渲染方式: 4 | ```php 5 | //不带任何参数 6 | $this->display(); 7 | ``` 8 | 此种方式系统会自动判断模板路径,并渲染出模板内容,此种方式模板路径是:主题名/应用名/控制器名/操作名+模板文件后缀名; 9 | 10 | ```php 11 | $this->display('edit'); 12 | ``` 13 | 此种方式表示调用此控制器下的edit操作的模板; 14 | 15 | ```php 16 | $this->display(':index'); 17 | ``` 18 | 此种方式表示调用此应用下index控制器的模板; 19 | 20 | 还有一种使用场景,就是有时我们可能会把模板存在数据库,或缓存等地方,并没有任何模板文件,只有模板内容,这时我们就要用到另一种方法show了; 21 | 22 | ```php 23 | //$content 是数据库中的模板内容 24 | $this->show($content); 25 | ``` 26 | 通过方法,会对模板内容进行渲染,并输出。 -------------------------------------------------------------------------------- /functions/sp_get_users.md: -------------------------------------------------------------------------------- 1 | # sp_get_users() 2 | > X1.2新增 3 | 4 | ```php 5 | sp_get_users($tag,$where) 6 | ``` 7 | 8 | ######功能: 9 | 获取符合条件的用户列表; 10 | 11 | ######参数: 12 | `$tag`:查询标签,默认:field:\*;limit:0,8;order:create_time desc; 13 | `$where`:查询where数组,按照thinkphp where array格式; 14 | 15 | ######返回: 16 | 数组,符合条件的用户列表 17 | 18 | 19 | ######使用 20 | ```php 21 | //获取最新注册的8个新用户 22 | $last8_users = sp_get_users('field:*;limit:0,8;order:create_time desc;'); 23 | 24 | // 打印用户列表 25 | print_r($last8_users); 26 | ``` 27 | 28 | 29 | -------------------------------------------------------------------------------- /functions/sp_check_user_action.md: -------------------------------------------------------------------------------- 1 | # sp_check_user_action() 2 | 3 | > X1.1新增 4 | 5 | ```php 6 | sp_check_user_action($object,$count_limit,$ip_limit,$expire) 7 | ``` 8 | ######功能: 9 | 检查用户对某个url,内容的可访问性,用于记录如是否赞过,是否访问过等等;开发者可以自由控制,对于没有必要做的检查可以不做,以减少服务器压力 10 | 11 | ######参数说明: 12 | `$object`: 访问对象的id,格式:不带前缀的表名+id;如posts1表示xx_posts表里id为1的记录;如果object为空,表示只检查对某个url访问的合法性 13 | `$count_limit`: 访问次数限制,如1,表示只能访问一次 14 | `$ip_limit`: ip限制,false为不限制,true为限制 15 | `$expire`: 距离上次访问的最小时间单位s,0表示不限制,大于0表示最后访问$expire秒后才可以访问 16 | 17 | ######返回: 18 | `true`可访问,`false`不可访问 -------------------------------------------------------------------------------- /functions/comments.md: -------------------------------------------------------------------------------- 1 | #Comments() 2 | 3 | > V1.1.1新增 4 | 5 | ```php 6 | Comments($table,$post_id,$params=array()) 7 | ``` 8 | ###### 功能: 9 | 生成评论组件 10 | 11 | ###### 参数: 12 | `$table`:评论对象所在的表,不带表前缀 13 | 14 | `$post_id`:评论对象的id 15 | 16 | `$params`:额外参数,类型为数组,目前只支持tpl参数 17 | 18 | 19 | ######模板中使用 20 | ```php 21 | 22 | {:Comments("posts",$object_id)} 23 | 24 | 28 | {:Comments("posts",$object_id,array('tpl'=>'mycomments'))} 29 | 30 | 31 | ``` -------------------------------------------------------------------------------- /functions/sp_auth_check.md: -------------------------------------------------------------------------------- 1 | # sp_auth_check() 2 | 3 | > X1.5.0新增 4 | 5 | ```php 6 | sp_auth_check($uid,$name=null,$relation='or') 7 | ``` 8 | 功能: 9 | 用户权限验证 10 | 11 | 参数: 12 | `$uid`: 当前登录用户或者管理员的id 13 | `$name`:需要验证的规则列表,支持逗号分隔的权限规则或索引数组,默认为当前url 14 | `$relation`:如果为 'or' 表示满足任一条规则即通过验证;如果为 'and'则表示需满足所有规则才能通过验证 15 | 16 | 返回: 17 | 类型boolean 18 | 通过验证返回true;失败返回false 19 | 20 | 使用: 21 | ```php 22 | sp_auth_check(2); 23 | sp_auth_check(2,'admin/ad/index'); 24 | sp_auth_check(2,array('admin/ad/index')); 25 | sp_auth_check(2,'admin/ad/index,admin/ad/add','and'); 26 | ``` 27 | -------------------------------------------------------------------------------- /functions/sp_is_mobile.md: -------------------------------------------------------------------------------- 1 | # sp_is_mobile() 2 | 3 | > 1.4.0新增 4 | 5 | ```php 6 | sp_is_mobile() 7 | ``` 8 | 9 | ######功能: 10 | 判断是否为手机访问 11 | 12 | ######参数: 13 | 无 14 | 15 | ######返回: 16 | boolean, true:是手机访问,false:不是 17 | 18 | #####使用: 19 | ```php 20 | if(sp_is_mobile()){ 21 | echo "我是手机用户呢!"; 22 | }else{ 23 | echo "我不是手机用户呀,那就是电脑用户呀!"; 24 | } 25 | ``` 26 | 27 | ######模板里使用 28 | ```php 29 | 30 |
我是手机用户呢!
31 | 32 |
我不是手机用户呀,那就是电脑用户呀!
33 |
34 | ``` 35 | 36 | -------------------------------------------------------------------------------- /theme/public/last_comment.md: -------------------------------------------------------------------------------- 1 | # 最新评论组件制作 2 | ```html 3 | $last_comments=sp_get_comments("field:*;limit:0,5;order:createtime desc;"); 4 | 5 |
6 | 7 | {$vo.full_name}: 8 | {$vo.content} 9 | 查看原文 10 | {:date('m月d日 H:i',strtotime($vo['createtime']))} 11 | 12 |
13 |
14 | ``` -------------------------------------------------------------------------------- /base/coding_standards.md: -------------------------------------------------------------------------------- 1 | # 开发规范 2 | 3 | ThinkCMF完全按ThinkPHP开发规范进行 4 | 5 | 开发前请详细阅读: 6 | [http://www.kancloud.cn/manual/thinkphp/1687](http://www.kancloud.cn/manual/thinkphp/1687) 7 | 8 | ##ThinkCMF特别开发规范 9 | 10 | 1. 应用后台控件器放在应用Controller目录中,最好不要存放在Admin/Controller下,保证应用模块独立 11 | * 应用后台控件器命名以\*\*\*\*adminController.class.php或者Admin\*\*\*\*Controller.class.php命名的是后台Controller, 在后台菜单导入时会自动识别 12 | * 应用后台控件器方法命名:用户无法访问的内部方法,请以下划线(_)开头; 13 | * 附件保存路径,要相对于upload目录,只保存之后路径 14 | * 使用I函数获取post和get的数据 15 | * 模板中php代码注释都使用/\*\*/的方式,//这种方式一定不要用,否则debug关闭后会有各种问题! 16 | * 各种php文件最好别加?>结束,防止响应多余字符 17 | 18 | -------------------------------------------------------------------------------- /portal/template/hot_articles.md: -------------------------------------------------------------------------------- 1 | # 热门文章组件制作 2 | 3 | 热门文章 4 | ```php 5 | 6 | $hot_articles=sp_sql_posts("cid:$portal_index_lastnews;field:post_title,post_excerpt,object_id,term_id,smeta;order:post_hits desc;limit:5;"); 7 |
    8 | 9 | $top=$key<3?"top3":""; 10 |
  • 11 | {$key+1} 12 | {$vo.post_title}
  • 13 |
    14 |
15 | ``` 16 | -------------------------------------------------------------------------------- /view/assign.md: -------------------------------------------------------------------------------- 1 | # 模板赋值 2 | 模板赋值就是在控制器里把控制器的变量传递给模板,对于系统变量你不用赋值我们可以通过特殊的标签在模板里输出,变量赋值我们都通过assign方法进行赋值;所有assign方法,都必须在display,show,fetch方法执行前调用; 3 | 4 | 5 | 1. 传递一个$name到模板 6 | ```php 7 | $this->assign('name','this is name'); 8 | ``` 9 | 这样就可以在模板使用$name了,直接输出变量可以{$name} 10 | 也可以直接在php标签里使用这个变量; 11 | ```php 12 | 13 | echo $name; 14 | 15 | ``` 16 | 2. 传递一个数组 17 | ```php 18 | $user=array( 19 | 'name'=>'Dean', 20 | 'email'=>'cmf@simplewind.net', 21 | 'phone'=>'15121010086' 22 | ); 23 | $this->assign($user); 24 | ``` 25 | 模板里就被传递了$name,$email,$phone 三个变量了,你可以直接输出{$name},{$email},{$phone} 26 | -------------------------------------------------------------------------------- /preface.md: -------------------------------------------------------------------------------- 1 | # 序言 2 | ##版权声明 3 | 未经版权所有者(thinkcmf.com)明确授权,禁止发行本文档及其被实质上修改的版本。 4 | 未经版权所有者(thinkcmf.com)事先授权,禁止将此作品及其衍生作品以标准(纸质)书籍形式发行。 5 | 如果有兴趣再发行或再版本手册的全部或部分内容,不论修改过与否,或者有任何问题,请联系版权所有者(cmf@simplewind.net)。 6 | 7 | ##捐赠我们 8 | ThinkCMF一直秉承ThinkPHP大道至简的理念,坚持做最简约的ThinkPHP开源软件! 9 | 您的每一份帮助都将支持ThinkCMF做的更好,走的更远! 10 | 我们一直在坚持不懈地努力,并坚持让ThinkCMF完全开源免费,您的帮助将使我们更有动力和信心^_^! 11 | 12 | 支付宝捐赠:(用手机支付宝扫描二维码支付)ThinkCMF支付宝捐赠二维码 13 | ![支付宝二维码](images/alipay_qrcode.png) 14 | 15 | 您的每一份捐赠将用来: 16 | 1. 深入ThinkCMF核心的开发 17 | * 做丰富的应用 18 | * 设计更爽的用户界面 19 | * 吸引更多的模板开发者和应用开发者 20 | * 奖励更多优秀贡献者 21 | * 点站内自己有兴趣的广告,也是对我们的帮助哟!~~ 22 | 23 | 24 | -------------------------------------------------------------------------------- /admin/smtp.md: -------------------------------------------------------------------------------- 1 | # SMTP配置 2 | 3 | **发件人:** 4 | 显示的发件人名字 5 | 6 | **邮箱地址: ** 7 | 表示显示发件人的邮箱地址,和下面的邮箱登录帐号最好一样; 8 | 9 | **SMTP服务器:** 10 | 表示你的邮件服务器地址,不带http;如163,126邮箱分别是smtp.163.com,smtp.126.com,smtp.qq.com 11 | 12 | **连接方式:** 13 | 为空或"ssl"或"tls"(具体查看邮箱客户端设置帮助) 14 | 15 | **SMTP服务器端口:** 16 | 正常连接方式为空的为25,连接方式为"ssl"的为465 17 | 18 | **邮箱登录帐号:** 19 | 就是你的邮箱号 20 | 21 | **邮箱登录密码:** 22 | 你的邮箱密码;(QQ邮箱为开启smtp邮箱时的第三方登录"授权码") 23 | 24 | 25 | **示例1:QQ邮箱** 26 | 发件人:rainfer 27 | 邮箱地址:81818832@qq.com 28 | SMTP服务器:smtp.qq.com 29 | 连接方式:ssl 30 | SMTP端口:465 31 | 发件箱帐号:81818832@qq.com 32 | 发件箱密码:xxxxxxxxxxxx 33 | 34 | -------------------------------------------------------------------------------- /portal/base/structure.md: -------------------------------------------------------------------------------- 1 | # 主程序结构 2 | ``` 3 | |--Portal 4 | |--Common 5 | |--funtion.php //应用函数库 6 | |--Conf 7 | |--config.php // 应用配置文件 8 | |--Controller 9 | |--ArticleController.class.php //文章内页控制器 10 | |--ListController.class.php //文章列表控制器 11 | |--IndexController.class.php //应用首页控制器 12 | |--PageController.class.php //页面控件器 13 | |--Lang //多语言文件 14 | |--Menu //1.0.4版本目录,默认为空用来存放备份的此应用的后台菜单 15 | |--nav.php //1.0.4新加,用于开发者控制返回前台菜单的文件 16 | ``` 17 | -------------------------------------------------------------------------------- /bootstrap.md: -------------------------------------------------------------------------------- 1 | # 关于BootStrap 2 | 3 | Bootstrap是Twitter推出的一个开源优秀的前端响应式开发框架。它由Twitter的设计师Mark Otto和Jacob Thornton合作开发。ThinkCMF首发版本将全面支持BootStrap,ThinkCMF不仅创造了第一个中文内容管理框架,还致力于将BootStrap本土化。 4 | 5 | Bootstrap是基于jQuery框架开发的,它在jQuery框架的基础上进行了更为个性化和人性化的完善,形成一套自己独有的网站风格,并兼容大部分jQuery插件。 6 | 7 | Bootstrap中包含了丰富的Web组件,根据这些组件,可以快速的搭建一个漂亮、功能完备的网站。其中包括以下组件:下拉菜单、按钮组、按钮下拉菜单、导航、导航条、面包屑、分页、排版、缩略图、警告对话框、进度条、媒体对象等; 8 | 9 | ThinkCMF演示站[http://demo.thinkcmf.com](http://demo.thinkcmf.com)就是完全基于Bootstrap2.3.2开发,对于ThinkCMF的前端开发,我们推荐您使用bootstrap,但不限制必须使用。我们自己完善的simpleboot开发框架,完全基于bootstrap 2.3.2,但它拥有更多的组件,同时支持IE7+,我们已经在ThinkCMF的public目录下集成了simpleboot,你在开发中完全可以直接使用,不用再次安装。 -------------------------------------------------------------------------------- /view/fetch.md: -------------------------------------------------------------------------------- 1 | # 获取内容 2 | 3 | 还有一种调用模板的情况是我们只想渲染后返回模板渲染后的数据而不是直接输出,这时我们会用fetch方法; 4 | 5 | fetch的用法和display 完全一样,只是不直接输出了; 6 | 7 | ```php 8 | //不带任何参数 9 | $content=$this->fetch(); 10 | ``` 11 | 此种方式系统会自动判断模板路径,并渲染出模板内容,此种方式模板路径是:主题名/应用名/控制器名/操作名+模板文件后缀名; 12 | 13 | ```php 14 | $content=$this->fetch('edit'); 15 | ``` 16 | 此种方式表示调用此控制器下的edit操作的模板; 17 | 18 | ```php 19 | $content=$this->fetch(':index'); 20 | ``` 21 | 此种方式表示调用此应用下index控制器的模板; 22 | 23 | ```php 24 | $str_content='this is a template file content,{$name}'; 25 | $content=$this->fetch('',$str_content); 26 | ``` 27 | 此种方式是表示直接渲染传入的字符串里的模板内容; 28 | 29 | 通过以上方式得到渲染后的模板内容后,你可以对此内容做进一步处理; -------------------------------------------------------------------------------- /portal/template/page.md: -------------------------------------------------------------------------------- 1 | # 页面制作 2 | 可用变量 3 | ```php 4 | {$post_author}
5 | {$post_keywords}
6 | {$post_date}
7 | {$post_content}
8 | {$post_title}
9 | {$post_excerpt}
10 | {$post_modified}
11 | {$smeta}
12 | ``` 13 | 14 | 对变量smeta的转化 15 | ```php 16 | 17 | /*处理smeta*/ 18 | $smeta=json_decode($smeta,true);/*把smeta转化成数组*/ 19 | 20 | {$smeta.thumb}
21 | 22 | 23 | ``` 24 | -------------------------------------------------------------------------------- /portal/template/seo.md: -------------------------------------------------------------------------------- 1 | # seo优化 2 | 全站seo: 3 | ```php 4 | {$site_seo_title} 5 | {$site_seo_keywords} 6 | {$site_seo_description} 7 | ``` 8 | 9 | 文章列表页: 10 | ```php 11 | {$seo_title} 12 | {$seo_keywords} 13 | {$seo_description} 14 | ``` 15 | 16 | 文章页: 17 | ```php 18 | {$post_title} 19 | {$post_keywords} 20 | {$post_excerpt} 21 | ``` 22 | 23 | 页面: 24 | ```php 25 | {$post_title} 26 | {$post_keywords} 27 | {$post_excerpt} 28 | ``` -------------------------------------------------------------------------------- /theme/public/password_reset.md: -------------------------------------------------------------------------------- 1 | # 密码重置模板制作 2 | 3 | 模板文件:User/password_reset.html 4 | ```html 5 |
6 | 7 | 8 | 9 | 10 | 11 | {:sp_verifycode_img('length=4&font_size=15&width=100&height=35&charset=1234567890')} 12 | 13 | 14 |
15 | ``` -------------------------------------------------------------------------------- /portal/functions/sp_get_term.md: -------------------------------------------------------------------------------- 1 | # sp_get_term() 2 | ```php 3 | sp_get_term($term_id) 4 | ``` 5 | 功能: 6 | 返回指定分类 7 | 8 | 参数: 9 | `$term_id`:分类id 10 | 11 | 返回: 12 | 类型数组,符合条件的分类 13 | 14 | 示例: 15 | ```php 16 | 21 | ``` 22 | 返回数组说明: 23 | 24 | `term_id`:分类id 25 | `name`:分类名称 26 | `taxonomy`:分类的类型,用字符串表示,article表示文章 27 | `description`: 分类描述 28 | `parent`:分类父级id,terms表中的term_id 29 | `seo_title` 30 | `seo_keywords` 31 | `seo_description` 32 | `list_tpl`:分类列表页的模板,对应于模板目录下Portal/文件名+.html,文件名默认为list 33 | `one_tpl`:分类单文章页的模板,对应于模板目录下Portal/文件名+.html,文件名默认为article 34 | 35 | -------------------------------------------------------------------------------- /functions/sp_verifycode_img.md: -------------------------------------------------------------------------------- 1 | # sp_verifycode_img() 2 | 3 | 示例: 4 | ```php 5 | 11 | ``` 12 | 13 | 14 | ```html 15 | 16 | 19 | 20 | 21 | 22 | 23 | 25 | {:sp_verifycode_img()} 26 | 27 | 参数1: 28 | 29 | $style ='code_len=4&font_size=15&width=100&height=35&charset=1234567890'; 30 | 31 | code_len 字符长度 32 | 33 | font_size 字体大小 34 | 35 | width 生成图片宽度 36 | 37 | heigh 生成图片高度 38 | 39 | charset 要显示的字符集 40 | ``` 41 | 42 | 43 | > 注:此函数仅生成img标签,应该配合在表单加入name=verify的input标签 -------------------------------------------------------------------------------- /_book/functions/sp_verifycode_img.md: -------------------------------------------------------------------------------- 1 | # sp_verifycode_img() 2 | 3 | 示例: 4 | ```php 5 | 11 | ``` 12 | 13 | 14 | ```html 15 | 16 | 19 | 20 | 21 | 22 | 23 | 25 | {:sp_verifycode_img()} 26 | 27 | 参数1: 28 | 29 | $style ='code_len=4&font_size=15&width=100&height=35&charset=1234567890'; 30 | 31 | code_len 字符长度 32 | 33 | font_size 字体大小 34 | 35 | width 生成图片宽度 36 | 37 | heigh 生成图片高度 38 | 39 | charset 要显示的字符集 40 | ``` 41 | 42 | 43 | > 注:此函数仅生成img标签,应该配合在表单加入name=verify的input标签 -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-editlink/plugin.js: -------------------------------------------------------------------------------- 1 | require(["gitbook", "jQuery"], function(gitbook, $) { 2 | gitbook.events.bind('start', function (e, config) { 3 | var conf = config.editlink 4 | var label = conf.label 5 | var base = conf.base 6 | var multilingual = conf.multilingual || false 7 | 8 | if (base.slice(-1) !== "/") { 9 | base += "/" 10 | } 11 | 12 | gitbook.toolbar.createButton({ 13 | icon: 'fa fa-edit', 14 | text: label, 15 | onClick: function() { 16 | var filepath = gitbook.state.filepath 17 | var lang = multilingual && $('html').attr('lang') ? $('html').attr('lang') + '/' : '' 18 | 19 | window.open(base + lang + filepath) 20 | } 21 | }) 22 | }) 23 | }) -------------------------------------------------------------------------------- /theme/public/forgot_password.md: -------------------------------------------------------------------------------- 1 | # 忘记密码模板制作 2 | 3 | 模板文件:User/forgot_password.html 4 | ```html 5 |
6 | 7 | 8 | 9 | 10 | 11 | {:sp_verifycode_img('length=4&font_size=15&width=100&height=35&charset=1234567890')} 12 | 13 | 14 | 15 |
16 | ``` -------------------------------------------------------------------------------- /extends/base_class.md: -------------------------------------------------------------------------------- 1 | # 几个重要基类 2 | 3 | 在ThinkCMFX系列版本的application/Common/Controller下有以下几个基类: 4 | 5 | ``` 6 | |-AppframeController — ThinkCMF框架控件器基类,继承至Controller 7 | |-AdminbaseController — ThinkCMF框架后台控件器基类,继承至AppframeController 8 | |-HomebaseController — ThinkCMF框架前台控件器基类,继承至AppframeController 9 | |-MemberbaseController — ThinkCMF框架会员控件器基类,继承至HomebaseController 10 | ``` 11 | 12 | 对于AdminbaseController和HomebaseController它们一个重要的方法display,分别用于管理后台和前台的模板显示,如果你的controller继承了AdminbaseController,在你调用display方法时,它会帮你去找admin/themes目录下的文件,同样HomebaseController也会帮你去找themes目录下的文件,这样就很好的实现了前后台模板的分离。 13 | 14 | 对于MemberbaseController,继承这个类的Controller会帮你判断会员的相关的操作,比如用户是否已经登陆,用户是否有权限访问此url。 15 | 16 | 所以想开发应用的同学,一定要在自己创建Controller之前想好你的Controller要完成什么功能,再去让它extends相应的基类。 -------------------------------------------------------------------------------- /plugin/controller.md: -------------------------------------------------------------------------------- 1 | # 插件控制器 2 | 3 | 插件写法: 4 | ```php 5 | display(":index"); 13 | } 14 | 15 | } 16 | ``` 17 | 18 | 插件url生成方法,sp_plugin_url(); 19 | 20 | X1.4.0新增 21 | ```php 22 | sp_plugin_url($url,$param,$domain) 23 | ``` 24 | 功能: 25 | 生成访问插件的url 26 | 27 | 参数: 28 | `$url`: url 格式:插件名://控制器名/方法 29 | `$param`:额外参数,默认为空数组 30 | `$domain`:是否添加域名,默认false 31 | 32 | 返回: 33 | 类型url 34 | 35 | 模板使用: 36 | 37 | ```php 38 | {:sp_plugin_url('Demo://Index/index',array('id'=>2),true)} 39 | {:sp_plugin_url('Demo://List/index',array('id'=>2))} 40 | ``` -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-anchors/plugin.css: -------------------------------------------------------------------------------- 1 | 2 | a.plugin-anchor { 3 | color: inherit !important; 4 | display: none; 5 | margin-left: -30px; 6 | padding-left: 40px; 7 | cursor: pointer; 8 | position: absolute; 9 | top: 0; 10 | left: 0; 11 | bottom: 0; 12 | } 13 | 14 | a.plugin-anchor i { 15 | margin-left: -30px; 16 | font-size: 15px !important; 17 | } 18 | 19 | h1, h2, h3, h4, h5, h6 { 20 | position: relative; 21 | } 22 | 23 | h1:hover a.plugin-anchor, h2:hover a.plugin-anchor, h3:hover a.plugin-anchor, 24 | h4:hover a.plugin-anchor, h5:hover a.plugin-anchor, h6:hover a.plugin-anchor { 25 | display: inline-block; 26 | } 27 | 28 | .book .book-body .page-wrapper .page-inner section.normal { 29 | overflow: visible; 30 | } 31 | -------------------------------------------------------------------------------- /theme/public/favorite.md: -------------------------------------------------------------------------------- 1 | # 如何收藏 2 | 3 | 收藏组件,其它应用可以公用 4 | ```html 5 | 6 | 7 | 8 | 9 | 10 | 11 | ``` 12 | ```php 13 | sp_get_favorite_key($table,$object_id) 14 | ``` 15 | 16 | 参数1:收藏内容所在的表,不带表前缀的表名称,如cmf_posts应该改为“posts”; 17 | 18 | 参数2:收藏内容的id: 19 | 20 | 21 | data-title:收藏的内容标题; 22 | 23 | data-url:收藏内容的url; 24 | 25 | data-key:安全key,用sp_get_favorite_key方法生成,防止有人提交错误数据; -------------------------------------------------------------------------------- /theme/public/login.md: -------------------------------------------------------------------------------- 1 | # 本站用户登录模板制作 2 | 3 | 模板文件:User/login.html 4 | ```html 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | {:sp_verifycode_img('length=4&font_size=15&width=100&height=35&charset=1234567890')} 15 | 16 | 17 |
18 | ``` 19 | -------------------------------------------------------------------------------- /plugin/hook.md: -------------------------------------------------------------------------------- 1 | # 插件钩子 2 | 3 | 钩子是插件执行的触发器;插件就像挂在钩子上的东西; 4 | 5 | 插件只有实现相应钩子方法,并安装启用成功后才能执行; 6 | 7 | ThinkCMF系统内置了很多钩子;http://www.thinkcmf.com/document/hooks.html 8 | 9 | 开发者也可以用hook('test')方法在控制器只加入钩子,让你的应用具有更好的扩展性; 10 | 11 | 同时也可以模板里加入钩子{:hook('footer')}; 12 | 13 | 钩子也支持传入参数hook('footer',array('test'=>1)); 14 | 15 | 向系统暴露你的钩子 16 | 17 | 就是把你的钩子在相应的文件里列出来,系统会来检测。 18 | 暴露应用控制器钩子: 19 | 20 | 在你的应用根目录加上hooks.php文件 21 | 22 | 文件中返回此应用所有钩子数组就可以了; 23 | 24 | 如portal应用: 25 | 26 | ![](../images/54aa91de3ca54.png) 27 | 28 | hooks.php文件内容 29 | 30 | ```php 31 | 10 | [photo] => Array 11 | ( 12 | [0] => Array 13 | ( 14 | [url] => 20160310/56e12de5d6f70.png 15 | [alt] => QQ截图20160227144342 16 | ) 17 | 18 | [1] => Array 19 | ( 20 | [url] => 20160310/56e12e2adbafc.png 21 | [alt] => QQ截图20160227144342 22 | ) 23 | 24 | ) 25 | 26 | ) 27 | ``` 28 | 此时遍历在视图遍历就能获得相册了 29 | ```php 30 | 31 | 32 | 33 | ``` 34 | 作者:小夏 -------------------------------------------------------------------------------- /_book/portal/template/wen_zhang_xiang_ce_zhi_zuo.md: -------------------------------------------------------------------------------- 1 | # 文章相册制作 2 | 3 | 后台添加相册图集何如在视图显示 4 | 如: 5 | 打印$smeta查看数据结构 6 | ```php 7 | Array 8 | ( 9 | [thumb] => 10 | [photo] => Array 11 | ( 12 | [0] => Array 13 | ( 14 | [url] => 20160310/56e12de5d6f70.png 15 | [alt] => QQ截图20160227144342 16 | ) 17 | 18 | [1] => Array 19 | ( 20 | [url] => 20160310/56e12e2adbafc.png 21 | [alt] => QQ截图20160227144342 22 | ) 23 | 24 | ) 25 | 26 | ) 27 | ``` 28 | 此时遍历在视图遍历就能获得相册了 29 | ```php 30 | 31 | 32 | 33 | ``` 34 | 作者:小夏 -------------------------------------------------------------------------------- /portal/template/article.md: -------------------------------------------------------------------------------- 1 | # 文章内页制作 2 | 3 | 可用变量 4 | ```php 5 | {$article_id} 当前文章id 6 | {$term_id} 文章分类id,对应于表terms里的term_id; 7 | {$post_author}
8 | {$post_keywords}
9 | {$post_date}
10 | {$post_content}
11 | {$post_title}
12 | {$post_excerpt}
13 | {$post_modified}
14 | {$smeta}
15 | {$user_nicename}
16 | {$user_email}
17 | ``` 18 | 19 | 对变量smeta的转化 20 | ```html 21 | 22 | /*处理smeta*/ 23 | $smeta=json_decode($smeta,true);/*把smeta转化成数组*/ 24 | 25 | {$smeta.thumb}
26 | 27 | 28 | ``` -------------------------------------------------------------------------------- /theme/js/js-favorite-btn.md: -------------------------------------------------------------------------------- 1 | # js-favorite-btn 2 | 3 | 前台收藏组件,其它应用可以公用 4 | ```html 5 | 6 | 7 | 8 | 9 | 10 | 11 | ``` 12 | 13 | ```php 14 | sp_get_favorite_key($table,$object_id) 15 | ``` 16 | `$table`:收藏内容所在的表,不带表前缀的表名称,如cmf_posts应该改为“posts”; 17 | `$object_id`:收藏内容的id: 18 | 19 | 20 | ###a标签属性说明 21 | data-title:收藏的内容标题; 22 | 23 | data-url:收藏内容的url; 24 | 25 | data-key:安全key,用sp_get_favorite_key方法生成,防止有人提交错误数据; -------------------------------------------------------------------------------- /view/theme_detail.md: -------------------------------------------------------------------------------- 1 | # 模板主题 2 | 3 | cmf分为前台模板主题和后台模板主题,两都分开独立设置,它们也在不同的目录下,前台模板在themes下,后台模板在 `admin/themes`下; 4 | 5 | 目前cmf默认的前后台模板主题分别是`simplebootx`和 `simplebootx`,路径分别是 `themes/simplebootx`,`admin/themes/simplebootx`; 6 | 7 | 所以这种架构形式下,前后台是都支持多主题的,如果我想增加的主题,只要把默认主题复制后,目录名改一下放在前后台主题目录下,就是一个新的主题,当然你完全可以从零开始写,只要确保文件名对应就可以了;要注意模板命名格式,英文字母加数字的形式; 8 | 9 | 目前前台主题切换是可以在后台管理里完成的,打开后台管理,在设置->网站信息->模板方案里选择自己要的主题就可以了; 10 | 11 | ![](../images/56959873764f7.png.jpg) 12 | 13 | 注意你在打开模板方案里可能会发现_en-us,_mobile,_mobile_en-us结尾的类似模板,这些都是相应模式下的模板,比如,你后台设置的是simplebootx,如果是手机用户系统会自动判断,并使用simplebootx_mobile 模板,如果用户是英文的系统也会自动判断使用simplebootx_en-us模板; 14 | 15 | 后台主题切换,暂时没有做到后台,不过你可以在后台设置->网站信息->后台风格,切换你的后台风格,如果你愿意自己再做套后台模板的话,你可以在配置文件`application/Common/Conf/config.php`里找到`SP_ADMIN_DEFAULT_THEME`配置项,把simplebootx换成你自己的后台主题名,这样以后如果你还想用官方的后台主题,还可以再换回来!后台模板制作我们并不会提供教程,不过作为高手你懂得! -------------------------------------------------------------------------------- /admin/forgot_admin_pw.md: -------------------------------------------------------------------------------- 1 | # 忘记后台密码? 2 | 3 | 后台密码忘记了怎么办? 4 | 5 | 1.如果你已经在后台配置了,邮件发送功能且邮箱是你的真实邮箱,可以到前台登录页找回密码; 6 | 7 | 2.如果你是后台管理员,你可以使用 sp_password()方法生成一下新的密码; 8 | 9 | 你只要在任何一个前台可以访问控制器里,如application/Portal/Controller/IndexController.class.php 10 | 11 | ```php 12 | display(":index"); 24 | } 25 | 26 | } 27 | ``` 28 | 访问你的首页:得到密码后,把你刚刚修改的地方还原; 29 | 30 | 打开你的数据库管理功能,找到你的管理员那一列,把密码换进去! 31 | 32 | 33 | 34 | 3.如果以上方法都不行,那你只能找 ThinkCMF的官网人员了(如:Dean),不过他的收费很高,单次还原密码要1000元,看到这里你估计不会考虑了! 35 | 36 | ps:让以后你还忘记密码! 37 | 38 | ![](../images/j_0050.gif) 39 | 开源不容易,多少给点支持行不?别删链接呀也! -------------------------------------------------------------------------------- /extends/admin_menu.md: -------------------------------------------------------------------------------- 1 | # 后台隐藏的后台菜单管理功能 2 | 3 | 应用Controller目录下文件命名规则,以\*\*\*\*adminController.class.php或者Admin\*\*\*\*Controller.class.php命名的是后台controller, 在后台菜单导入时会自动识别 4 | 5 | 6 | 以下几个功能是debug开启时才会出现的: 7 | 1. 所有菜单 8 | ![](../images/031A9AF4-CA48-4FAB-873E-D2735B010D26.png) 9 | 这个是用来管理后台所有菜单的,在这里可以很方便的对那些“未知”的菜单进行编辑 10 | 11 | 2. 导入新菜单 12 | 这个功能就是所有菜单里那个“导入新菜单”的按钮 13 | 它用于导入所有你新增的后台方法(可以通过url访问的公共方法), 14 | 这样就不用一个个添加你新加的方法了 15 | ![](../images/8BDF3EE2-A11B-4437-ABA6-F65DF9DC46C0.png) 16 | 17 | 3. 备份菜单 18 | 你会发现在CMF的每个应用下都会有个Menu目录 19 | 当你点击“备份菜单”以后,再到你系统的应用Menu下你会发现会增加很多个文件 20 | ![](../images/FD2DB1F5-D7E8-4CC4-8003-A003A0480FFE.png) 21 | 这些文件就是对应Admin应用下的每个控制器的方法,里面会记录一些url参数 22 | 23 | 4. 恢复菜单 24 | 那这个功能就是对应于“备份菜单”的,它会将备份菜单 功能生成的文件,恢复到数据库; 25 | 26 | > 注意: 27 | > a)这个功能只会增加数据库里没有的菜单,不会删除! 28 | > b)同时你也可以修改备份文件里的菜单名称,在恢复时会更新到数据库; 29 | > c)不会修改你菜单层级关系! 30 | 31 | -------------------------------------------------------------------------------- /extends/thirdpart_lib.md: -------------------------------------------------------------------------------- 1 | # 引入第三方库 2 | 3 | ThinkCMF第三方类库在simplewind/Core/Library/Vendor 4 | 5 | 如果你的第三方类库都放在Vendor目录下面,并且都以.php为类文件后缀,也没用采用命名空间的话,那么可以使用系统内置的vendor函数简化导入。例如,我们来导入二维码操作库phpqrcode,把 phpqrcode放到Vendor目录下面,这个时候phpqrcode主文件的路径就是 simplewind/Core/Library/Vendor/phpqrcode/phpqrcode.php,我们使用vendor 方法导入只需要使用: 6 | ```php 7 | vendor('phpqrcode.phpqrcode');//导入类库 8 | $QRcode = new \QRcode();//实例化,注意加\ 9 | ``` 10 | 这样就导入phpqrcode类库了,并完成了实例化 11 | 12 | vendor方法也可以支持和import方法一样的基础路径和文件名后缀参数,例如: 13 | ```php 14 | vendor('phpqrcode.phpqrcode','simplewind/Core/Library/Vendor','.php'); 15 | ``` 16 | 17 | vendor方法: 18 | ```php 19 | vendor($class, $baseUrl, $ext) 20 | ``` 21 | 22 | 功能: 23 | 快速导入第三方框架类库,所有第三方框架的类库文件统一放到系统的simplewind/Core/Library/Vendor目录下面 24 | 25 | 参数: 26 | $class:类库,如phpqrcode.phpqrcode 27 | $baseUrl:基础目录,默认simplewind/Core/Library/Vendor 28 | $ext:类库后缀,默认为.php -------------------------------------------------------------------------------- /theme/public/guestbook.md: -------------------------------------------------------------------------------- 1 | # 添加留言控件 2 | 3 | 在模板中加入以下代码: 4 | 5 | ```html 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | {:sp_verifycode_img('length=4&font_size=20&width=238&height=34&font_color=&background=','style="cursor: pointer;vertical-align:top;" title="点击获取"')} 16 | 17 |
18 | ``` 19 | -------------------------------------------------------------------------------- /theme/public/link.md: -------------------------------------------------------------------------------- 1 | # 友情链接制作 2 | ```php 3 | sp_getlinks(); 4 | ``` 5 | ######功能: 6 | 获取所有友情连接 7 | 8 | ######参数: 9 | 无 10 | 11 | ######返回 12 | 数组,友情链接列表 13 | 14 | ######示例: 15 | ```php 16 | $links=sp_getlinks(); /*获取友情链接*/ 17 | print_r($links); /*打印出获取的结果*/ 18 | ``` 19 | 20 | ######模板中用法: 21 | ```php 22 | 23 | $links=sp_getlinks(); 24 | 25 | 26 | {$vo.link_url} 27 | {$vo.link_name} 28 | {$vo.link_image} 29 | {$vo.link_target} 30 | {$vo.link_description} 31 | 32 | /*常见用法*/ 33 | 34 | 35 | 36 | 37 | {$vo.link_name} 38 | 39 | 40 | ``` 41 | -------------------------------------------------------------------------------- /view/theme.md: -------------------------------------------------------------------------------- 1 | # 模板定义 2 | 3 | 在 cmf中模板就是一个 html 文件,可分为前台模板文件和后台模板文件; 4 | 5 | 前台模板位于 `themes` 目录下,后台模板位于 `admin/themes` 目录下,前后台都是多主题机制的,可以分开设置不同的主题; 6 | 7 | 前台默认模板是 `simplebootx`,以后也可能会换,我们先以这个为例; 8 | 9 | ![默认模板](../images/view_5695911cf31e7.png.jpg) 10 | 11 | 这是前台模板的结构;应用之间彼此分开,Portal目录下就对应的是application/Portal应用的模板文件; 12 | 13 | 一个模板文件大致路径是这样的:themes/主题名/应用名/控制器名/操作名+(.html) 或者 themes/主题名/应用名/自定义模板名+(.html),如:themes/simplebootx/User/Profile/password.html,themes/simplebootx/Portal/index.html; 14 | 15 | 16 | 后台默认模板也是simplebootx只是和前台的名字一样而已,实质它是后台主题; 17 | ![thinkcmf后台主题](../images/5695949f3e2f1.png.jpg) 18 | 19 | 和前台的模式基本一样,一个后台模板文件大致路径是这样的: admin/themes/主题名/应用名/控制器名/操作名+(.html) 或者 admin/themes/主题名/应用名/自定义模板名+(.html),如:admin/themes/simplebootx/Admin/Link/add.html; 20 | 21 | 『themes/主题名/应用名』和『admin/themes/主题名/应用名』这一部分基本是固定的,开发者最好不要去修改,也最好不要跨应用调用模板,这会让结构很乱,不方便维护; 22 | 23 | 应用名以后的部分,开发者可以用控制器的display方法指定模板的具体文件名,display用法我们在模板渲染部分会详细说明; -------------------------------------------------------------------------------- /portal/functions/sp_get_child_terms.md: -------------------------------------------------------------------------------- 1 | # sp_get_child_terms() 2 | 3 | ```php 4 | sp_get_child_terms($term_id) 5 | ``` 6 | 功能: 7 | 返回指定分类下的子分类 8 | 9 | 参数: 10 | `$term_id`:分类id 11 | 12 | 返回: 13 | 类型数组,指定分类下的子分类 14 | 15 | 示例: 16 | ```php 17 | 22 | ``` 23 | 返回数组item说明: 24 | `term_id`:分类id 25 | `name`:分类名称 26 | `taxonomy`:分类的类型,用字符串表示,article表示文章 27 | `description`:分类描述 28 | `parent`:分类父级id,terms表中的term_id 29 | `seo_title` 30 | `seo_keywords` 31 | `seo_description` 32 | `list_tpl`:分类列表页的模板,对应于模板目录下Portal/文件名+.html,文件名默认为list 33 | `one_tpl`: 分类单文章页的模板,对应于模板目录下Portal/文件名+.html,文件名默认为article 34 | 35 | 模板中用法: 36 | ```php 37 | 38 | $term_id=1; 39 | $terms=sp_get_child_terms($term_id ); //获取子分类信息 40 | 41 | 42 | {$vo.name} 43 | 44 | 45 | ``` -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-ad/plugin.js: -------------------------------------------------------------------------------- 1 | require([ 2 | "gitbook", 3 | "jQuery" 4 | ], function(gitbook, $) { 5 | var conf = {} 6 | 7 | function insert() { 8 | var ad = conf.ad || {} 9 | 10 | $.each(['Top', 'Bottom'], function(i, position) { 11 | var content = ad['content' + position] 12 | 13 | if(content) { 14 | var append = position === 'Top' ? 'prependTo' : 'appendTo', 15 | positionLower = position.toLowerCase() 16 | container = $('.book-body .page-inner .page-inner-' + positionLower) 17 | 18 | if(!container.length) { 19 | container = $('
')[append]($(".book-body .page-inner")) 20 | } 21 | 22 | container.html(unescape(content)) 23 | } 24 | }) 25 | } 26 | 27 | gitbook.events.bind("start", function(e, config) { 28 | conf = config || {} 29 | }) 30 | gitbook.events.bind("page.change", insert) 31 | }) 32 | -------------------------------------------------------------------------------- /plugin/model.md: -------------------------------------------------------------------------------- 1 | # 插件数据库模型 2 | 创建插件自定义模型 3 | ```php 4 | test();//调用自定义模型PluginDemo里的test方法 30 | 31 | $users_model=D("Users");//实例化Common模块下的Users模型 32 | //$users_model=D("Common/Users");//也可以这样实例化Common模块下的Users模型 33 | $users=$users_model->limit(0,5)->select(); 34 | 35 | print_r($users); 36 | ``` -------------------------------------------------------------------------------- /plugin/admin_controller.md: -------------------------------------------------------------------------------- 1 | # 插件后台管理控制器 2 | 3 | 1. 在插件类主文件里加has_admin为1的属性; 4 | 5 | 2. 默认后台管理控制器AdminIndex,默认方法index,不可更改 6 | 7 | 3. sp_get_current_admin_id();可获取后台管理员id,可用于判断是否登录 8 | 9 | ```php 10 | assign("adminid",$adminid); 20 | }else{ 21 | //TODO no login 22 | } 23 | } 24 | 25 | function index(){ 26 | //$plugin_demo_model=D("plugins://Demo/PluginDemo");//实例化自定义模型PluginDemo ,需要创建plugin_demo表 27 | //$plugin_demo_model->test();//调用自定义模型PluginDemo里的test方法 28 | 29 | $users_model=D("Users");//实例化Common模块下的Users模型 30 | //$users_model=D("Common/Users");//也可以这样实例化Common模块下的Users模型 31 | $users=$users_model->limit(0,5)->select(); 32 | 33 | $this->assign("users",$users); 34 | $this->display(":admin_index"); 35 | } 36 | 37 | }``` -------------------------------------------------------------------------------- /functions/sp_getslide.md: -------------------------------------------------------------------------------- 1 | # sp_getslide() 2 | ```php 3 | sp_getslide($slide,$limit=5,$order = "listorder ASC") 4 | ``` 5 | ######功能: 6 | 根据幻灯片标识获取所有幻灯片 7 | 8 | ######参数: 9 | `$slide`:幻灯片标识,后台可以设置 10 | `$limit`:最多显示几张幻灯片 11 | `$order`:按什么字段(slide表的字段)排序 12 | 13 | ######返回 14 | 数组,符合条件的幻灯片列表 15 | 16 | ######示例: 17 | ```php 18 | $slides=sp_getslide('top_slide'); //top_slide是你在后台创建的幻灯片标识 19 | print_r($slides); //打印出获取的结果 20 | ``` 21 | 22 | 23 | ######模板中用法: 24 | ```php 25 | 26 | $slides=sp_getslide('top_slide'); 27 | print_r($slides); 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | ``` -------------------------------------------------------------------------------- /special/pagination.md: -------------------------------------------------------------------------------- 1 | 2 | # 利用Page类和limit方法分页 3 | 4 | ```php 5 | $Wxch_indent = M("Wxch_indent"); // 实例化Wxch_indent对象 6 | $count = $Wxch_indent->where($where)->count();// 查询满足要求的总记录数 7 | $Page = $this->Page($count,25);// 实例化分页类 传入总记录数和每页显示的记录数(25) 8 | $show = $Page->show("Admin");// 分页显示输出 9 | // 进行分页数据查询 注意limit方法的参数要使用Page类的属性 10 | $list = $Wxch_indent->where('1')->order('id desc') 11 | ->limit($Page->firstRow . ',' . $Page->listRows)->select(); 12 | $this->assign('list',$list);// 赋值数据集 13 | $this->assign('Page',$show);// 赋值分页输出 14 | $this->display(":index"); // 输出模板 15 | 带入查询条件 16 | $_GET = array_merge($_GET,$_POST);//分页带条件 17 | $count = $Wxch_indent->where($where)->count();// 查询满足要求的总记录数 18 | $Page = $this->Page($count,25);// 实例化分页类 传入总记录数和每页显示的记录数(25) 19 | $show = $Page->show("Admin");// 分页显示输出 20 | // 进行分页数据查询 注意limit方法的参数要使用Page类的属性 21 | $list = $Wxch_indent->where($where)->order('id desc') 22 | ->limit($Page->firstRow . ',' . $Page->listRows)->select(); 23 | ``` 24 | 25 | > 注意:$_GET会自己把查询的条件自动传进分页代码内 26 | 27 | 最后在视图就可以直接调用了 28 | ```html 29 |
{$Page}
30 | ``` 31 | 32 | -------------------------------------------------------------------------------- /functions/leuu.md: -------------------------------------------------------------------------------- 1 | # leuu()/UU() 2 | 3 | UU和leuu是ThinkCMF X1.2增加有url美化方法,两个用法完全一样,UU就是leuu的别名; 4 | 5 | 用法和U方法一样;对于需要美化的url要用到这个方法; 6 | 7 | 8 | 9 | leuu方法的定义规则如下(方括号内参数根据实际应用决定): 10 | 11 | ```php 12 | leuu('地址表达式',['参数'],['伪静态后缀'],['显示域名']) 13 | ``` 14 | 15 | 地址表达式的格式定义如下: 16 | ```php 17 | [应用/控制器/操作#锚点@域名]?参数1=值1&参数2=值2... 18 | leuu('portal/list/index',array('id'=>1)) 19 | ``` 20 | 21 | 22 | leuu方法要配置后台设置的url规则才能完成url的美化;如果没有相应规则,则和U方法生成的url一样; 23 | 24 | 25 | 26 | url的美化规则写法: 27 | 进入ThinkCMF后台 28 | 后台 设置->网站信息->URL美化 29 | 30 | 原始网址规则:应用名(小写)/控制器名/操作名?参数 如:portal/list/index?id=1 31 | 显示网址:英文字母加数字,不带后缀; 32 | 33 | 列出常用的优化方案: 34 | ``` 35 | portal/list/index?id=1 news http://demo.thinkcmf.com/news.html 36 | portal/list/index?id=2 discovery http://demo.thinkcmf.com/discovery.html 37 | portal/page/index?id=2 contacts http://demo.thinkcmf.com/contacts.html 38 | portal/page/index?id=14 about http://demo.thinkcmf.com/about.html 39 | portal/article/index article/:id\d http://demo.thinkcmf.com/article/1.html 40 | portal/list/index list/:id\d http://demo.thinkcmf.com/list/1.html 41 | ``` 42 | 43 | ![](../images/54857e9f9b316.png) -------------------------------------------------------------------------------- /theme/js/js-ajax-form.md: -------------------------------------------------------------------------------- 1 | # js-ajax-form 2 | ajax表单组件 3 | ```html 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | {:sp_verifycode_img('length=4&font_size=15&width=100&height=35&charset=1234567890')} 14 | 15 | 16 |
17 | ``` 18 | 19 | 功能: 20 | 21 | 加上类名为 js-ajax-form 的 form标签,配合类名为 js-ajax-submit 的提交按钮,在用户单击提交按钮时,会以 ajax 的方式提交表单,提交的地址为 form 的 action属性,提交方法为 form的 method 属性,凡是在 此form 里且有 name 属性的表单元素都会被提交; 22 | 23 | 提交成功返回后,如果返回结果中有 referer 字段,页面会跳转到 referer 表示的地址。如果 没有referer 或者其为空,则会刷新当前页,或者等待一定时间(data-wait的值,单位 ms) 24 | 25 | 后,再刷新当前页。 26 | -------------------------------------------------------------------------------- /app.md: -------------------------------------------------------------------------------- 1 | # 应用 2 | 3 | 应用就是`application`目录下的一个模块,它是独立于其它模块存在的,有自己独立的运行空间; 4 | 5 | 应用采用MVC的结构: 6 | 7 | 拿Blog应用举例: 8 | 9 | ``` 10 | Blog 11 | Controller 控制器目录(必备) 12 | Common 函数库(可选) 13 | Conf 配置(可选) 14 | Lang 多语言包(可选) 15 | Menu 后台菜单(可选) 16 | Model 模型(可选) 17 | nav.php 前台导航文件(可选) 18 | ``` 19 | 20 | 而在 CMF 中应用的 View 是独立于应用之外的,它分为前台view 和后台view, 分别存放在 `themes/前台主题/应用名`,和 `admin/themes/后台主题/应用名`下; 21 | 22 | 创建一个Blog应用 23 | * 在`application/Common/Conf/config.php`文件`MODULE_ALLOW_LIST`数组里加上应用名Blog 24 | * 在`application`下创建上面讲到的`Blog`目录结构; 25 | * 创建一个控制器,在模块`Controller`目录下创建一个`IndexController.class.php`文件 26 | 27 | ```php 28 | 注意控制器的命名规范: 46 | > 47 | > 控制器类的命名方式是:控制器名(驼峰法,首字母大写)+Controller (如 IndexController); 48 | > 49 | > 控制器文件的命名方式是:类名+class.php(类文件后缀)(如 IndexController.class.php); 50 | 51 | -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-search/search.css: -------------------------------------------------------------------------------- 1 | /* 2 | This CSS only styled the search results section, not the search input 3 | It defines the basic interraction to hide content when displaying results, etc 4 | */ 5 | #book-search-results .search-results { 6 | display: none; 7 | } 8 | #book-search-results .search-results ul.search-results-list { 9 | list-style-type: none; 10 | padding-left: 0; 11 | } 12 | #book-search-results .search-results ul.search-results-list li { 13 | margin-bottom: 1.5rem; 14 | padding-bottom: 0.5rem; 15 | /* Highlight results */ 16 | } 17 | #book-search-results .search-results ul.search-results-list li p em { 18 | background-color: rgba(255, 220, 0, 0.4); 19 | font-style: normal; 20 | } 21 | #book-search-results .search-results .no-results { 22 | display: none; 23 | } 24 | #book-search-results.open .search-results { 25 | display: block; 26 | } 27 | #book-search-results.open .search-noresults { 28 | display: none; 29 | } 30 | #book-search-results.no-results .search-results .has-results { 31 | display: none; 32 | } 33 | #book-search-results.no-results .search-results .no-results { 34 | display: block; 35 | } 36 | -------------------------------------------------------------------------------- /base/install.md: -------------------------------------------------------------------------------- 1 | # 安装使用 2 | 3 | 上传你的代码,直接在浏览器中输入你的域名或IP(例如:`www.yourdomain.com`),安装程序会自动执行安装。期间系统会提醒你输入数据库信息以完成安装,安装完成后建议删除`application`目录下的`Install`。 4 | 5 | 安装完成,一定把 `data/conf/db.php` 文件做个备份!否则大神也救不了你! 6 | 7 | ThinkCMF目录结构: 8 | 9 | ``` 10 | |--admin /管理后台URL重定向目录,你可以将文件夹名改为任何你喜欢的 11 | |--themes /后台模板文件目录 12 | |--application /应用目录 13 | |--data /各类数据存放目录,包括缓存数据 14 | |--simplewind /核心包,无特殊情况请勿改动 15 | |--public /静态文件存放包,包含bootstrap资源 16 | |--themes /前台模板文件目录 17 | ``` 18 | 19 | application 目录结构: 20 | 21 | ``` 22 | |--application 23 | |--Admin /后台管理应用 24 | |--Api /公共接口 25 | |--Asset /资源管理应用 26 | |--Comment /评论应用 27 | |--Common /应用公共模块 28 | |--Portal /门户应用 29 | ``` 30 | 31 | 应用的目录结构规范: 32 | 33 | 举例应用Portal 34 | 35 | ``` 36 | |--Portal 37 | |--Controller /必须目录,存放应用的操作模块如:/IndexController.class.php 38 | |--Conf /可选,应用配置文件存放目录,如应用无配置文件则不需要 39 | |--Common /可选,应用函数库,如无则不需要 40 | ``` 41 | 42 | -------------------------------------------------------------------------------- /theme/base/multi_lang.md: -------------------------------------------------------------------------------- 1 | # 前台模板多语言 2 | 3 | ThinkCMF前台模板多语言是使用多模板的方式来实现的,如:当前模板是`simplebootx`,如果想开启英文前台模板的话,就只要加一个模板名为 `simplebootx_en-us`模板就可以了; 4 | 5 | 6 | ### 前台模板多语言实现原理: 7 | 8 | ThinkCMF在前台控制器加载模板文件时,会根据当前用户的浏览器语言或者用户指定的语言来加载模板文件,如果是中文用户就加载 simplebootx 里的模板文件,如果是英文用户就加载 simplebootx_en-us 里的模板文件;每个模板里数据调用是独立的,你可以在不同模板里做不同的配置,以调用不同的语言的内容; 9 | 10 | 11 | ### 为什么选用多模板形式实现前台多语言? 12 | 13 | 很多用户会疑问,这不是会增加维护的难度吗?为什么不用语言包的形式呢? 14 | 15 | 维护难度当然会增加,做一个模板和做两个模板是不一样的时间,但你想英文模板和中文模板无论从内容还风格都有可能会不同,一个模板,你要考虑很多布局上兼容的问题,同时,如果想对不同语言的用户做不同的体验上的界面设计,一个模板肯定无法满足,所以多模板形式才是前台多语言最好的选择,当然你在模板里也可以使用应用里设置的语言包. 16 | 17 | 18 | ### 多语言切换 19 | 只要在 url后带上`?l=语言包`,如`?l=en-us`,`?l=zh-cn` 20 | 21 | 22 | ### 例子 23 | 24 | 默认语言为zh-cn,可用根据需要开发多个语言包,如后台设置模板为simplebootx,在themes目录下simplebootx目录为zh-cn语言模板,simplebootx_en-us为en-us语言模板,simplebootx_zh-tw对应的就是zh-tw语言包,simplebootx_mobile则为移动版模板,移动模板+"_language"则为移动版对应语言包,如simplebootx有三个语言版本,则对应目录为 25 | y``` 26 | simplebootx // PC中文默认模板 27 | simplebootx_en-us // PC端zh-us语言模板 28 | simplebootx_zh-tw // PC端zh-tw语言模板 29 | simplebootx_mobile // 移动端中文默认模板 30 | simplebootx_mobile_en-us // 移动端en-us语言模板 31 | simplebootx_mobile_zh-tw // 移动端zh-tw语言模板 32 | ``` 33 | 34 | > 注:感谢[`@gai871013`](https://github.com/gai871013/cmfx_doc) 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /theme/public/register.md: -------------------------------------------------------------------------------- 1 | # 本站用户注册模板制作 2 | 3 | 模板文件:User/register.html 4 | ```html 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | {:sp_verifycode_img('length=4&font_size=15&width=100&height=35&charset=1234567890')} 21 | 22 | 23 |
24 | ``` -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ThinkCMF文档 2 | 3 | ThinkCMF是一款基于ThinkPHP+MySQL开发的中文内容管理框架。ThinkCMF提出灵活的应用机制,框架自身提供基础的管理功能,而开发者可以根据自身的需求以应用的形式进行扩展。每个应用都能独立的完成自己的任务,也可通过系统调用其他应用进行协同工作。在这种运行机制下,开发商城应用的用户无需关心开发SNS应用时如何工作的,但他们之间又可通过系统本身进行协调,大大的降低了开发成本和沟通成本。 4 | 5 | 此项目用于编写ThinkCMF完全开发手册,我们希望通过git,让更多对CMF感兴趣的朋友参与开发文档的完善。本文档使用MD格式文档编写,方便生成pdf,epub,mobi及html的发行版。我们会定期生成相应的格式。 6 | 7 | 在阅读本手册前请先仔细阅读ThinkPHP3.2.3完全开发手册http://www.kancloud.cn/manual/thinkphp/1678 8 | 9 | 在线阅读:[ThinkCMF文档](http://www.thinkcmf.com/docs/cmfx) 10 | 11 | ## 参加步骤 12 | 13 | 1. 在GitHub上 `fork` 到自己的仓库,如 `your_username/cmfx_doc`,然后 `clone` 到本地,并设置用户信息。 14 | 15 | ```bash 16 | $ git clone git@github.com:your_username/cmfx_doc.git 17 | $ cd cmfx_doc 18 | $ git config user.name "yourname" 19 | $ git config user.email "your email" 20 | ``` 21 | 22 | * 修改代码后提交,并推送到自己的仓库。 23 | 24 | ```bash 25 | $ #do some change on the content 26 | $ git commit -am "Fix issue #1: change helo to hello" 27 | $ git push 28 | ``` 29 | 30 | * 在 GitHub 网站上提交 pull request。 31 | 32 | * 定期使用项目仓库内容更新自己仓库内容。 33 | 34 | ```bash 35 | 36 | $ git remote add upstream https://github.com/your_username/cmfx_doc 37 | 38 | $ git fetch upstream 39 | 40 | $ git checkout master 41 | 42 | $ git rebase upstream/master 43 | 44 | $ git push -f origin master 45 | 46 | ``` 47 | -------------------------------------------------------------------------------- /lian_jie_shu_ju_ku.md: -------------------------------------------------------------------------------- 1 | # 连接数据库 2 | 3 | 一、全局配置定义 4 | ```php 5 | return array( 6 | 'DB_TYPE' => 'mysql', 7 | 'DB_HOST' => '127.0.0.1', 8 | 'DB_NAME' => 'thinkcmf', 9 | 'DB_USER' => 'root', 10 | 'DB_PWD' => 'root', 11 | 'DB_PORT' => '3306', 12 | 'DB_PREFIX' => 'cmf_', 13 | //密钥 14 | "AUTHCODE" => '2oF6v4m67BdQnfwMSf', 15 | //cookies 16 | "COOKIE_PREFIX" => '03a9uH_', 17 | ); 18 | ``` 19 | 如果我们已经在配置文件中配置了额外的数据库连接信息,例如: 20 | 21 | ```php 22 | return array( 23 | //数据库1 24 | 'DB_TYPE' => 'mysql', 25 | 'DB_HOST' => '127.0.0.1', 26 | 'DB_NAME' => 'thinkcmf', 27 | 'DB_USER' => 'root', 28 | 'DB_PWD' => 'root', 29 | 'DB_PORT' => '3306', 30 | 'DB_PREFIX' => 'cmf_', 31 | //密钥 32 | "AUTHCODE" => '2oF6v4m67BdQnfwMSf', 33 | //cookies 34 | "COOKIE_PREFIX" => '03a9uH_', 35 | //数据库2 36 | 'DB_CONFIG2' => array( 37 | 'db_type' => 'mysql', 38 | 'db_user' => 'root', 39 | 'db_pwd' => 'root', 40 | 'db_host' => '127.0.0.1', 41 | 'db_port' => '3306', 42 | 'db_name' => 'repast' 43 | ), 44 | ); 45 | ``` 46 | 二、实例化定义 47 | ```php 48 | $User = M('User','cmf_','DB_CONFIG2'); 49 | ``` 50 | 作者:小夏 -------------------------------------------------------------------------------- /plugin/class.md: -------------------------------------------------------------------------------- 1 | # 插件类主文件 2 | 3 | 插件类主文件 4 | 5 | 文件位于插件根目录 6 | 7 | 命名格式:插件名+Plugin.class.php 8 | 9 | ```php 10 | 17 | // +---------------------------------------------------------------------- 18 | namespace plugins\Demo;//Demo插件英文名,改成你的插件英文就行了 19 | use Common\Lib\Plugin; 20 | 21 | /** 22 | * Demo 23 | */ 24 | class DemoPlugin extends Plugin{//Demo插件英文名,改成你的插件英文就行了 25 | 26 | public $info = array( 27 | 'name'=>'Demo',//Demo插件英文名,改成你的插件英文就行了 28 | 'title'=>'插件演示', 29 | 'description'=>'插件演示', 30 | 'status'=>1, 31 | 'author'=>'ThinkCMF', 32 | 'version'=>'1.0' 33 | ); 34 | 35 | public $has_admin=1;//插件是否有后台管理界面 36 | 37 | public function install(){//安装方法必须实现 38 | return true;//安装成功返回true,失败false 39 | } 40 | 41 | public function uninstall(){//卸载方法必须实现 42 | return true;//卸载成功返回true,失败false 43 | } 44 | 45 | //实现的footer钩子方法 46 | public function footer($param){ 47 | $config=$this->getConfig(); 48 | $this->assign($config); 49 | $this->display('widget'); 50 | } 51 | } 52 | ``` -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-search/search-engine.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'gitbook', 3 | 'jquery' 4 | ], function(gitbook, $) { 5 | // Global search objects 6 | var engine = null; 7 | var initialized = false; 8 | 9 | // Set a new search engine 10 | function setEngine(Engine, config) { 11 | initialized = false; 12 | engine = new Engine(config); 13 | 14 | init(config); 15 | } 16 | 17 | // Initialize search engine with config 18 | function init(config) { 19 | if (!engine) throw new Error('No engine set for research. Set an engine using gitbook.research.setEngine(Engine).'); 20 | 21 | return engine.init(config) 22 | .then(function() { 23 | initialized = true; 24 | gitbook.events.trigger('search.ready'); 25 | }); 26 | } 27 | 28 | // Launch search for query q 29 | function query(q, offset, length) { 30 | if (!initialized) throw new Error('Search has not been initialized'); 31 | return engine.search(q, offset, length); 32 | } 33 | 34 | // Get stats about search 35 | function getEngine() { 36 | return engine? engine.name : null; 37 | } 38 | 39 | function isInitialized() { 40 | return initialized; 41 | } 42 | 43 | // Initialize gitbook.search 44 | gitbook.search = { 45 | setEngine: setEngine, 46 | getEngine: getEngine, 47 | query: query, 48 | isInitialized: isInitialized 49 | }; 50 | }); -------------------------------------------------------------------------------- /plugin/config.md: -------------------------------------------------------------------------------- 1 | # 插件配置文件 2 | 3 | 插件配置文件是插件目录下的config.php,不需要配置的插件可以不添加此文件; 4 | 5 | 文件结构: 6 | 7 | ```php 8 | return array ( 9 | 'text' => array (// 在后台插件配置表单中的键名 ,会是config[text] 10 | 'title' => '文本:', // 表单的label标题 11 | 'type' => 'text',// 表单的类型:text,password,textarea,checkbox,radio,select等 12 | 'value' => 'hello,ThinkCMF!',// 表单的默认值 13 | 'tip' => '这是文本组件的演示' //表单的帮助提示 14 | ), 15 | 'password' => array (// 在后台插件配置表单中的键名 ,会是config[password] 16 | 'title' => '密码:', 17 | 'type' => 'password', 18 | 'value' => '', 19 | 'tip' => '这是密码组件' 20 | ), 21 | 'select' => array (// 在后台插件配置表单中的键名 ,会是config[select] 22 | 'title' => '下拉列表:', 23 | 'type' => 'select', 24 | 'options' => array (//select 和radio,checkbox的子选项 25 | '1' => 'ThinkCMFX',// 值=>显示 26 | '2' => 'ThinkCMF', 27 | '3' => '跟猫玩糗事', 28 | '4' => '门户应用' 29 | ), 30 | 'value' => '1', 31 | 'tip' => '这是下拉列表组件' 32 | ), 33 | 'checkbox' => array ( 34 | 'title' => '多选框', 35 | 'type' => 'checkbox', 36 | 'options' => array ( 37 | '1' => 'genmaowan.com', 38 | '2' => 'www.thinkcmf.com' 39 | ), 40 | 'value' => 1, 41 | 'tip' => '这是多选框组件' 42 | ), 43 | 'radio' => array ( 44 | 'title' => '单选框', 45 | 'type' => 'radio', 46 | 'options' => array ( 47 | '1' => 'ThinkCMFX', 48 | '2' => 'ThinkCMF' 49 | ), 50 | 'value' => '1', 51 | 'tip' => '这是单选框组件' 52 | ), 53 | 'textarea' => array ( 54 | 'title' => '多行文本', 55 | 'type' => 'textarea', 56 | 'value' => '这里是你要填写的内容', 57 | 'tip' => '这是多行文本组件' 58 | ) 59 | ); ``` -------------------------------------------------------------------------------- /theme/base/assets_import.md: -------------------------------------------------------------------------------- 1 | # 模板资源文件引入 2 | 3 | 引入css文件: 4 | ```html 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | ``` 22 | 以上内容加在标签以前 23 | 24 | 25 | 引入js文件: 26 | ```html 27 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | ``` 47 | 以上内容加在``标签以前 -------------------------------------------------------------------------------- /theme/tag.md: -------------------------------------------------------------------------------- 1 | # 模板标签 2 | 3 | 作为内容管理框架,ThinkCMF允许app开发者自定义任意标签,ThinkCMF标签使用花括号作为定界符,如{$name}。 4 | 5 | ThinkCMF系统内置的标签有: 6 | 7 | ``用来在模板中执行php的代码,示例代码: 8 | ```html 9 | echo "这个是在模板中执行的php程序" 10 | ``` 11 | ``遍历标签,示例代码: 12 | ```html 13 | $title=array("简介","产品","新闻"); //遍历一个一维数组 14 | 15 |
16 | {$vo} 17 |
18 |
19 | 20 | //遍历一个二维数组 21 | $article = array 22 | ( 23 | "0"=>array 24 | ( 25 | "title"=>"title1", 26 | "content"=>"content1", 27 | "date"=>"date1", 28 | ), 29 | "1"=>array 30 | ( 31 | "title"=>"title2", 32 | "content"=>"content2", 33 | "date"=>"date2", 34 | ) 35 | ); 36 | 37 | 38 |
39 | {$vo.title} 40 |

{$vo.content}

41 |
42 |
43 | ``` 44 | ``按条件遍历,示例代码: 45 | ```html 46 | //遍历一个二维数组 47 | $article = array 48 | ( 49 | "0"=>array 50 | ( 51 | "title"=>"title1", 52 | "content"=>"content1", 53 | "date"=>"date1", 54 | ), 55 | "1"=>array 56 | ( 57 | "title"=>"title2", 58 | "content"=>"content2", 59 | "date"=>"date2", 60 | ) 61 | ); 62 | 63 | 64 |
65 | {$vo.title} 66 |

{$vo.content}

67 |
68 |
69 | ``` 70 | ``循环标签,实例代码: 71 | ```html 72 | 73 | 循环语句。。。 74 | 75 | ``` -------------------------------------------------------------------------------- /_book/theme/base/assets_import.md: -------------------------------------------------------------------------------- 1 | # 模板资源文件引入 2 | 3 | 引入css文件: 4 | ```html 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | ``` 22 | 以上内容加在标签以前 23 | 24 | 25 | 引入js文件: 26 | ```html 27 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | ``` 47 | 以上内容加在``标签以前 -------------------------------------------------------------------------------- /portal/functions/sp_get_terms.md: -------------------------------------------------------------------------------- 1 | # sp_get_terms() 2 | ```php 3 | sp_get_terms($tag) 4 | ``` 5 | 功能: 6 | 返回符合条件的所有分类 7 | 8 | 参数: 9 | `$tag`:查询标签,以字符串方式传入,例:"ids:1,2;field:term_id,name,description,seo_title;limit:0,8;order:path asc,listorder desc;where:term_id>0;" 10 | ``` 11 | ids:调用指定id的一个或多个数据,如 1,2,3 12 | field:调用terms表里的指定字段,如(term_id,name...) 默认全部,用*代表全部 13 | limit:数据条数,默认值为10,可以指定从第几条开始,如3,8(表示共调用8条,从第3条开始) 14 | order:排序方式,如:path desc,listorder asc; 15 | where:查询条件,字符串形式,和sql语句一样 16 | ``` 17 | 返回: 18 | 类型数组,符合条件的所有分类 19 | 20 | 示例: 21 | ```html 22 | 23 | $tag='ids:1,2;field:post_date,post_content;limit:10;order:post_date DESC;'; 24 | /* 25 | $tag规则:ids分类id,以逗号隔开;field需要取出的内容,默认取出所有信息;order排序方式,可根据任何取出的字段排序,默认为按发布时间排序。 26 | $tag这是一个格式化的字符串,这种方式最大的好处就是方便日后扩展,它格式如《field+冒号+field支持的值,以英文逗号隔开+分号》 27 | */ 28 | 29 | /*关于此函数的field: 30 | .它的可选值是: 31 | term_id 分类id 32 | name 分类名称 33 | taxonomy 分类的类型,用字符串表示,article表示文章 34 | description 分类描述 35 | parent 分类父级id,terms表中的term_id 36 | path 用于无限级分类的path,如0-1-29 37 | seo_title 38 | seo_keywords 39 | seo_description 40 | list_tpl 分类列表页的模板,对应于模板目录下Portal/文件名+.html,文件名默认为list 41 | one_tpl 分类单文章页的模板,对应于模板目录下Portal/文件名+.html,文件名默认为article 42 | listorder 分类排序 43 | status 分类状态0已回收,1正常 44 | */ 45 | $terms=sp_get_terms($tag); 46 | 47 | 48 | 49 | {$vo.name }
50 | {$vo.taxonomy }
51 | {$vo.seo_title }
52 | {$vo.seo_keywords }
53 | {$vo.seo_description}
54 | 55 |
56 | ``` 57 | -------------------------------------------------------------------------------- /portal/functions/sp_sql_posts.md: -------------------------------------------------------------------------------- 1 | # sp_sql_posts() 2 | ```php 3 | sp_sql_posts($tag,$where) 4 | ``` 5 | 6 | 功能: 7 | 查询文章列表,不做分页 8 | 9 | 参数: 10 | `$tag`:查询语句(见$tag规则) 11 | `$where`:查询条件,(暂只支持数组),格式和thinkphp where方法一样; 12 | 13 | 返回: 14 | array 文章列表 15 | 16 | 示例: 17 | ```php 18 | 24 | ``` 25 | `$tag`规则: 26 | 27 | cid 分类id; 28 | 29 | field 需要取出的内容,默认取出所有信息;order排序方式,可根据任何取出的字段排序,默认为按发布时间排序。 30 | ``` 31 | field可选参数: 32 | term_id 文章分类id 33 | post_author 文章作者id,后台管理员,对应于表users里的ID; 34 | post_keywords 35 | post_date 文章发布日期 格式2014-01-01 00:00:00 36 | post_content 文章内容 37 | post_title 文章标题 38 | post_excerpt 文章摘要 39 | post_modified 文章更新日期 格式2014-01-01 00:00:00 40 | smeta 文章扩展属性,以json格式保存,如属性thumb文章缩略图 41 | user_nicename 管理员昵称 42 | user_email 管理员邮箱 43 | ``` 44 | 模板中用法: 45 | ```html 46 | 47 | $posts=sp_sql_posts('cid:6;field:post_title,post_content;order:listorder asc'); 48 | 49 | 50 | /* 遍历数组 */ 51 | {$vo.term_id }
52 | {$vo.post_author }
53 | {$vo.post_keywords }
54 | {$vo.post_date }
55 | {$vo.post_content }
56 | {$vo.post_title }
57 | {$vo.post_excerpt }
58 | {$vo.post_modified}
59 | {$vo.user_nicename }
60 | {$vo.user_email }
61 | 62 | $smeta=json_decode($vo['smeta'],true);/* 把smeta转化成数组 */ 63 | 64 | 65 |
66 | ``` -------------------------------------------------------------------------------- /portal/template/wen_zhang_lie_biao_zhi_ding_gong_neng_zhi_zuo.md: -------------------------------------------------------------------------------- 1 | # 文章列表置顶功能制作 2 | 3 | 先在后台选择置顶功能 4 | 5 | ![](QQ截图20160411185412.png) 6 | 7 | 在模板的排序是用istop,post_modified降序 8 | ```php 9 |
10 | 11 | $lists = sp_sql_posts_paged("cid:$cat_id;order:istop desc , post_modified desc;",10); 12 | 13 | 14 | 15 | $smeta=json_decode($vo['smeta'], true); 16 | 17 | 18 |
19 |

{$vo.post_title}

20 |

{$vo.post_excerpt|msubstr=0,256}

21 |
22 |
23 | 30 |
31 | 查看更多 32 |
33 |
34 |
35 | 36 |
37 | ``` 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /model/instancing.md: -------------------------------------------------------------------------------- 1 | # 模型实例化 2 | 3 | **为方便框架的后续升级,thinkcmf与thinkphp框架模型操作方法完全一致。 4 | 所以这里是支持thinkphp原生的M方法和D方法来实例化模型;** 5 | 6 | 实例化模型的好处: 7 | 可以实现自动完成,自动校验功能。使用模型封装的方法。分离M层和C层; 8 | 9 | ## M方法: 10 | M(['模型名'],['数据表前缀'],['数据库连接信息']); 11 | ```php 12 | //实例化模型 13 | $User=M('User'); 14 | // 执行具体的数据操作 15 | $User->select(); 16 | ``` 17 | M方法仅支持基本的CURD操作;但是性能会较D方法高。 18 | *如果你的模型类有自己的业务逻辑,M方法是无法支持的,就算是你已经定义了具体的模型类,M方法实例化的时候是会直接忽略。* 19 | **M方法的特殊用法:** 20 | $model=M();//实例化空模型; 21 | 22 | $model->query('select * from cmf_user where id=1');//使用原生sql语句进行查询id为1的用户 23 | 24 | ## D方法: 25 | 假设当前模块为Home; 26 | D('User');D('Home/User');是一样的; 27 | 28 | 如果在Linux环境下面,一定要注意D方法实例化的时候的模型名称的大小写。 29 | D方法可以自动检测模型类,如果存在自定义的模型类,则实例化自定义模型类,如果不存在,则会实例化系统的\\Think\\Model基类,同时对于已实例化过的模型,不会重复实例化。 30 | D方法的参数就是模型的名称,并且和模型类的大小写定义是一致的,例如: 31 | 参数 实例化的模型文件 32 | User 对应的模型类文件的 \Home\\Model\\UserModel.class.php 33 | UserType 对应的模型类文件的 \\Home\\Model\\UserTypeModel.class.php 34 | 35 | 用法示例: 36 | ```php 37 | //实例化模型 38 | $User = D('User'); 39 | // 相当于 $User = new \\Home\\Model\\UserModel(); 40 | // 执行具体的数据操作 41 | $User->select(); 42 | //$User->diy_select();//diy_select方法是您在\\Home\\Model\\UserModel.class.php中自定义的方法。 43 | ``` 44 | 45 | *当 \\Home\\Model\\UserModel 类不存在的时候,D函数会尝试实例化公共模块下面的 \\Common\\Model\\UserModel 类* 46 | D方法还可以支持跨模块调用,需要使用: 47 | ```php 48 | //实例化Admin模块的User模型 49 | D('Admin/User'); 50 | //实例化Extend扩展命名空间下的Info模型 51 | D('Extend://Editor/Info'); 52 | ``` 53 | 54 | *注意:跨模块实例化模型类的时候 不支持自动加载公共模块的模型类* 55 | 56 | #### M方法和D方法的区别 57 | 1. M方法不用加载具体模型类效率更高。但仅能实现基础的CURD; 58 | 2. D方法会先实例化具体的模型类,找不到后自动调用M方法来实例化模型类 59 | 60 | 61 | *名词解释* 62 | 1. CURD(Create,Update,Read,Delete),数据库的增删查改操作 63 | 64 | *参考文献:* 65 | 1. http://www.kancloud.cn/manual/thinkphp/1729 66 | -------------------------------------------------------------------------------- /theme/public/nav.md: -------------------------------------------------------------------------------- 1 | # 菜单导航制作 2 | 3 | ```php 4 | sp_get_menu($id,$menu_root_ul_id,$filetpl,$foldertpl,$ul_class,$li_class,$menu_root_ul_class,$showlevel,$dropdown) 5 | ``` 6 | 7 | ######功能: 8 | 生成指定ID的导航 9 | 10 | ######参数: 11 | `$id`:导航id 12 | `$menu_root_ul_id`:菜单根节点ul标签的id属性值 13 | `$filetpl`:没有子菜单的菜单的html模板 14 | `$foldertpl`:有子菜单的菜单的html模板 15 | `$ul_class`:内部ul标签的class属性值 16 | `$li_class`:内部li标签的class属性值 17 | `$menu_root_ul_class`:菜单根节点ul标签的class属性值 18 | `$showlevel`:菜单根节点ul标签的class属性值 19 | `$dropdown`:含有子菜单的li标签的class属性值,用于控制多级菜单的折叠 20 | 21 | 22 | 模板中用法: 23 | 24 | ```php 25 | 26 | $menu_root_ul_id="main-menu"; 27 | $filetpl="\$label"; 28 | $foldertpl="\$label"; 29 | $ul_class="dropdown-menu" ;/*内部ul标签的class属性值*/ 30 | $li_class="" ;/*内部li标签的class属性值*/ 31 | $menu_root_ul_class="nav";/*菜单根节点ul标签的class属性值*/ 32 | $showlevel=6;/*显示菜单的层级*/ 33 | $dropdown='dropdown';/*含有子菜单的li标签的class属性值,用于控制多级菜单的折叠*/ 34 | 35 | 36 | {:sp_get_menu("main",$menu_root_ul_id,$filetpl,$foldertpl,$ul_class,$li_class,$menu_root_ul_class,$showlevel,$dropdown)} 37 | ``` 38 | 39 | ```php 40 | 41 | 53 | ``` 54 | -------------------------------------------------------------------------------- /functions/sp_get_menu.md: -------------------------------------------------------------------------------- 1 | # sp_get_menu() 2 | 3 | ```php 4 | sp_get_menu($id,$menu_root_ul_id,$filetpl,$foldertpl,$ul_class,$li_class,$menu_root_ul_class,$showlevel,$dropdown) 5 | ``` 6 | 7 | ######功能: 8 | 生成指定ID的导航 9 | 10 | ######参数: 11 | `$id`:导航id 12 | `$menu_root_ul_id`:菜单根节点ul标签的id属性值 13 | `$filetpl`:没有子菜单的菜单的html模板 14 | `$foldertpl`:有子菜单的菜单的html模板 15 | `$ul_class`:内部ul标签的class属性值 16 | `$li_class`:内部li标签的class属性值 17 | `$menu_root_ul_class`:菜单根节点ul标签的class属性值 18 | `$showlevel`:菜单根节点ul标签的class属性值 19 | `$dropdown`:含有子菜单的li标签的class属性值,用于控制多级菜单的折叠 20 | 21 | 22 | 模板中用法: 23 | 24 | ```php 25 | 26 | $menu_root_ul_id="main-menu"; 27 | $filetpl="\$label"; 28 | $foldertpl="\$label"; 29 | $ul_class="dropdown-menu" ;/*内部ul标签的class属性值*/ 30 | $li_class="" ;/*内部li标签的class属性值*/ 31 | $menu_root_ul_class="nav";/*菜单根节点ul标签的class属性值*/ 32 | $showlevel=6;/*显示菜单的层级*/ 33 | $dropdown='dropdown';/*含有子菜单的li标签的class属性值,用于控制多级菜单的折叠*/ 34 | 35 | 36 | {:sp_get_menu("main",$menu_root_ul_id,$filetpl,$foldertpl,$ul_class,$li_class,$menu_root_ul_class,$showlevel,$dropdown)} 37 | ``` 38 | 39 | ```php 40 | 41 | 53 | ``` 54 | -------------------------------------------------------------------------------- /portal/base/theme_structure.md: -------------------------------------------------------------------------------- 1 | # 模板结构 2 | ``` 3 | |--themes 4 | |--simplebootx //模板目录 5 | |--Comment 6 | |--comment.html //评论模板,{:Comments()}中会调用 7 | |--index.html //用户中心评论模板(链接:comment/comment/index) 8 | |--Portal 9 | |--404.html //错误模板 10 | |--article.html //默认文章页模板 11 | |--contact.html //联系我们页面模板,可以后台页面编辑里更改,只需写文件名contact 12 | |--index.html //首页模板 13 | |--list_masonry.html //文章列表页瀑布流模板 14 | |--list.html //文章列表页模板 15 | |--page.html //默认页面模板 16 | |--product.html //产品列表页模板,可以在后台分类编辑里设置列表页模板,只需写文件名product 17 | |--search.html //文章搜索页模板 18 | |--Public //模板公共资源目录 19 | |--User 20 | |--Profile 21 | |--avatar.html //头像编辑界面 22 | |--bang.html //第三方账号绑定界面 23 | |--edit.html //资料编辑界面 24 | |--password.html //密码修改界面 25 | |--active.html //用户激活模板 26 | |--center.html //用户中心模板 27 | |--disable.html //用户未激活,重发激活邮件模板 28 | |--favorite.html //我的收藏模板 29 | |--forgot_password.html //忘记密码模板 30 | |--index.html //用户主页,公开主页 31 | |--login.html //用户登录模板 32 | |--password_reset.html //密码重置模板 33 | |--register.html //用户注册模板 34 | |--config.html //模板配置文件 35 | |--jump.html //系统跳转页模板 36 | |--error.html //系统action错误模板 37 | |--succes.html //系统action操作成功模板 38 | ``` -------------------------------------------------------------------------------- /advanced/qiniu.md: -------------------------------------------------------------------------------- 1 | # 七牛图片处理 2 | 3 | 七牛提供了强大的图片处理功能,ThinkCMF内部提供了七牛良好的支持,只要在后台"文件存储"里进行简单的设置就可以把全站的图片上传七牛了,前台使用七牛的强大api就可以对图片进行各种处理,如放大缩小,缩略图,加水印等. 4 | 5 | ThinkCMF内部保存的文件路径是相对路径,假如你在七牛空间有个图片访问地址是`http://78re52.com1.z0.glb.clouddn.com/resource/gogopher.jpg`,那么你七牛空间的根目录就是`http://78re52.com1.z0.glb.clouddn.com/`,而在 CMF 的数据库里保存的是`resource/gogopher.jpg`,在前台模板你只要 sp_get_image_url()就可以获取到图片在七牛的访问地址了.具体用法如下: 6 | 7 | ```html 8 | 9 | 10 | ``` 11 | ![](http://78re52.com1.z0.glb.clouddn.com/resource/gogopher.jpg) 12 | 13 | > 使用七牛的api生成图片300x300的缩略图 14 | 15 | ```html 16 | 17 | ``` 18 | 19 | ![](http://78re52.com1.z0.glb.clouddn.com/resource/gogopher.jpg?imageView2/1/w/300/h/300) 20 | 21 | > 使用CMF标签生成七牛图片300x300的缩略图 22 | 23 | ```html 24 | 25 | ``` 26 | 27 | ![](http://78re52.com1.z0.glb.clouddn.com/resource/gogopher.jpg?imageView2/1/w/300/h/300) 28 | 29 | 所以图片处理的关键还是七牛的 api,ThinkCMF只是集成了七牛的用法,sp_get_image_url这个方法就是把数据库里存的相对图片路径转化为可以访问的路径; 30 | 31 | ```php 32 | sp_get_image_url($file,$style) 33 | ``` 34 | 35 | ##### 参数: 36 | 37 | `$file`:数据库中保存的图片路径,是相对路径; 38 | 39 | `$style`:图片显示样式,这个参数只在文件存储类型是七牛时才有用 40 | 41 | 在模板里显示一个400x300的图片缩略图 42 | ```html 43 | 44 | ``` 45 | 46 | 如果你想生成其它尺寸的图片,只要改变七牛 api 里的 `w`和`h`的大小就可以了! 47 | 48 | 这么牛的图片处理方式,只要把在cmf后台做一下设置就可以了,同时七牛也提供了免费的使用额度,对于流量小的企业站基本够用了,同时也保证了网站流畅性,ThinkCMF用户也可以享受ThinkCMF七牛专用优惠码,想再打个折就到[ThinkCMF官网首页](http://www.thinkcmf.com)找优惠码吧! 49 | 50 | -------------------------------------------------------------------------------- /url.md: -------------------------------------------------------------------------------- 1 | # URL生成 2 | 3 | **ThinkCMF遵循ThinkPHP的url生成方法:** 4 | 5 | U方法的定义规则如下(方括号内参数根据实际应用决定): 6 | 7 | U('地址表达式',['参数'],['伪静态后缀'],['是否显示域名']) 8 | 9 | ```php 10 | U('Blog/Index/index') // 生成Blog应用Index控制器的index操作的URL地址 11 | U('Portal/Article/index?id=1') // 生成Portal应用Article控制器的index操作 并且参数id为1的URL地址 12 | U('Portal/Article/index',array('id'=>1) // 生成Portal应用Article控制器的index操作 并且参数id为1的URL地址 13 | U('User/index') // 生成当前应用的User控制器的index操作的URL地址 14 | ``` 15 | 参数: 16 | U方法的第二个参数支持数组和字符串两种定义方式,如果只是字符串方式的参数可以在第一个参数中定义,例如: 17 | ```php 18 | U('Blog/Index/index',array('cat'=>1,'status'=>1)) 19 | U('Blog/Index/index','cat=1&status=1') 20 | U('Blog/Index/index?cat=1&status=1') 21 | ``` 22 | 添加生成带域名的 url,只要把第四个参数设置为 true 23 | ```php 24 | U('Blog/Index/index','cat=1&status=1',true,true) 25 | ``` 26 | 27 | **leuu/UU方法:** 28 | 29 | 为了配合后台设置的 url 美化规则,cmf 增加了 leuu/UU两个方法,UU方法只是 leuu 的别名用法一样; 30 | leuu 的参数列表和 U 方法一样,只是要配合后台设置的 url美化规则才能生效,如没有规则,leuu 其实就是 U 方法; 31 | 32 | **url的美化规则设置:** 33 | 34 | 进入ThinkCMF后台,设置->网站信息->URL美化 35 | 36 | 原始网址规则:应用名(小写)/控制器名/操作名?参数 如:portal/list/index?id=1 37 | 显示网址:英文字母加数字,不带后缀; 38 | 39 | 如: 40 | 41 | 原始网址规则:portal/list/index?id=1 42 | 43 | 显示网址:cases 44 | 45 | ```php 46 | leuu("portal/list/index",array('id'=>1)) //生成的 url为/cases.html 47 | ``` 48 | 列出常用的优化方案: 49 | ```php 50 | portal/list/index?id=1 news http://demo.thinkcmf.com/news.html 51 | portal/list/index?id=2 discovery http://demo.thinkcmf.com/discovery.html 52 | portal/page/index?id=2 contacts http://demo.thinkcmf.com/contacts.html 53 | portal/page/index?id=14 about http://demo.thinkcmf.com/about.html 54 | portal/article/index article/:id\d http://demo.thinkcmf.com/article/1.html 55 | portal/list/index list/:id\d http://demo.thinkcmf.com/list/1.html 56 | ``` 57 | 注意:进行URL美化之后,要进入ThinkCMF后台,进行清除缓存操作后,刷新前台,才能看到美化效果。 -------------------------------------------------------------------------------- /book.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "ThinkCMFX完全开发手册", 3 | "description": "ThinkCMF是一款基于ThinkPHP+MYSQL开发的中文内容管理框架(CMF),我们一直秉承ThinkPHP大道至简的理念,坚持做最简约的ThinkPHP开源软件,多应用化开发方式,让您更快地完成自己的创业项目!", 4 | "language": "zh-hans", 5 | "plugins": [ 6 | "prism", 7 | "-highlight", 8 | "-sharing", 9 | "github", 10 | "editlink", 11 | "anchors", 12 | "ad", 13 | "tbfed-pagefooter", 14 | "sitemap", 15 | "duoshuo" 16 | 17 | ], 18 | "pluginsConfig": { 19 | "expandable-chapters": { 20 | }, 21 | "github": { 22 | "url": "https://github.com/thinkcmf/cmfx" 23 | }, 24 | "editlink": { 25 | "base": "https://github.com/thinkcmf/cmfx_doc/edit/master", 26 | "label": "发现错误? 现在编辑", 27 | "multilingual": false 28 | }, 29 | "baidu": { 30 | "token": "3bd0ecf189515ac893b73c6f7e9beaa8" 31 | }, 32 | "duoshuo": { 33 | "short_name": "thinkcmf", 34 | "theme": "default" 35 | }, 36 | "tbfed-pagefooter": { 37 | "copyright": "© ThinkCMF", 38 | "modify_label": "最后文件编辑时间:", 39 | "modify_format": "YYYY-MM-DD HH:mm:ss" 40 | }, 41 | "sitemap": { 42 | "hostname": "http://www.thinkcmf.com/" 43 | }, 44 | "prism": { 45 | "css": [ 46 | "prismjs/themes/prism-solarizedlight.css" 47 | ] 48 | }, 49 | "ad": { 50 | "contentTop": "", 51 | "contentBottom": "%3Cscript%3Evar%20_hmt%20%3D%20_hmt%20%7C%7C%20%5B%5D%3B%28function%28%29%20%7B%20%20var%20hm%20%3D%20document.createElement%28%22script%22%29%3B%20%20hm.src%20%3D%20%22//hm.baidu.com/hm.js%3F3bd0ecf189515ac893b73c6f7e9beaa8%22%3B%20%20var%20s%20%3D%20document.getElementsByTagName%28%22script%22%29%5B0%5D%3B%20%20%20s.parentNode.insertBefore%28hm%2C%20s%29%3B%7D%29%28%29%3B%3C/script%3E" 52 | 53 | } 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /portal/template/list.md: -------------------------------------------------------------------------------- 1 | # 文章列表页制作 2 | 可用变量 3 | ```php 4 | {$term_id}
5 | {$cat_id}
6 | {$name}
7 | {$taxonomy}
8 | {$description}
9 | {$parent}
10 | {$seo_title}
11 | {$seo_keywords}
12 | {$seo_description}
13 | {$list_tpl}
14 | {$one_tpl}
15 | ``` 16 | 17 | 例子: 18 | ```php 19 | 20 | $lists = sp_sql_posts_paged("cid:$cat_id;order:post_date DESC;",10); 21 | 22 | 23 | 24 | $smeta=json_decode($vo['smeta'], true); 25 | 26 | 27 |
28 |

{$vo.post_title}

29 |

{$vo.post_excerpt}

30 |
31 | 38 | 查看更多 39 |
40 |
41 |
42 | 43 | 48 | ``` -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-lunr/search-lunr.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'gitbook', 3 | 'jquery' 4 | ], function(gitbook, $) { 5 | // Define global search engine 6 | function LunrSearchEngine() { 7 | this.index = null; 8 | this.store = {}; 9 | this.name = 'LunrSearchEngine'; 10 | } 11 | 12 | // Initialize lunr by fetching the search index 13 | LunrSearchEngine.prototype.init = function() { 14 | var that = this; 15 | var d = $.Deferred(); 16 | 17 | $.getJSON(gitbook.state.basePath+'/search_index.json') 18 | .then(function(data) { 19 | // eslint-disable-next-line no-undef 20 | that.index = lunr.Index.load(data.index); 21 | that.store = data.store; 22 | d.resolve(); 23 | }); 24 | 25 | return d.promise(); 26 | }; 27 | 28 | // Search for a term and return results 29 | LunrSearchEngine.prototype.search = function(q, offset, length) { 30 | var that = this; 31 | var results = []; 32 | 33 | if (this.index) { 34 | results = $.map(this.index.search(q), function(result) { 35 | var doc = that.store[result.ref]; 36 | 37 | return { 38 | title: doc.title, 39 | url: doc.url, 40 | body: doc.summary || doc.body 41 | }; 42 | }); 43 | } 44 | 45 | return $.Deferred().resolve({ 46 | query: q, 47 | results: results.slice(0, length), 48 | count: results.length 49 | }).promise(); 50 | }; 51 | 52 | // Set gitbook research 53 | gitbook.events.bind('start', function(e, config) { 54 | var engine = gitbook.search.getEngine(); 55 | if (!engine) { 56 | gitbook.search.setEngine(LunrSearchEngine, config); 57 | } 58 | }); 59 | }); 60 | -------------------------------------------------------------------------------- /portal/template/wen_zhang_lie_biao_tui_jian_gong_neng_zhi_zuo.md: -------------------------------------------------------------------------------- 1 | # 文章列表推荐功能制作 2 | 3 | 在模版调用推荐功能:recommended,1推荐 0不推荐 4 | 5 | 我们在模板只要判断recommended等于1时给标题个样式变红就是推荐的文章 6 | 7 | ```php 8 |
9 |
10 | 11 | $lists = sp_sql_posts_paged("cid:$cat_id;order:istop desc , post_modified desc;",10); 12 | 13 | 14 | 15 | $smeta=json_decode($vo['smeta'], true); 16 | 17 | 18 |
19 | $recommended_style=$vo['recommended']==1?"color:red;":""; 20 |

{$vo.post_title}

21 |

{$vo.post_excerpt|msubstr=0,256}

22 |
23 |
24 | 31 |
32 | 查看更多 33 |
34 |
35 |
36 | 37 |
38 | 39 |
40 | ``` 41 | -------------------------------------------------------------------------------- /controller.md: -------------------------------------------------------------------------------- 1 | # 控制器 2 | 3 | ThinkCMF目前分为两种控制器,前台和后台控制器; 4 | 5 | 无论是前台,还是后台控制器都位于应用的Controller目录下. 6 | 前台控制器一般继承 `Common\Controller\HomebaseController`,如果你需要用户登录才访问或操作此控制器,就要继承 `Common\Controller\MemberbaseController`; 7 | 8 | 我们来创建一个前台控制器: 9 | 在Blog应用Controller目录下创建一个IndexController.class.php文件 10 | ```php 11 | 0;" 12 | ``` 13 | field:调用post指定字段,如(id,post_title...) 默认全部 14 | limit:数据条数,默认值为10,可以指定从第几条开始,如3,8(表示共调用8条,从第3条开始) 15 | order:排序方式,如:post_date desc 16 | where:查询条件,字符串形式,和sql语句一样 17 | $pagesize:每页显示文章数 18 | $pagetpl:分页模板,例:"{first}{prev}{liststart}{list}{listend}{next}{last}" 19 | ``` 20 | 21 | 返回: 22 | 类型数组,带分页数据的文章列表 23 | 24 | 示例: 25 | ```php 26 | 32 | ``` 33 | 34 | $tag规则: 35 | 36 | cid 分类id; 37 | 38 | field 需要取出的内容,默认取出所有信息;order排序方式,可根据任何取出的字段排序,默认为按发布时间排序。 39 | 40 | field可选参数: 41 | 42 | term_id 文章分类id 43 | 44 | post_author 文章作者id,后台管理员,对应于表users里的ID; 45 | 46 | post_keywords 47 | 48 | post_date 文章发布日期 格式2014-01-01 00:00:00 49 | 50 | post_content 文章内容 51 | 52 | post_title 文章标题 53 | 54 | post_excerpt 文章摘要 55 | 56 | post_modified 文章更新日期 格式2014-01-01 00:00:00 57 | 58 | smeta 文章扩展属性,以json格式保存,如属性thumb文章缩略图 59 | 60 | user_nicename 管理员昵称 61 | 62 | user_email 管理员邮箱 63 | 64 | 模板中用法: 65 | ```html 66 | 67 | $content=sp_sql_posts_paged('cid:6;field:post_title,post_content;order:listorder asc'); 68 | 69 | 70 | /* 遍历数组 */ 71 | {$vo.term_id }
72 | {$vo.post_author }
73 | {$vo.post_keywords }
74 | {$vo.post_date }
75 | {$vo.post_content }
76 | {$vo.post_title }
77 | {$vo.post_excerpt }
78 | {$vo.post_modified}
79 | {$vo.user_nicename }
80 | {$vo.user_email }
81 | 82 | $smeta=json_decode($vo['smeta'],true);/* 把smeta转化成数组 */ 83 | 84 | 85 |
86 | 87 |
{$content.page}
88 | ``` -------------------------------------------------------------------------------- /portal/functions/sp_sql_posts_paged_bycatid.md: -------------------------------------------------------------------------------- 1 | #sp_sql_posts_paged_bycatid() 2 | 3 | > X1.2新增 4 | 5 | ```php 6 | sp_sql_posts_paged_bycatid($cid,$tag,$pagesize,$pagetpl) 7 | ``` 8 | 9 | 功能: 10 | 根据分类文章分类ID 获取该分类下所有文章(包含子分类中文章),已经分页,调用方式同sp_sql_posts_paged 11 | 12 | 参数: 13 | `$cid`:分类id 14 | `$tag`:查询标签,以字符串方式传入,例:"field:post_title,post_content;limit:0,8;order:post_date desc,listorder desc;where:id>0;" 15 | ``` 16 | field:调用post指定字段,如(id,post_title...) 默认全部 17 | limit:数据条数,默认值为10,可以指定从第几条开始,如3,8(表示共调用8条,从第3条开始) 18 | order:排序方式,如:post_date desc 19 | where:查询条件,字符串形式,和sql语句一样 20 | $pagesize:每页显示文章数 21 | $pagetpl:分页模板,例:"{first}{prev}{liststart}{list}{listend}{next}{last}" 22 | ``` 23 | 24 | 返回: 25 | 类型数组,符合条件的文章列表,及分页html 26 | ```php 27 | array( 28 | 'content'=>'',//符合条件的文章列表 29 | 'page'=>''//分页html 30 | ) 31 | ``` 32 | 33 | 模板使用方法: 34 | ```html 35 |
36 | 37 | $result=sp_sql_posts_paged_bycatid($cat_id,"",20); 38 | 39 |
40 | 41 | 42 | 43 | $smeta=json_decode($vo['smeta'], true); 44 | 45 | 46 |
47 |

{$vo.post_title}

48 |

{$vo.post_excerpt}

49 |
50 |
51 | 58 |
59 | 查看更多 60 |
61 |
62 |
63 | 64 | 69 | ``` 70 | -------------------------------------------------------------------------------- /extends/application_flow.md: -------------------------------------------------------------------------------- 1 | # ThinkCMF应用开发流程 2 | 3 | 以下教程适用于ThinkCMFX系列版本 4 | 以Blog模块为例(相关问题已经更新) 5 | 1. 在application目录下创建Blog目录 6 | Blog结构: 7 | ```php 8 | Blog 9 | Controller 控制器目录 10 | Common 函数库 11 | Conf 配置 12 | Lang 多语言包 13 | Menu 后台菜单 14 | Model 模型 15 | nav.php 前台导航 16 | ``` 17 | ![](../images/20141209121334548676ee3afc8.png) 18 | Blog结构 19 | 同时在application/Common/Conf/config.php里的MODULE_ALLOW_LIST加上你新加的Blog 20 | 21 | 2. 创建一个前台控件器(Controller) 22 | 在模块Controller目录下创建一个IndexController.class.php文件 23 | ```php 24 | display(":index"); 45 | } 46 | } 47 | ``` 48 | * 在程序前台当前模板目录下创建Blog目录(假设当前模板是simplebootx,当前模板目录./themes/simplebootx) 49 | 在Blog目录下创建index.html文件 50 | 51 | 4. 在浏览器里运行http://你的域名/index.php?g=blog&m=index&a=index 52 | 到此为止,一个应用基本创建完成 53 | 54 | 5. 创建一个后台控件器(Controller)在模块Controller目录下创建一IndexadminController.class.php文件(注意:这里有文件命名规则,以\*\*\*\*adminController.class.php或者Admin\*\*\*\*Controller.class.php命名的是后台Controller, 在后台菜单导入时会自动识别) 55 | ```php 56 | display(); 64 | } 65 | } 66 | ``` 67 | 后台Controller一般都要继承AdminbaseController 68 | 登陆后台,在后台菜单管理添加一个后台菜单 69 | ![后台菜单添加.jpeg ](../images/565e8c0ad7253.jpg) 70 | 项目,模块,方法一一定要保证和程序代码里的大小写一致性 71 | 6. 创建index方法模板 72 | 在程序当前后台模板目录下创建`Blog`目录(当前后台模板为`simplebootx`,当前后台模板目录`admin/themes/simplebootx`) 73 | 创建Indexadmin/index.html(后台模板目录分隔符是自己可以在应用配置里自己定义的,`'TMPL_FILE_DEPR'=> '/'`,新建应用默认为/) 74 | 7. 刷新后台,点击在5步骤里添加的后台菜单 75 | 8. Blog应用开发流程完毕 -------------------------------------------------------------------------------- /portal/functions/sp_sql_posts_paged_bykeyword.md: -------------------------------------------------------------------------------- 1 | #sp_sql_posts_paged_bykeyword() 2 | 3 | > X1.2新增 4 | ```php 5 | sp_sql_posts_paged_bykeyword($keyword,$tag,$pagesize=20,$pagetpl) 6 | ``` 7 | 8 | 功能: 9 | 根据分类文章分类ID 获取该分类下所有文章(包含子分类中文章),已经分页,调用方式同sp_sql_posts_paged 10 | 11 | 参数: 12 | `$keyword`:查询关键字; 13 | `$tag`:查询标签,以字符串方式传入,例:"field:post_title,post_content;limit:0,8;order:post_date desc,listorder desc;where:id>0;" 14 | ``` 15 | field:调用post指定字段,如(id,post_title...) 默认全部 16 | limit:数据条数,默认值为10,可以指定从第几条开始,如3,8(表示共调用8条,从第3条开始) 17 | order:排序方式,如:post_date desc 18 | where:查询条件,字符串形式,和sql语句一样 19 | $pagesize:每页显示文章数 20 | $pagetpl:分页模板,例:"{first}{prev}{liststart}{list}{listend}{next}{last}" 21 | ``` 22 | 返回: 23 | 类型数组,符合条件的文章列表,文章总数及分页html 24 | ```php 25 | array( 26 | 'posts=>'',//符合条件的文章列表 27 | 'page'=>'',//分页html 28 | 'count'=>'',//符合条件的文章总数 29 | ) 30 | ``` 31 | 模板使用方法: 32 | ```html 33 |
34 | 35 | $result=sp_sql_posts_paged_bykeyword($keyword,"",20); 36 | 37 |

'{$keyword}' 搜索结果

38 |

{$result['count']}条结果

39 |
40 | 41 | 42 | 43 | $smeta=json_decode($vo['smeta'], true); 44 | 45 | 46 |
47 |

{$vo.post_title}

48 |

{$vo.post_excerpt}

49 |
50 |
51 | 58 |
59 | 查看更多 60 |
61 |
62 |
63 | 64 | 69 | ``` -------------------------------------------------------------------------------- /_book/portal/functions/sp_sql_posts_paged_bykeyword.md: -------------------------------------------------------------------------------- 1 | #sp_sql_posts_paged_bykeyword() 2 | 3 | > X1.2新增 4 | ```php 5 | sp_sql_posts_paged_bykeyword($keyword,$tag,$pagesize=20,$pagetpl) 6 | ``` 7 | 8 | 功能: 9 | 根据分类文章分类ID 获取该分类下所有文章(包含子分类中文章),已经分页,调用方式同sp_sql_posts_paged 10 | 11 | 参数: 12 | `$keyword`:查询关键字; 13 | `$tag`:查询标签,以字符串方式传入,例:"field:post_title,post_content;limit:0,8;order:post_date desc,listorder desc;where:id>0;" 14 | ``` 15 | field:调用post指定字段,如(id,post_title...) 默认全部 16 | limit:数据条数,默认值为10,可以指定从第几条开始,如3,8(表示共调用8条,从第3条开始) 17 | order:排序方式,如:post_date desc 18 | where:查询条件,字符串形式,和sql语句一样 19 | $pagesize:每页显示文章数 20 | $pagetpl:分页模板,例:"{first}{prev}{liststart}{list}{listend}{next}{last}" 21 | ``` 22 | 返回: 23 | 类型数组,符合条件的文章列表,文章总数及分页html 24 | ```php 25 | array( 26 | 'posts=>'',//符合条件的文章列表 27 | 'page'=>'',//分页html 28 | 'count'=>'',//符合条件的文章总数 29 | ) 30 | ``` 31 | 模板使用方法: 32 | ```html 33 |
34 | 35 | $result=sp_sql_posts_paged_bykeyword($keyword,"",20); 36 | 37 |

'{$keyword}' 搜索结果

38 |

{$result['count']}条结果

39 |
40 | 41 | 42 | 43 | $smeta=json_decode($vo['smeta'], true); 44 | 45 | 46 |
47 |

{$vo.post_title}

48 |

{$vo.post_excerpt}

49 |
50 |
51 | 58 |
59 | 查看更多 60 |
61 |
62 |
63 | 64 | 69 | ``` -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-prism/prism-tomorrow.css: -------------------------------------------------------------------------------- 1 | /** 2 | * prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML 3 | * Based on https://github.com/chriskempson/tomorrow-theme 4 | * @author Rose Pritchard 5 | */ 6 | 7 | code[class*="language-"], 8 | pre[class*="language-"] { 9 | color: #ccc; 10 | background: none; 11 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 12 | text-align: left; 13 | white-space: pre; 14 | word-spacing: normal; 15 | word-break: normal; 16 | word-wrap: normal; 17 | line-height: 1.5; 18 | 19 | -moz-tab-size: 4; 20 | -o-tab-size: 4; 21 | tab-size: 4; 22 | 23 | -webkit-hyphens: none; 24 | -moz-hyphens: none; 25 | -ms-hyphens: none; 26 | hyphens: none; 27 | 28 | } 29 | 30 | /* Code blocks */ 31 | pre[class*="language-"] { 32 | padding: 1em; 33 | margin: .5em 0; 34 | overflow: auto; 35 | } 36 | 37 | :not(pre) > code[class*="language-"], 38 | pre[class*="language-"] { 39 | background: #2d2d2d; 40 | } 41 | 42 | /* Inline code */ 43 | :not(pre) > code[class*="language-"] { 44 | padding: .1em; 45 | border-radius: .3em; 46 | white-space: normal; 47 | } 48 | 49 | .token.comment, 50 | .token.block-comment, 51 | .token.prolog, 52 | .token.doctype, 53 | .token.cdata { 54 | color: #999; 55 | } 56 | 57 | .token.punctuation { 58 | color: #ccc; 59 | } 60 | 61 | .token.tag, 62 | .token.attr-name, 63 | .token.namespace, 64 | .token.deleted { 65 | color: #e2777a; 66 | } 67 | 68 | .token.function-name { 69 | color: #6196cc; 70 | } 71 | 72 | .token.boolean, 73 | .token.number, 74 | .token.function { 75 | color: #f08d49; 76 | } 77 | 78 | .token.property, 79 | .token.class-name, 80 | .token.constant, 81 | .token.symbol { 82 | color: #f8c555; 83 | } 84 | 85 | .token.selector, 86 | .token.important, 87 | .token.atrule, 88 | .token.keyword, 89 | .token.builtin { 90 | color: #cc99cd; 91 | } 92 | 93 | .token.string, 94 | .token.char, 95 | .token.attr-value, 96 | .token.regex, 97 | .token.variable { 98 | color: #7ec699; 99 | } 100 | 101 | .token.operator, 102 | .token.entity, 103 | .token.url { 104 | color: #67cdcc; 105 | } 106 | 107 | .token.important, 108 | .token.bold { 109 | font-weight: bold; 110 | } 111 | .token.italic { 112 | font-style: italic; 113 | } 114 | 115 | .token.entity { 116 | cursor: help; 117 | } 118 | 119 | .token.inserted { 120 | color: green; 121 | } 122 | -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-prism/prism-okaidia.css: -------------------------------------------------------------------------------- 1 | /** 2 | * okaidia theme for JavaScript, CSS and HTML 3 | * Loosely based on Monokai textmate theme by http://www.monokai.nl/ 4 | * @author ocodia 5 | */ 6 | 7 | code[class*="language-"], 8 | pre[class*="language-"] { 9 | color: #f8f8f2; 10 | background: none; 11 | text-shadow: 0 1px rgba(0, 0, 0, 0.3); 12 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 13 | text-align: left; 14 | white-space: pre; 15 | word-spacing: normal; 16 | word-break: normal; 17 | word-wrap: normal; 18 | line-height: 1.5; 19 | 20 | -moz-tab-size: 4; 21 | -o-tab-size: 4; 22 | tab-size: 4; 23 | 24 | -webkit-hyphens: none; 25 | -moz-hyphens: none; 26 | -ms-hyphens: none; 27 | hyphens: none; 28 | } 29 | 30 | /* Code blocks */ 31 | pre[class*="language-"] { 32 | padding: 1em; 33 | margin: .5em 0; 34 | overflow: auto; 35 | border-radius: 0.3em; 36 | } 37 | 38 | :not(pre) > code[class*="language-"], 39 | pre[class*="language-"] { 40 | background: #272822; 41 | } 42 | 43 | /* Inline code */ 44 | :not(pre) > code[class*="language-"] { 45 | padding: .1em; 46 | border-radius: .3em; 47 | white-space: normal; 48 | } 49 | 50 | .token.comment, 51 | .token.prolog, 52 | .token.doctype, 53 | .token.cdata { 54 | color: slategray; 55 | } 56 | 57 | .token.punctuation { 58 | color: #f8f8f2; 59 | } 60 | 61 | .namespace { 62 | opacity: .7; 63 | } 64 | 65 | .token.property, 66 | .token.tag, 67 | .token.constant, 68 | .token.symbol, 69 | .token.deleted { 70 | color: #f92672; 71 | } 72 | 73 | .token.boolean, 74 | .token.number { 75 | color: #ae81ff; 76 | } 77 | 78 | .token.selector, 79 | .token.attr-name, 80 | .token.string, 81 | .token.char, 82 | .token.builtin, 83 | .token.inserted { 84 | color: #a6e22e; 85 | } 86 | 87 | .token.operator, 88 | .token.entity, 89 | .token.url, 90 | .language-css .token.string, 91 | .style .token.string, 92 | .token.variable { 93 | color: #f8f8f2; 94 | } 95 | 96 | .token.atrule, 97 | .token.attr-value, 98 | .token.function { 99 | color: #e6db74; 100 | } 101 | 102 | .token.keyword { 103 | color: #66d9ef; 104 | } 105 | 106 | .token.regex, 107 | .token.important { 108 | color: #fd971f; 109 | } 110 | 111 | .token.important, 112 | .token.bold { 113 | font-weight: bold; 114 | } 115 | .token.italic { 116 | font-style: italic; 117 | } 118 | 119 | .token.entity { 120 | cursor: help; 121 | } 122 | -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-prism/prism-funky.css: -------------------------------------------------------------------------------- 1 | /** 2 | * prism.js Funky theme 3 | * Based on “Polyfilling the gaps” talk slides http://lea.verou.me/polyfilling-the-gaps/ 4 | * @author Lea Verou 5 | */ 6 | 7 | code[class*="language-"], 8 | pre[class*="language-"] { 9 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 10 | text-align: left; 11 | white-space: pre; 12 | word-spacing: normal; 13 | word-break: normal; 14 | word-wrap: normal; 15 | line-height: 1.5; 16 | 17 | -moz-tab-size: 4; 18 | -o-tab-size: 4; 19 | tab-size: 4; 20 | 21 | -webkit-hyphens: none; 22 | -moz-hyphens: none; 23 | -ms-hyphens: none; 24 | hyphens: none; 25 | } 26 | 27 | /* Code blocks */ 28 | pre[class*="language-"] { 29 | padding: .4em .8em; 30 | margin: .5em 0; 31 | overflow: auto; 32 | background: url('data:image/svg+xml;charset=utf-8,%0D%0A%0D%0A%0D%0A<%2Fsvg>'); 33 | background-size: 1em 1em; 34 | } 35 | 36 | code[class*="language-"] { 37 | background: black; 38 | color: white; 39 | box-shadow: -.3em 0 0 .3em black, .3em 0 0 .3em black; 40 | } 41 | 42 | /* Inline code */ 43 | :not(pre) > code[class*="language-"] { 44 | padding: .2em; 45 | border-radius: .3em; 46 | box-shadow: none; 47 | white-space: normal; 48 | } 49 | 50 | .token.comment, 51 | .token.prolog, 52 | .token.doctype, 53 | .token.cdata { 54 | color: #aaa; 55 | } 56 | 57 | .token.punctuation { 58 | color: #999; 59 | } 60 | 61 | .namespace { 62 | opacity: .7; 63 | } 64 | 65 | .token.property, 66 | .token.tag, 67 | .token.boolean, 68 | .token.number, 69 | .token.constant, 70 | .token.symbol { 71 | color: #0cf; 72 | } 73 | 74 | .token.selector, 75 | .token.attr-name, 76 | .token.string, 77 | .token.char, 78 | .token.builtin { 79 | color: yellow; 80 | } 81 | 82 | .token.operator, 83 | .token.entity, 84 | .token.url, 85 | .language-css .token.string, 86 | .toke.variable, 87 | .token.inserted { 88 | color: yellowgreen; 89 | } 90 | 91 | .token.atrule, 92 | .token.attr-value, 93 | .token.keyword { 94 | color: deeppink; 95 | } 96 | 97 | .token.regex, 98 | .token.important { 99 | color: orange; 100 | } 101 | 102 | .token.important, 103 | .token.bold { 104 | font-weight: bold; 105 | } 106 | .token.italic { 107 | font-style: italic; 108 | } 109 | 110 | .token.entity { 111 | cursor: help; 112 | } 113 | 114 | .token.deleted { 115 | color: red; 116 | } 117 | -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-duoshuo/duoshuo.js: -------------------------------------------------------------------------------- 1 | require(["gitbook", "jQuery"], function(gitbook, $) { 2 | 3 | var root = (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]); 4 | 5 | var loadDuoshuoDynamic = function() { 6 | var stylesheetURL = getStylesheetURL(); 7 | injectStylesheet(stylesheetURL); 8 | 9 | var threadId = location.pathname.replace(/\//g,'-'); 10 | if (threadId.charAt(threadId.length - 1) == '-') { 11 | threadId = threadId + 'index.html'; 12 | } 13 | var duoshuoDiv = document.createElement('div'); 14 | duoshuoDiv.setAttribute('data-thread-key', threadId); 15 | duoshuoDiv.setAttribute('data-url', location.href); 16 | DUOSHUO.EmbedThread(duoshuoDiv); 17 | $(".book-body .page-inner").append('
'); 18 | $("#comment-box").append(duoshuoDiv); 19 | DUOSHUO.ThreadCount(duoshuoDiv ,{"type": "EmbedThread"}); 20 | }; 21 | 22 | var getStylesheetURL = function() { 23 | if (duoshuoQuery.stylesheet) { 24 | return duoshuoQuery.stylesheet; 25 | } 26 | var theme = duoshuoQuery.theme || DUOSHUO.theme || DUOSHUO.site.data.theme || "default"; 27 | if (theme === 'none') { 28 | return; 29 | } 30 | var staticPath = document.location.protocol + "//static.duoshuo.com"; 31 | var themeCode = { 32 | "default": "d6149e1c", 33 | "dark": "c11b5925", 34 | "bluebox": "dbc0a9af" 35 | }; 36 | return staticPath + "/styles/embed" + (theme ? "." + theme + ".css?" + themeCode[theme] : "." + duoshuoQuery.short_name) + ".css"; 37 | }; 38 | 39 | var injectStylesheet = function(url) { 40 | var styleNode = document.createElement("link"); 41 | styleNode.type = "text/css"; 42 | styleNode.rel = "stylesheet"; 43 | styleNode.href = url; 44 | root.appendChild(styleNode); 45 | }; 46 | 47 | var loadDuoshuoScript = function() { 48 | var ds = document.createElement('script'); 49 | ds.onload = loadDuoshuoDynamic; 50 | ds.type = 'text/javascript'; 51 | ds.async = true; 52 | ds.charset = 'UTF-8'; 53 | ds.src = document.location.protocol + '//static.duoshuo.com/embed.js'; 54 | root.appendChild(ds); 55 | }; 56 | 57 | gitbook.events.bind("start", function(e, config){ 58 | window.duoshuoQuery = config.duoshuo || {}; 59 | (document.location.protocol == 'https:') ? 'https:' : 'http:'; 60 | }); 61 | 62 | gitbook.events.bind("page.change", function(e){ 63 | loadDuoshuoScript(); 64 | }); 65 | 66 | }); 67 | -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-prism/prism-dark.css: -------------------------------------------------------------------------------- 1 | /** 2 | * prism.js Dark theme for JavaScript, CSS and HTML 3 | * Based on the slides of the talk “/Reg(exp){2}lained/” 4 | * @author Lea Verou 5 | */ 6 | 7 | code[class*="language-"], 8 | pre[class*="language-"] { 9 | color: white; 10 | background: none; 11 | text-shadow: 0 -.1em .2em black; 12 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 13 | text-align: left; 14 | white-space: pre; 15 | word-spacing: normal; 16 | word-break: normal; 17 | word-wrap: normal; 18 | line-height: 1.5; 19 | 20 | -moz-tab-size: 4; 21 | -o-tab-size: 4; 22 | tab-size: 4; 23 | 24 | -webkit-hyphens: none; 25 | -moz-hyphens: none; 26 | -ms-hyphens: none; 27 | hyphens: none; 28 | } 29 | 30 | @media print { 31 | code[class*="language-"], 32 | pre[class*="language-"] { 33 | text-shadow: none; 34 | } 35 | } 36 | 37 | pre[class*="language-"], 38 | :not(pre) > code[class*="language-"] { 39 | background: hsl(30, 20%, 25%); 40 | } 41 | 42 | /* Code blocks */ 43 | pre[class*="language-"] { 44 | padding: 1em; 45 | margin: .5em 0; 46 | overflow: auto; 47 | border: .3em solid hsl(30, 20%, 40%); 48 | border-radius: .5em; 49 | box-shadow: 1px 1px .5em black inset; 50 | } 51 | 52 | /* Inline code */ 53 | :not(pre) > code[class*="language-"] { 54 | padding: .15em .2em .05em; 55 | border-radius: .3em; 56 | border: .13em solid hsl(30, 20%, 40%); 57 | box-shadow: 1px 1px .3em -.1em black inset; 58 | white-space: normal; 59 | } 60 | 61 | .token.comment, 62 | .token.prolog, 63 | .token.doctype, 64 | .token.cdata { 65 | color: hsl(30, 20%, 50%); 66 | } 67 | 68 | .token.punctuation { 69 | opacity: .7; 70 | } 71 | 72 | .namespace { 73 | opacity: .7; 74 | } 75 | 76 | .token.property, 77 | .token.tag, 78 | .token.boolean, 79 | .token.number, 80 | .token.constant, 81 | .token.symbol { 82 | color: hsl(350, 40%, 70%); 83 | } 84 | 85 | .token.selector, 86 | .token.attr-name, 87 | .token.string, 88 | .token.char, 89 | .token.builtin, 90 | .token.inserted { 91 | color: hsl(75, 70%, 60%); 92 | } 93 | 94 | .token.operator, 95 | .token.entity, 96 | .token.url, 97 | .language-css .token.string, 98 | .style .token.string, 99 | .token.variable { 100 | color: hsl(40, 90%, 60%); 101 | } 102 | 103 | .token.atrule, 104 | .token.attr-value, 105 | .token.keyword { 106 | color: hsl(350, 40%, 70%); 107 | } 108 | 109 | .token.regex, 110 | .token.important { 111 | color: #e90; 112 | } 113 | 114 | .token.important, 115 | .token.bold { 116 | font-weight: bold; 117 | } 118 | .token.italic { 119 | font-style: italic; 120 | } 121 | 122 | .token.entity { 123 | cursor: help; 124 | } 125 | 126 | .token.deleted { 127 | color: red; 128 | } 129 | -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-prism/prism.css: -------------------------------------------------------------------------------- 1 | /** 2 | * prism.js default theme for JavaScript, CSS and HTML 3 | * Based on dabblet (http://dabblet.com) 4 | * @author Lea Verou 5 | */ 6 | 7 | code[class*="language-"], 8 | pre[class*="language-"] { 9 | color: black; 10 | background: none; 11 | text-shadow: 0 1px white; 12 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 13 | text-align: left; 14 | white-space: pre; 15 | word-spacing: normal; 16 | word-break: normal; 17 | word-wrap: normal; 18 | line-height: 1.5; 19 | 20 | -moz-tab-size: 4; 21 | -o-tab-size: 4; 22 | tab-size: 4; 23 | 24 | -webkit-hyphens: none; 25 | -moz-hyphens: none; 26 | -ms-hyphens: none; 27 | hyphens: none; 28 | } 29 | 30 | pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, 31 | code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { 32 | text-shadow: none; 33 | background: #b3d4fc; 34 | } 35 | 36 | pre[class*="language-"]::selection, pre[class*="language-"] ::selection, 37 | code[class*="language-"]::selection, code[class*="language-"] ::selection { 38 | text-shadow: none; 39 | background: #b3d4fc; 40 | } 41 | 42 | @media print { 43 | code[class*="language-"], 44 | pre[class*="language-"] { 45 | text-shadow: none; 46 | } 47 | } 48 | 49 | /* Code blocks */ 50 | pre[class*="language-"] { 51 | padding: 1em; 52 | margin: .5em 0; 53 | overflow: auto; 54 | } 55 | 56 | :not(pre) > code[class*="language-"], 57 | pre[class*="language-"] { 58 | background: #f5f2f0; 59 | } 60 | 61 | /* Inline code */ 62 | :not(pre) > code[class*="language-"] { 63 | padding: .1em; 64 | border-radius: .3em; 65 | white-space: normal; 66 | } 67 | 68 | .token.comment, 69 | .token.prolog, 70 | .token.doctype, 71 | .token.cdata { 72 | color: slategray; 73 | } 74 | 75 | .token.punctuation { 76 | color: #999; 77 | } 78 | 79 | .namespace { 80 | opacity: .7; 81 | } 82 | 83 | .token.property, 84 | .token.tag, 85 | .token.boolean, 86 | .token.number, 87 | .token.constant, 88 | .token.symbol, 89 | .token.deleted { 90 | color: #905; 91 | } 92 | 93 | .token.selector, 94 | .token.attr-name, 95 | .token.string, 96 | .token.char, 97 | .token.builtin, 98 | .token.inserted { 99 | color: #690; 100 | } 101 | 102 | .token.operator, 103 | .token.entity, 104 | .token.url, 105 | .language-css .token.string, 106 | .style .token.string { 107 | color: #a67f59; 108 | background: hsla(0, 0%, 100%, .5); 109 | } 110 | 111 | .token.atrule, 112 | .token.attr-value, 113 | .token.keyword { 114 | color: #07a; 115 | } 116 | 117 | .token.function { 118 | color: #DD4A68; 119 | } 120 | 121 | .token.regex, 122 | .token.important, 123 | .token.variable { 124 | color: #e90; 125 | } 126 | 127 | .token.important, 128 | .token.bold { 129 | font-weight: bold; 130 | } 131 | .token.italic { 132 | font-style: italic; 133 | } 134 | 135 | .token.entity { 136 | cursor: help; 137 | } 138 | -------------------------------------------------------------------------------- /special/multi_lang.md: -------------------------------------------------------------------------------- 1 | # 多语言开发 2 | 3 | ## 概述 4 | ThinkCMF已经默认开启了多语言的支持,后台以语言包形式实现多语言,前台以语言包和多模板的形式实现多语言. 5 | 6 | ######语言包 7 | ThinkCMF开启的语言有三个,分别是zh-cn,en-us,zh-tw,此项配置在application/Common/Conf/config.php配置文件下,可以通过更改`LANG_LIST`的值增加语言. 8 | 9 | 语言包分为框架核心语言包(在simplewind/Core/Lang目录下)和应用语言包(在每个应用的Lang目录下,如application/Portal/Lang),根据你设置的语言列表,在这些地方增加相应的语言包,就实现了多语言. 10 | 11 | 应用语言包具体位置说明: 12 | 13 | | 语言包 | 文件位置 | 加载时间| 14 | | ---------- | ------------- | ---------------| 15 | | 应用公共语言包 | application/Common/Lang/语言.php | 都加载 | 16 | | 应用语言包 | application/应用名/Lang/语言.php | 只在访问应用时加载| 17 | | 应用控制器语言包 | application/应用名/Lang/语言目录/语言.php| 只在访问控制器下方法时加载 18 | | 应用控制器后台菜单语言包| application/应用名/Lang/语言目录/admin_menu.php| 登录后台首页,和访问后台控制器时加载| 19 | 20 | ######语言文件定义 21 | 1.语言文件格式为PHP返回数组形式,如: 22 | ```php 23 | return array( 24 | 'ADMIN_CENTER' => 'Admin Center', 25 | 'WELCOME_USER' => 'Welcome, {$username}!', 26 | 'REFRESH_CURRENT_PAGE' => 'Refresh Current Page', 27 | 'WEBSITE_HOME_PAGE' => 'Website Home Page' 28 | ); 29 | ``` 30 | 2.也可以在代码中动态设置 31 | ```php 32 | L('ADMIN_CENTER','后台管理中心'); 33 | $lang_admin_center = L('ADMIN_CENTER'); 34 | ``` 35 | 36 | ######变量传入支持 37 | 1.在定义语言包时也支持变量,如: 38 | ```php 39 | return array( 40 | 'WELCOME_USER' => 'Welcome, {$username}!', 41 | ); 42 | ``` 43 | 2.在使用 L 方法获取时,可以传入$username 变量,如: 44 | ```php 45 | $lang_welcome_user = L('WELCOME_USER',array('username'=>'无敌小夏')); 46 | echo $lang_welcome_user; // 这里输出的字符串就是:Welcome,无敌小夏! 47 | ``` 48 | 49 | ######获取语言包设置的值 50 | 1.在PHP代码里使用 L 方法,如: 51 | ```php 52 | $lang_admin_center = L('ADMIN_CENTER'); 53 | echo $lang_admin_center; // 这里输出的值是:Admin Center 54 | ``` 55 | 2.在模板里使用 L 方法,如: 56 | ```php 57 | 58 | {:L('ADMIN_CENTER')} 59 | 60 | 61 | {:L('WELCOME_USER',array('username'=>'无敌小夏'))} 62 | ``` 63 | 64 | ### 前台模板多语言 65 | ThinkCMF前台模板多语言是使用多模板的方式来实现的,如:当前模板是`simplebootx`,如果想开启英文前台模板的话,就只要加一个模板名为 `simplebootx_en-us`模板就可以了; 66 | 67 | ###### 前台模板多语言实现原理: 68 | ThinkCMF在前台控制器加载模板文件时,会根据当前用户的浏览器语言或者用户指定的语言来加载模板文件,如果是中文用户就加载 simplebootx 里的模板文件,如果是英文用户就加载 simplebootx_en-us 里的模板文件;每个模板里数据调用是独立的,你可以在不同模板里做不同的配置,以调用不同的语言的内容; 69 | 70 | ###### 为什么选用多模板形式实现前台多语言? 71 | 很多用户会疑问,这不是会增加维护的难度吗?为什么不用语言包的形式呢? 72 | 维护难度当然会增加,做一个模板和做两个模板是不一样的时间,但你想英文模板和中文模板无论从内容还风格都有可能会不同,一个模板,你要考虑很多布局上兼容的问题,同时,如果想对不同语言的用户做不同的体验上的界面设计,一个模板肯定无法满足,所以多模板形式才是前台多语言最好的选择,当然你在模板里也可以使用应用里设置的语言包. 73 | 74 | ## 输出?l=en-us就可以打开语言切换 75 | 76 | 默认语言为zh-cn,可用根据需要开发多个语言包,如后台设置模板为simplebootx,在themes目录下simplebootx目录为zh-cn语言模板,simplebootx_en-us为en-us语言模板,simplebootx_zh-tw对应的就是zh-tw语言包,simplebootx_mobile则为移动版模板,移动模板+"_language"则为移动版对应语言包,如simplebootx有三个语言版本,则对应目录为 77 | 78 | ``` 79 | simplebootx // PC中文默认模板 80 | simplebootx_en-us // PC端zh-us语言模板 81 | simplebootx_zh-tw // PC端zh-tw语言模板 82 | simplebootx_mobile // 移动端中文默认模板 83 | simplebootx_mobile_en-us // 移动端en-us语言模板 84 | simplebootx_mobile_zh-tw // 移动端zh-tw语言模板 85 | ``` 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /portal/template/get_articles.md: -------------------------------------------------------------------------------- 1 | # 获取文章的各种方式 2 | ```php 3 | sp_sql_posts() 4 | ``` 5 | 示例: 6 | ```php 7 | 13 | ``` 14 | 15 | $tag规则: 16 | ```php 17 | cid 分类id; 18 | field 需要取出的内容,默认取出所有信息;order排序方式,可根据任何取出的字段排序,默认为按发布时间排序。 19 | field可选参数: 20 | term_id 文章分类id 21 | post_author 文章作者id,后台管理员,对应于表users里的ID 22 | post_keywords 文章关键词 23 | post_date 文章发布日期 格式2014-01-01 00:00:00 24 | post_content 文章内容 25 | post_title 文章标题 26 | post_excerpt 文章摘要 27 | post_modified 文章更新日期 格式2014-01-01 00:00:00 28 | smeta 文章扩展属性,以json格式保存,如属性thumb文章缩略图 29 | user_nicename 管理员昵称 30 | user_email 管理员邮箱 31 | ``` 32 | 33 | 34 | 模板中用法: 35 | ```php 36 | 37 | $posts=sp_sql_posts('cid:6;field:post_title,post_content;order:listorder asc'); 38 | 39 | 40 | /* 遍历数组 */ 41 | {$vo.term_id }
42 | {$vo.post_author }
43 | {$vo.post_keywords }
44 | {$vo.post_date }
45 | {$vo.post_content }
46 | {$vo.post_title }
47 | {$vo.post_excerpt }
48 | {$vo.post_modified}
49 | {$vo.user_nicename }
50 | {$vo.user_email }
51 | 52 | $smeta=json_decode($vo['smeta'],true);/* 把smeta转化成数组 */ 53 | 54 | 55 |
56 | ``` 57 | 58 | ```php 59 | sp_sql_posts_paged() 60 | ``` 61 | 示例: 62 | ```php 63 | 69 | ``` 70 | 71 | $tag规则: 72 | ```php 73 | cid 分类id; 74 | field 需要取出的内容,默认取出所有信息;order排序方式,可根据任何取出的字段排序,默认为按发布时间排序。 75 | field可选参数: 76 | term_id 文章分类id 77 | post_author 文章作者id,后台管理员,对应于表users里的ID 78 | post_keywords 文章关键词 79 | post_date 文章发布日期 格式2014-01-01 00:00:00 80 | post_content 文章内容 81 | post_title 文章标题 82 | post_excerpt 文章摘要 83 | post_modified 文章更新日期 格式2014-01-01 00:00:00 84 | smeta 文章扩展属性,以json格式保存,如属性thumb文章缩略图 85 | user_nicename 管理员昵称 86 | user_email 管理员邮箱 87 | ``` 88 | 89 | 90 | 模板中用法: 91 | ```php 92 | 93 | $content=sp_sql_posts_paged('cid:6;field:post_title,post_content;order:listorder asc'); 94 | 95 | 96 | /* 遍历数组 */ 97 | {$vo.term_id }
98 | {$vo.post_author }
99 | {$vo.post_keywords }
100 | {$vo.post_date }
101 | {$vo.post_content }
102 | {$vo.post_title }
103 | {$vo.post_excerpt }
104 | {$vo.post_modified}
105 | {$vo.user_nicename }
106 | {$vo.user_email }
107 | 108 | $smeta=json_decode($vo['smeta'],true);/* 把smeta转化成数组 */ 109 | 110 | 111 |
112 | 113 |
{$content.page}
114 | ``` -------------------------------------------------------------------------------- /special/verifycode.md: -------------------------------------------------------------------------------- 1 | # 验证码 2 | 3 | #### 1.生成验证码 4 | 5 | ######生成验证码的函数: 6 | ```php 7 | sp_verifycode_img($imgparam,$imgattrs); 8 | ``` 9 | 10 | ######参数: 11 | `$imgparam`:控制验证码的样式,(默认值length=4&font_size=20&width=238&height=50&use_curve=1&use_noise=1) 12 | 13 | `$imgattrs`:生成的验证码img标签的原生属性,除src,onclick之外都可以设置,(默认值:style="cursor: pointer;" title="点击获取") 14 | 15 | ######返回: 16 | 包括验证码的html代码 17 | 18 | ######模板里使用: 19 | 20 | ```php 21 | 22 | {:sp_verifycode_img('length=4&font_size=14&width=100&height=34&charset=2345678&use_noise=1&use_curve=0')} 23 | 24 | 25 | 26 | 27 | 28 | ``` 29 | ######一个带验证码的表单 30 | ```php 31 | 32 |

用户登录

33 |
34 |
35 | 36 |
37 | 38 |
39 | 40 |
41 | 42 |
43 |
44 |
45 | 46 |
47 |
48 | {:sp_verifycode_img('length=4&font_size=14&width=100&height=34&charset=2345678&use_noise=1&use_curve=0')} 49 |
50 |
51 | 52 |
53 | 54 |
55 | 56 | 57 |
58 | 59 |
60 | 64 |
65 |
66 | ``` 67 | ####2.验证码验证 68 | 69 | ######验证验证码的函数: 70 | ```php 71 | sp_check_verify_code($verifycode='') 72 | ``` 73 | 74 | ######参数 75 | `$verifycode`:要验证的验证码,默认空 76 | 77 | ######在控制器里使用 78 | 79 | ```php 80 | error("验证码错误!"); 102 | } 103 | 104 | //省略... 105 | } 106 | } 107 | ``` -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-prism/prism-solarizedlight.css: -------------------------------------------------------------------------------- 1 | /* 2 | Solarized Color Schemes originally by Ethan Schoonover 3 | http://ethanschoonover.com/solarized 4 | 5 | Ported for PrismJS by Hector Matos 6 | Website: https://krakendev.io 7 | Twitter Handle: https://twitter.com/allonsykraken) 8 | */ 9 | 10 | /* 11 | SOLARIZED HEX 12 | --------- ------- 13 | base03 #002b36 14 | base02 #073642 15 | base01 #586e75 16 | base00 #657b83 17 | base0 #839496 18 | base1 #93a1a1 19 | base2 #eee8d5 20 | base3 #fdf6e3 21 | yellow #b58900 22 | orange #cb4b16 23 | red #dc322f 24 | magenta #d33682 25 | violet #6c71c4 26 | blue #268bd2 27 | cyan #2aa198 28 | green #859900 29 | */ 30 | 31 | code[class*="language-"], 32 | pre[class*="language-"] { 33 | color: #657b83; /* base00 */ 34 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 35 | text-align: left; 36 | white-space: pre; 37 | word-spacing: normal; 38 | word-break: normal; 39 | word-wrap: normal; 40 | 41 | line-height: 1.5; 42 | 43 | -moz-tab-size: 4; 44 | -o-tab-size: 4; 45 | tab-size: 4; 46 | 47 | -webkit-hyphens: none; 48 | -moz-hyphens: none; 49 | -ms-hyphens: none; 50 | hyphens: none; 51 | } 52 | 53 | pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, 54 | code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { 55 | background: #073642; /* base02 */ 56 | } 57 | 58 | pre[class*="language-"]::selection, pre[class*="language-"] ::selection, 59 | code[class*="language-"]::selection, code[class*="language-"] ::selection { 60 | background: #073642; /* base02 */ 61 | } 62 | 63 | /* Code blocks */ 64 | pre[class*="language-"] { 65 | padding: 1em; 66 | margin: .5em 0; 67 | overflow: auto; 68 | border-radius: 0.3em; 69 | } 70 | 71 | :not(pre) > code[class*="language-"], 72 | pre[class*="language-"] { 73 | background-color: #fdf6e3; /* base3 */ 74 | } 75 | 76 | /* Inline code */ 77 | :not(pre) > code[class*="language-"] { 78 | padding: .1em; 79 | border-radius: .3em; 80 | } 81 | 82 | .token.comment, 83 | .token.prolog, 84 | .token.doctype, 85 | .token.cdata { 86 | color: #93a1a1; /* base1 */ 87 | } 88 | 89 | .token.punctuation { 90 | color: #586e75; /* base01 */ 91 | } 92 | 93 | .namespace { 94 | opacity: .7; 95 | } 96 | 97 | .token.property, 98 | .token.tag, 99 | .token.boolean, 100 | .token.number, 101 | .token.constant, 102 | .token.symbol, 103 | .token.deleted { 104 | color: #268bd2; /* blue */ 105 | } 106 | 107 | .token.selector, 108 | .token.attr-name, 109 | .token.string, 110 | .token.char, 111 | .token.builtin, 112 | .token.url, 113 | .token.inserted { 114 | color: #2aa198; /* cyan */ 115 | } 116 | 117 | .token.entity { 118 | color: #657b83; /* base00 */ 119 | background: #eee8d5; /* base2 */ 120 | } 121 | 122 | .token.atrule, 123 | .token.attr-value, 124 | .token.keyword { 125 | color: #859900; /* green */ 126 | } 127 | 128 | .token.function { 129 | color: #b58900; /* yellow */ 130 | } 131 | 132 | .token.regex, 133 | .token.important, 134 | .token.variable { 135 | color: #cb4b16; /* orange */ 136 | } 137 | 138 | .token.important, 139 | .token.bold { 140 | font-weight: bold; 141 | } 142 | .token.italic { 143 | font-style: italic; 144 | } 145 | 146 | .token.entity { 147 | cursor: help; 148 | } -------------------------------------------------------------------------------- /theme/public/comment.md: -------------------------------------------------------------------------------- 1 | # 评论组件 2 | 显示评论组件: 3 | ```php 4 | {:Comments("posts",$object_id)} 5 | 6 | ``` 7 | Comments方法说明: 8 | 9 | `参数1`:评论内容所在的表,不带表前缀的表名称,如cmf_posts应该改为“posts”; 10 | 11 | `参数2`:评论内容的id: 12 | 13 | `参数3`:数组,目前支持tpl参数,如array("tpl"=>"comment_custom"),这样设置就会加载模板目录Comment/coment_custom.html这个模板。 14 | 15 | 16 | 17 | 评论模板: 18 | 默认评论模板文件:Comment/comment.html 19 | ```html 20 |
21 |

评论

22 |
23 | 24 |
25 |
26 |
27 |
28 | 29 |
30 |
31 | 32 |
33 | 34 |
35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 54 | 55 | 63 | 64 | 65 |
66 |
67 | 68 |
69 | 70 | 71 | 72 |
73 |
{$vo.full_name}:{$vo.content}
74 |
{:date('m月d日 H:i',strtotime($vo['createtime']))}
75 | 76 | 77 | 78 |
79 | 80 | 81 | 82 |
83 | 84 |
{:date('m月d日 H:i',strtotime($voo['createtime']))}
85 |
86 |
87 |
88 |
89 | 90 |
91 | 92 | 93 |
94 |
95 |
96 |
97 |
98 | 99 |
100 | ``` 101 | -------------------------------------------------------------------------------- /model/definition.md: -------------------------------------------------------------------------------- 1 | # 模型定义 2 | 3 | **为方便框架的后续升级,thinkcmf与thinkphp框架模型定义方法完全一致。** 4 | *模型类并非必须定义,只有当存在独立的业务逻辑或者属性的时候才需要定义。* 5 | 6 | 模型类通常需要继承系统的\Think\Model类或其子类,下面是一个Home\Model\UserModel类的定义: 7 | 8 | ```php 9 | namespace Home\Model; 10 | use Think\Model; 11 | class UserModel extends Model { 12 | } 13 | 14 | ``` 15 | 模型类的作用大多数情况是操作数据表的,如果按照系统的规范来命名模型类的话,大多数情况下是可以自动对应数据表。 16 | 模型类的命名规则是除去表前缀的数据表名称,采用驼峰法命名,并且首字母大写,然后加上模型层的名称(默认定义是Model),例如: 17 | |模型名| 约定对应数据表(假设数据库的前缀定义是 cmf_)| 18 | |----|----| 19 | |UserModel| cmf_user| 20 | 如果你的规则和上面的系统约定不符合,那么需要设置Model类的数据表名称属性,以确保能够找到对应的数据表。 21 | 22 | 1. 数据表定义 23 | 在ThinkPHP的模型里面,有几个关于数据表名称的属性定义: 24 | 25 | |属性 |说明| 26 | |----|----| 27 | |tablePrefix |定义模型对应数据表的前缀,如果未定义则获取配置文件中的DB_PREFIX参数| 28 | |tableName |不包含表前缀的数据表名称,一般情况下默认和模型名称相同,只有当你的表名和当前的模型类的名称不同的时候才需要定义。| 29 | |trueTableName |包含前缀的数据表名称,也就是数据库中的实际表名,该名称无需设置,只有当上面的规则都不适用的情况或者特殊情况下才需要设置。| 30 | |dbName |定义模型当前对应的数据库名称,只有当你当前的模型类对应的数据库名称和配置文件不同的时候才需要定义。| 31 | 举个例子来加深理解,例如,在数据库里面有一个cmf_users表,而我们定义的模型类名称是UserModel,按照系统的约定,这个模型的名称是User,对应的数据表名称应该是cmf_user(全部小写),但是现在的数据表名称是cmf_users,因此我们就需要设置tableName属性来改变默认的规则(因为cmf程序默认已经在配置文件里面定义了DB_PREFIX 为 cmf_)。 32 | 33 | ```php 34 | namespace Home\Model; 35 | use Think\Model; 36 | class UserModel extends Model { 37 | protected $tableName = 'users'; 38 | } 39 | ``` 40 | 41 | 注意这个属性的定义不需要加表的前缀cmf_ 42 | 43 | 如果我们需要CategoryModel模型对应操作的数据表是 top_user,那么我们只需要设置数据表前缀即可: 44 | 45 | ```php 46 | 47 | namespace Home\Model; 48 | use Think\Model; 49 | class UserModel extends Model { 50 | protected $tablePrefix = 'top_'; 51 | } 52 | 53 | ``` 54 | 55 | 如果你的数据表直接就是user,而没有前缀,则可以设置tablePrefix为空字符串。 56 | 57 | ```php 58 | 59 | namespace Home\Model; 60 | use Think\Model; 61 | class UserModel extends Model { 62 | protected $tablePrefix = ''; 63 | } 64 | ``` 65 | 没有表前缀的情况必须设置,否则会获取当前配置文件中的 DB_PREFIX。 66 | 而对于另外一种特殊情况,我们需要操作的数据表是top_categories,这个时候我们就需要定义 trueTableName 属性 67 | 68 | 69 | ```php 70 | namespace Home\Model; 71 | use Think\Model; 72 | class CategoryModel extends Model { 73 | protected $trueTableName = 'top_categories'; 74 | } 75 | 76 | ``` 77 | 78 | 注意trueTableName需要完整的表名定义。 79 | 除了数据表的定义外,还可以对数据库进行定义(用于操作当前数据库以外的数据表),例如 top.top_categories: 80 | 81 | ```php 82 | namespace Home\Model; 83 | use Think\Model; 84 | class CategoryModel extends Model { 85 | protected $trueTableName = 'top_categories'; 86 | protected $dbName = 'top'; 87 | } 88 | 89 | ``` 90 | 91 | 系统的规则下,tableName会转换为小写定义,但是trueTableName定义的数据表名称是保持原样。因此,如果你的数据表名称需要区分大小写的情况,那么可以通过设置trueTableName定义来解决。 92 | 93 | 2. 这里谈下THINKPHP的自动验证和自动完成功能(thinkcmf也是完全一样的) 94 | 假设上文我们已经定义了Home\Model\UserModel.class.php 95 | 代码完善后如下: 96 | 97 | ```php 98 | namespace Home\Model; 99 | use Think\Model; 100 | class UserModel extends Model { 101 | //自动完成 102 | protected $_auto = array ( 103 | array('status','1'), // 新增的时候把status字段设置为1 104 | array('random_str','creat_str',1,'function'), // 新增时自动完成random_str 105 | ); 106 | //自动校验 107 | protected $_validate = array( 108 | array('verify','require','验证码必须!'), //默认情况下用正则进行验证 109 | array('name','','帐号名称已经存在!',0,'unique',1), // 在新增的时候验证name字段是否唯一 110 | array('value',array(1,2,3),'值的范围不正确!',2,'in'), // 当值不为空的时候判断是否在一个范围内 111 | array('name','check_name','密码格式不正确',0,'function'), // 自定义函数验证名称是否为admin 112 | ); 113 | 114 | /* 115 | *为自动校验定义的校验方法 检测名称是否为admin 116 | *@prama $name 名字 117 | */ 118 | function check_name($name){ 119 | return $name=='admin'?false:true; 120 | } 121 | /* 122 | *为自动完成定义的完成方法//创建随机字符串用来 123 | *@prama $length 随机字符串长度 124 | */ 125 | function creat_str($length=6){ 126 | return sp_random_string($length); 127 | } 128 | /* 129 | // 随机字符串生成 cmf自带函数; 130 | // @param int $len 生成的字符串长度 131 | // @return string 132 | 133 | function sp_random_string($len = 6) { 134 | $chars = array( 135 | "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", 136 | "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", 137 | "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", 138 | "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", 139 | "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", 140 | "3", "4", "5", "6", "7", "8", "9" 141 | ); 142 | $charsLen = count($chars) - 1; 143 | shuffle($chars); // 将数组打乱 144 | $output = ""; 145 | for ($i = 0; $i < $len; $i++) { 146 | $output .= $chars[mt_rand(0, $charsLen)]; 147 | } 148 | return $output; 149 | } 150 | */ 151 | } 152 | 153 | ``` 154 | 155 | *参考文献* 156 | 157 | 1. http://www.kancloud.cn/manual/thinkphp/1728 158 | 2. http://www.thinkcmf.com/topic/topic/index/id/432.html 159 | 160 | 文档问题联系[iwzh](http://github.com/iwzh) 161 | -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-prism/prism-twilight.css: -------------------------------------------------------------------------------- 1 | /** 2 | * prism.js Twilight theme 3 | * Based (more or less) on the Twilight theme originally of Textmate fame. 4 | * @author Remy Bach 5 | */ 6 | code[class*="language-"], 7 | pre[class*="language-"] { 8 | color: white; 9 | background: none; 10 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 11 | text-align: left; 12 | text-shadow: 0 -.1em .2em black; 13 | white-space: pre; 14 | word-spacing: normal; 15 | word-break: normal; 16 | word-wrap: normal; 17 | line-height: 1.5; 18 | 19 | -moz-tab-size: 4; 20 | -o-tab-size: 4; 21 | tab-size: 4; 22 | 23 | -webkit-hyphens: none; 24 | -moz-hyphens: none; 25 | -ms-hyphens: none; 26 | hyphens: none; 27 | } 28 | 29 | pre[class*="language-"], 30 | :not(pre) > code[class*="language-"] { 31 | background: hsl(0, 0%, 8%); /* #141414 */ 32 | } 33 | 34 | /* Code blocks */ 35 | pre[class*="language-"] { 36 | border-radius: .5em; 37 | border: .3em solid hsl(0, 0%, 33%); /* #282A2B */ 38 | box-shadow: 1px 1px .5em black inset; 39 | margin: .5em 0; 40 | overflow: auto; 41 | padding: 1em; 42 | } 43 | 44 | pre[class*="language-"]::-moz-selection { 45 | /* Firefox */ 46 | background: hsl(200, 4%, 16%); /* #282A2B */ 47 | } 48 | 49 | pre[class*="language-"]::selection { 50 | /* Safari */ 51 | background: hsl(200, 4%, 16%); /* #282A2B */ 52 | } 53 | 54 | /* Text Selection colour */ 55 | pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, 56 | code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { 57 | text-shadow: none; 58 | background: hsla(0, 0%, 93%, 0.15); /* #EDEDED */ 59 | } 60 | 61 | pre[class*="language-"]::selection, pre[class*="language-"] ::selection, 62 | code[class*="language-"]::selection, code[class*="language-"] ::selection { 63 | text-shadow: none; 64 | background: hsla(0, 0%, 93%, 0.15); /* #EDEDED */ 65 | } 66 | 67 | /* Inline code */ 68 | :not(pre) > code[class*="language-"] { 69 | border-radius: .3em; 70 | border: .13em solid hsl(0, 0%, 33%); /* #545454 */ 71 | box-shadow: 1px 1px .3em -.1em black inset; 72 | padding: .15em .2em .05em; 73 | white-space: normal; 74 | } 75 | 76 | .token.comment, 77 | .token.prolog, 78 | .token.doctype, 79 | .token.cdata { 80 | color: hsl(0, 0%, 47%); /* #777777 */ 81 | } 82 | 83 | .token.punctuation { 84 | opacity: .7; 85 | } 86 | 87 | .namespace { 88 | opacity: .7; 89 | } 90 | 91 | .token.tag, 92 | .token.boolean, 93 | .token.number, 94 | .token.deleted { 95 | color: hsl(14, 58%, 55%); /* #CF6A4C */ 96 | } 97 | 98 | .token.keyword, 99 | .token.property, 100 | .token.selector, 101 | .token.constant, 102 | .token.symbol, 103 | .token.builtin { 104 | color: hsl(53, 89%, 79%); /* #F9EE98 */ 105 | } 106 | 107 | .token.attr-name, 108 | .token.attr-value, 109 | .token.string, 110 | .token.char, 111 | .token.operator, 112 | .token.entity, 113 | .token.url, 114 | .language-css .token.string, 115 | .style .token.string, 116 | .token.variable, 117 | .token.inserted { 118 | color: hsl(76, 21%, 52%); /* #8F9D6A */ 119 | } 120 | 121 | .token.atrule { 122 | color: hsl(218, 22%, 55%); /* #7587A6 */ 123 | } 124 | 125 | .token.regex, 126 | .token.important { 127 | color: hsl(42, 75%, 65%); /* #E9C062 */ 128 | } 129 | 130 | .token.important, 131 | .token.bold { 132 | font-weight: bold; 133 | } 134 | .token.italic { 135 | font-style: italic; 136 | } 137 | 138 | .token.entity { 139 | cursor: help; 140 | } 141 | 142 | pre[data-line] { 143 | padding: 1em 0 1em 3em; 144 | position: relative; 145 | } 146 | 147 | /* Markup */ 148 | .language-markup .token.tag, 149 | .language-markup .token.attr-name, 150 | .language-markup .token.punctuation { 151 | color: hsl(33, 33%, 52%); /* #AC885B */ 152 | } 153 | 154 | /* Make the tokens sit above the line highlight so the colours don't look faded. */ 155 | .token { 156 | position: relative; 157 | z-index: 1; 158 | } 159 | 160 | .line-highlight { 161 | background: -moz-linear-gradient(to right, hsla(0, 0%, 33%, .1) 70%, hsla(0, 0%, 33%, 0)); /* #545454 */ 162 | background: -o-linear-gradient(to right, hsla(0, 0%, 33%, .1) 70%, hsla(0, 0%, 33%, 0)); /* #545454 */ 163 | background: -webkit-linear-gradient(to right, hsla(0, 0%, 33%, .1) 70%, hsla(0, 0%, 33%, 0)); /* #545454 */ 164 | background: hsla(0, 0%, 33%, 0.25); /* #545454 */ 165 | background: linear-gradient(to right, hsla(0, 0%, 33%, .1) 70%, hsla(0, 0%, 33%, 0)); /* #545454 */ 166 | border-bottom: 1px dashed hsl(0, 0%, 33%); /* #545454 */ 167 | border-top: 1px dashed hsl(0, 0%, 33%); /* #545454 */ 168 | left: 0; 169 | line-height: inherit; 170 | margin-top: 0.75em; /* Same as .prism’s padding-top */ 171 | padding: inherit 0; 172 | pointer-events: none; 173 | position: absolute; 174 | right: 0; 175 | white-space: pre; 176 | z-index: 0; 177 | } 178 | 179 | .line-highlight:before, 180 | .line-highlight[data-end]:after { 181 | background-color: hsl(215, 15%, 59%); /* #8794A6 */ 182 | border-radius: 999px; 183 | box-shadow: 0 1px white; 184 | color: hsl(24, 20%, 95%); /* #F5F2F0 */ 185 | content: attr(data-start); 186 | font: bold 65%/1.5 sans-serif; 187 | left: .6em; 188 | min-width: 1em; 189 | padding: 0 .5em; 190 | position: absolute; 191 | text-align: center; 192 | text-shadow: none; 193 | top: .4em; 194 | vertical-align: .3em; 195 | } 196 | 197 | .line-highlight[data-end]:after { 198 | bottom: .4em; 199 | content: attr(data-end); 200 | top: auto; 201 | } 202 | -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-prism/prism-coy.css: -------------------------------------------------------------------------------- 1 | /** 2 | * prism.js Coy theme for JavaScript, CoffeeScript, CSS and HTML 3 | * Based on https://github.com/tshedor/workshop-wp-theme (Example: http://workshop.kansan.com/category/sessions/basics or http://workshop.timshedor.com/category/sessions/basics); 4 | * @author Tim Shedor 5 | */ 6 | 7 | code[class*="language-"], 8 | pre[class*="language-"] { 9 | color: black; 10 | background: none; 11 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 12 | text-align: left; 13 | white-space: pre; 14 | word-spacing: normal; 15 | word-break: normal; 16 | word-wrap: normal; 17 | line-height: 1.5; 18 | 19 | -moz-tab-size: 4; 20 | -o-tab-size: 4; 21 | tab-size: 4; 22 | 23 | -webkit-hyphens: none; 24 | -moz-hyphens: none; 25 | -ms-hyphens: none; 26 | hyphens: none; 27 | } 28 | 29 | /* Code blocks */ 30 | pre[class*="language-"] { 31 | position: relative; 32 | margin: .5em 0; 33 | -webkit-box-shadow: -1px 0px 0px 0px #358ccb, 0px 0px 0px 1px #dfdfdf; 34 | -moz-box-shadow: -1px 0px 0px 0px #358ccb, 0px 0px 0px 1px #dfdfdf; 35 | box-shadow: -1px 0px 0px 0px #358ccb, 0px 0px 0px 1px #dfdfdf; 36 | border-left: 10px solid #358ccb; 37 | background-color: #fdfdfd; 38 | background-image: -webkit-linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%); 39 | background-image: -moz-linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%); 40 | background-image: -ms-linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%); 41 | background-image: -o-linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%); 42 | background-image: linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%); 43 | background-size: 3em 3em; 44 | background-origin: content-box; 45 | overflow: visible; 46 | padding: 0; 47 | } 48 | 49 | code[class*="language"] { 50 | max-height: inherit; 51 | height: 100%; 52 | padding: 0 1em; 53 | display: block; 54 | overflow: auto; 55 | } 56 | 57 | /* Margin bottom to accomodate shadow */ 58 | :not(pre) > code[class*="language-"], 59 | pre[class*="language-"] { 60 | background-color: #fdfdfd; 61 | -webkit-box-sizing: border-box; 62 | -moz-box-sizing: border-box; 63 | box-sizing: border-box; 64 | margin-bottom: 1em; 65 | } 66 | 67 | /* Inline code */ 68 | :not(pre) > code[class*="language-"] { 69 | position: relative; 70 | padding: .2em; 71 | -webkit-border-radius: 0.3em; 72 | -moz-border-radius: 0.3em; 73 | -ms-border-radius: 0.3em; 74 | -o-border-radius: 0.3em; 75 | border-radius: 0.3em; 76 | color: #c92c2c; 77 | border: 1px solid rgba(0, 0, 0, 0.1); 78 | display: inline; 79 | white-space: normal; 80 | } 81 | 82 | pre[class*="language-"]:before, 83 | pre[class*="language-"]:after { 84 | content: ''; 85 | z-index: -2; 86 | display: block; 87 | position: absolute; 88 | bottom: 0.75em; 89 | left: 0.18em; 90 | width: 40%; 91 | height: 20%; 92 | max-height: 13em; 93 | -webkit-box-shadow: 0px 13px 8px #979797; 94 | -moz-box-shadow: 0px 13px 8px #979797; 95 | box-shadow: 0px 13px 8px #979797; 96 | -webkit-transform: rotate(-2deg); 97 | -moz-transform: rotate(-2deg); 98 | -ms-transform: rotate(-2deg); 99 | -o-transform: rotate(-2deg); 100 | transform: rotate(-2deg); 101 | } 102 | 103 | :not(pre) > code[class*="language-"]:after, 104 | pre[class*="language-"]:after { 105 | right: 0.75em; 106 | left: auto; 107 | -webkit-transform: rotate(2deg); 108 | -moz-transform: rotate(2deg); 109 | -ms-transform: rotate(2deg); 110 | -o-transform: rotate(2deg); 111 | transform: rotate(2deg); 112 | } 113 | 114 | .token.comment, 115 | .token.block-comment, 116 | .token.prolog, 117 | .token.doctype, 118 | .token.cdata { 119 | color: #7D8B99; 120 | } 121 | 122 | .token.punctuation { 123 | color: #5F6364; 124 | } 125 | 126 | .token.property, 127 | .token.tag, 128 | .token.boolean, 129 | .token.number, 130 | .token.function-name, 131 | .token.constant, 132 | .token.symbol, 133 | .token.deleted { 134 | color: #c92c2c; 135 | } 136 | 137 | .token.selector, 138 | .token.attr-name, 139 | .token.string, 140 | .token.char, 141 | .token.function, 142 | .token.builtin, 143 | .token.inserted { 144 | color: #2f9c0a; 145 | } 146 | 147 | .token.operator, 148 | .token.entity, 149 | .token.url, 150 | .token.variable { 151 | color: #a67f59; 152 | background: rgba(255, 255, 255, 0.5); 153 | } 154 | 155 | .token.atrule, 156 | .token.attr-value, 157 | .token.keyword, 158 | .token.class-name { 159 | color: #1990b8; 160 | } 161 | 162 | .token.regex, 163 | .token.important { 164 | color: #e90; 165 | } 166 | 167 | .language-css .token.string, 168 | .style .token.string { 169 | color: #a67f59; 170 | background: rgba(255, 255, 255, 0.5); 171 | } 172 | 173 | .token.important { 174 | font-weight: normal; 175 | } 176 | 177 | .token.bold { 178 | font-weight: bold; 179 | } 180 | .token.italic { 181 | font-style: italic; 182 | } 183 | 184 | .token.entity { 185 | cursor: help; 186 | } 187 | 188 | .namespace { 189 | opacity: .7; 190 | } 191 | 192 | @media screen and (max-width: 767px) { 193 | pre[class*="language-"]:before, 194 | pre[class*="language-"]:after { 195 | bottom: 14px; 196 | -webkit-box-shadow: none; 197 | -moz-box-shadow: none; 198 | box-shadow: none; 199 | } 200 | 201 | } 202 | 203 | /* Plugin styles */ 204 | .token.tab:not(:empty):before, 205 | .token.cr:before, 206 | .token.lf:before { 207 | color: #e0d7d1; 208 | } 209 | 210 | /* Plugin styles: Line Numbers */ 211 | pre[class*="language-"].line-numbers { 212 | padding-left: 0; 213 | } 214 | 215 | pre[class*="language-"].line-numbers code { 216 | padding-left: 3.8em; 217 | } 218 | 219 | pre[class*="language-"].line-numbers .line-numbers-rows { 220 | left: 0; 221 | } 222 | 223 | /* Plugin styles: Line Highlight */ 224 | pre[class*="language-"][data-line] { 225 | padding-top: 0; 226 | padding-bottom: 0; 227 | padding-left: 0; 228 | } 229 | pre[data-line] code { 230 | position: relative; 231 | padding-left: 4em; 232 | } 233 | pre .line-highlight { 234 | margin-top: 0; 235 | } 236 | -------------------------------------------------------------------------------- /_book/gitbook/gitbook-plugin-search/search.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'gitbook', 3 | 'jquery' 4 | ], function(gitbook, $) { 5 | var MAX_RESULTS = 15; 6 | var MAX_DESCRIPTION_SIZE = 500; 7 | 8 | var usePushState = (typeof history.pushState !== 'undefined'); 9 | 10 | // DOM Elements 11 | var $body = $('body'); 12 | var $bookSearchResults; 13 | var $searchInput; 14 | var $searchList; 15 | var $searchTitle; 16 | var $searchResultsCount; 17 | var $searchQuery; 18 | 19 | // Throttle search 20 | function throttle(fn, wait) { 21 | var timeout; 22 | 23 | return function() { 24 | var ctx = this, args = arguments; 25 | if (!timeout) { 26 | timeout = setTimeout(function() { 27 | timeout = null; 28 | fn.apply(ctx, args); 29 | }, wait); 30 | } 31 | }; 32 | } 33 | 34 | function displayResults(res) { 35 | $bookSearchResults.addClass('open'); 36 | 37 | var noResults = res.count == 0; 38 | $bookSearchResults.toggleClass('no-results', noResults); 39 | 40 | // Clear old results 41 | $searchList.empty(); 42 | 43 | // Display title for research 44 | $searchResultsCount.text(res.count); 45 | $searchQuery.text(res.query); 46 | 47 | // Create an
  • element for each result 48 | res.results.forEach(function(res) { 49 | var $li = $('
  • ', { 50 | 'class': 'search-results-item' 51 | }); 52 | 53 | var $title = $('

    '); 54 | 55 | var $link = $('', { 56 | 'href': gitbook.state.basePath + '/' + res.url, 57 | 'text': res.title 58 | }); 59 | 60 | var content = res.body.trim(); 61 | if (content.length > MAX_DESCRIPTION_SIZE) { 62 | content = content.slice(0, MAX_DESCRIPTION_SIZE).trim()+'...'; 63 | } 64 | var $content = $('

    ').html(content); 65 | 66 | $link.appendTo($title); 67 | $title.appendTo($li); 68 | $content.appendTo($li); 69 | $li.appendTo($searchList); 70 | }); 71 | } 72 | 73 | function launchSearch(q) { 74 | // Add class for loading 75 | $body.addClass('with-search'); 76 | $body.addClass('search-loading'); 77 | 78 | // Launch search query 79 | throttle(gitbook.search.query(q, 0, MAX_RESULTS) 80 | .then(function(results) { 81 | displayResults(results); 82 | }) 83 | .always(function() { 84 | $body.removeClass('search-loading'); 85 | }), 1000); 86 | } 87 | 88 | function closeSearch() { 89 | $body.removeClass('with-search'); 90 | $bookSearchResults.removeClass('open'); 91 | } 92 | 93 | function launchSearchFromQueryString() { 94 | var q = getParameterByName('q'); 95 | if (q && q.length > 0) { 96 | // Update search input 97 | $searchInput.val(q); 98 | 99 | // Launch search 100 | launchSearch(q); 101 | } 102 | } 103 | 104 | function bindSearch() { 105 | // Bind DOM 106 | $searchInput = $('#book-search-input input'); 107 | $bookSearchResults = $('#book-search-results'); 108 | $searchList = $bookSearchResults.find('.search-results-list'); 109 | $searchTitle = $bookSearchResults.find('.search-results-title'); 110 | $searchResultsCount = $searchTitle.find('.search-results-count'); 111 | $searchQuery = $searchTitle.find('.search-query'); 112 | 113 | // Launch query based on input content 114 | function handleUpdate() { 115 | var q = $searchInput.val(); 116 | 117 | if (q.length == 0) { 118 | closeSearch(); 119 | } 120 | else { 121 | launchSearch(q); 122 | } 123 | } 124 | 125 | // Detect true content change in search input 126 | // Workaround for IE < 9 127 | var propertyChangeUnbound = false; 128 | $searchInput.on('propertychange', function(e) { 129 | if (e.originalEvent.propertyName == 'value') { 130 | handleUpdate(); 131 | } 132 | }); 133 | 134 | // HTML5 (IE9 & others) 135 | $searchInput.on('input', function(e) { 136 | // Unbind propertychange event for IE9+ 137 | if (!propertyChangeUnbound) { 138 | $(this).unbind('propertychange'); 139 | propertyChangeUnbound = true; 140 | } 141 | 142 | handleUpdate(); 143 | }); 144 | 145 | // Push to history on blur 146 | $searchInput.on('blur', function(e) { 147 | // Update history state 148 | if (usePushState) { 149 | var uri = updateQueryString('q', $(this).val()); 150 | history.pushState({ path: uri }, null, uri); 151 | } 152 | }); 153 | } 154 | 155 | gitbook.events.on('page.change', function() { 156 | bindSearch(); 157 | closeSearch(); 158 | 159 | // Launch search based on query parameter 160 | if (gitbook.search.isInitialized()) { 161 | launchSearchFromQueryString(); 162 | } 163 | }); 164 | 165 | gitbook.events.on('search.ready', function() { 166 | bindSearch(); 167 | 168 | // Launch search from query param at start 169 | launchSearchFromQueryString(); 170 | }); 171 | 172 | function getParameterByName(name) { 173 | var url = window.location.href; 174 | name = name.replace(/[\[\]]/g, '\\$&'); 175 | var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)', 'i'), 176 | results = regex.exec(url); 177 | if (!results) return null; 178 | if (!results[2]) return ''; 179 | return decodeURIComponent(results[2].replace(/\+/g, ' ')); 180 | } 181 | 182 | function updateQueryString(key, value) { 183 | value = encodeURIComponent(value); 184 | 185 | var url = window.location.href; 186 | var re = new RegExp('([?&])' + key + '=.*?(&|#|$)(.*)', 'gi'), 187 | hash; 188 | 189 | if (re.test(url)) { 190 | if (typeof value !== 'undefined' && value !== null) 191 | return url.replace(re, '$1' + key + '=' + value + '$2$3'); 192 | else { 193 | hash = url.split('#'); 194 | url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, ''); 195 | if (typeof hash[1] !== 'undefined' && hash[1] !== null) 196 | url += '#' + hash[1]; 197 | return url; 198 | } 199 | } 200 | else { 201 | if (typeof value !== 'undefined' && value !== null) { 202 | var separator = url.indexOf('?') !== -1 ? '&' : '?'; 203 | hash = url.split('#'); 204 | url = hash[0] + separator + key + '=' + value; 205 | if (typeof hash[1] !== 'undefined' && hash[1] !== null) 206 | url += '#' + hash[1]; 207 | return url; 208 | } 209 | else 210 | return url; 211 | } 212 | } 213 | }); 214 | --------------------------------------------------------------------------------