### EYOUcms Manual Upgrade Tutorial Source: https://www.eyoucms.com/help/eyoujq A step-by-step tutorial guiding users through the process of manually upgrading their EYOUcms installation. ```text Manual upgrade tutorial for EYOUcms. ``` -------------------------------- ### Controller with BeforeActionList Example Source: https://www.eyoucms.com/help/develop/kongzhiqi/66.html This example demonstrates setting up 'first', 'second', and 'three' as pre-action methods, with 'second' excluding 'hello' and 'three' only applying to 'hello' and 'data'. ```php namespace app\index\controller; use think\Controller; class Index extends Controller { protected $beforeActionList = [ 'first', 'second' => ['except'=>'hello'], 'three' => ['only'=>'hello,data'], ]; protected function first() { echo 'first
'; } protected function second() { echo 'second
'; } protected function three() { echo 'three
'; } public function hello() { return 'hello'; } public function data() { return 'data'; } } ``` -------------------------------- ### Nginx Deployment for EyouGEO System Source: https://www.eyoucms.com/help/azwt Quick start guide for deploying the EyouGEO system with Nginx. Requires PHP 8.0+ and MySQL 5.7+. ```nginx location / { try_files $uri $uri/ /index.php?$query_string; } ``` -------------------------------- ### IP Access Restriction Plugin Configuration Example Source: https://www.eyoucms.com/help/plus/list_144_3.html Configure IP restrictions by following the example format. For single IPs, list them directly. For IP ranges, use a hyphen. Separate multiple entries with a pipe symbol. ```plaintext 192.168.1.2|192.168.1. ``` -------------------------------- ### Pagination Query with Offset and Length Source: https://www.eyoucms.com/help/develop/shujuku/lianshicaozuo/104.html Use limit with two parameters to specify the starting offset and the number of records to retrieve for pagination. This example fetches 25 records starting from the 10th row. ```php Db::table('think_article')->limit('10,25')->select(); ``` ```php Db::table('think_article')->limit(10,25)->select(); ``` -------------------------------- ### EYOU Template Backup (Migration Tutorial) Source: https://www.eyoucms.com/help/eyoujq A tutorial on how to package and back up EYOU templates, often referred to as a 'migration' or 'moving house' guide. ```bash # Example commands for template backup # This is a placeholder as the actual commands were not provided in the text. ``` -------------------------------- ### Example php.ini Configuration for 50MB File Upload Source: https://www.eyoucms.com/help/faq/31485.html This example demonstrates a comprehensive php.ini configuration for uploading large files up to 50MB. It sets file upload directives, temporary directory, maximum sizes, execution times, and memory limits. Maintain the relationship: memory_limit > post_max_size > upload_max_filesize. ```ini file_uploads = On upload_tmp_dir = "d:/fileuploadtmp" upload_max_filesize = 50M post_max_size = 100M max_execution_time = 600 max_input_time = 600 memory_limit = 128M ``` -------------------------------- ### How to Create Switchable Member Center Templates Source: https://www.eyoucms.com/help/eyoujq A guide on the process of creating member center templates that allow users to switch between different styles or layouts. ```php ``` -------------------------------- ### File Path for Multi-Level Controller Source: https://www.eyoucms.com/help/develop/kongzhiqi/70.html Illustrates the expected file system path for the multi-level controller defined in the previous example. Ensure your file structure matches this convention. ```text application/index/controller/one/Blog.php ``` -------------------------------- ### Generate Resource Controller - Basic Source: https://www.eyoucms.com/help/develop/kongzhiqi/74.html Use this command to generate a resource controller for the 'index' module's 'Blog' resource. ```bash php think make:controller index/Blog ``` -------------------------------- ### Get Current Document URL Tag Source: https://www.eyoucms.com/help/tag/2018/0702/640.html Use this tag within your EyouCMS templates to display the URL of the current document or article. No additional setup is required. ```html {$eyou.field.pageurl} ``` -------------------------------- ### Constructor Injection of Multiple Dependencies Source: https://www.eyoucms.com/help/develop/qingqiu/86.html Supports automatic injection of any object type into the constructor starting from version 5.0.1. This example shows injecting both Request and a User model. ```php namespace app\index\controller; use app\index\model\User; use think\Request; class Index { protected $request; protected $user; public function __construct(Request $request, User $user) { $this->request = $request; $this->user = $user; } } ``` -------------------------------- ### Implement Download Confirmation Page Redirect Source: https://www.eyoucms.com/help/eyoujq This tutorial provides a method for the download model to redirect users to a confirmation page before initiating a download. It involves modifying the built-in source code. ```php ``` -------------------------------- ### Get 'GET' Variables Source: https://www.eyoucms.com/help/develop/qingqiu/77.html Retrieve specific or all GET variables. The `get()` method can fetch a single variable, all filtered variables, or all raw variables. The `input` helper function provides a shorthand for the same functionality. ```php Request::instance()->get('id'); // Get a specific GET variable Request::instance()->get('name'); // Get another GET variable Request::instance()->get(); // Get all GET variables (filtered array) Request::instance()->get(false); // Get all GET variables (raw array) ``` ```php input('get.id'); input('get.name'); input('get.'); ``` -------------------------------- ### Output for 'hello' Action Source: https://www.eyoucms.com/help/develop/kongzhiqi/66.html The expected output when accessing the 'hello' action, showing the sequence of pre-action methods and the action's return value. ```text first three hello ``` -------------------------------- ### Modify GET and POST Variables Source: https://www.eyoucms.com/help/develop/qingqiu/78.html Use Request::instance()->get() and Request::instance()->post() to change the values of GET and POST variables respectively. Avoid directly modifying $_GET, $_POST, or 'param'. ```php // 更改GET变量 Request::instance()->get(['id'=>10]); // 更改POST变量 Request::instance()->post(['name'=>'thinkphp']); ``` -------------------------------- ### Get Raw SQL Query with fetchSql Source: https://www.eyoucms.com/help/develop/shujuku/lianshicaozuo/116.html Use fetchSql to get the SQL query string instead of the query result. This is applicable for any CURD operation. ```php $result = Db::table('think_user')->fetchSql(true)->find(1); ``` -------------------------------- ### 解压缩包 Source: https://www.eyoucms.com/help/azwt/2022/0525/28422.html 使用tar命令解压下载的wdCP安装压缩包。 ```bash tar zxvf lanmp_v3.1.tar.gz ``` -------------------------------- ### Incrementing Loop Counter Source: https://www.eyoucms.com/help/tag/list_173_8.html Adjust the starting value of loop counters in EyouCMS templates. Use '{$key}' for a 0-based index, '{$i}' for a 1-based index, and '{$i+1}' to start from 2. ```html {$key} {$i} {$i+1} ``` -------------------------------- ### Partition Method Usage for Insert Source: https://www.eyoucms.com/help/develop/shujuku/lianshicaozuo/119.html Demonstrates how to use the partition method with Db::name() for inserting data into partitioned tables. Ensure the rule specifies the partitioning type and number. ```php $data = [ 'user_id' => 110, 'user_name' => 'think' ]; $rule = [ 'type' => 'mod', // 分表方式 'num' => 10 // 分表数量 ]; Db::name('log') ->partition(['user_id' => 110], "user_id", $rule) ->insert($data); ``` -------------------------------- ### Get Article Count for Specific Column ID Source: https://www.eyoucms.com/help/tag/2025/0220/31630.html Use this tag to get the total number of articles for a specific column ID. Replace '2' with the desired column ID. ```html {$eyou.field.typeid='2'|GetTotalArc=###} ``` -------------------------------- ### Get 'param' Variable Source: https://www.eyoucms.com/help/develop/qingqiu/77.html Retrieve 'param' variables, which automatically detect GET, POST, or PUT requests. This is the recommended method for accessing request parameters. It can fetch a specific variable, all filtered variables, all raw variables, or all variables including uploaded files. ```php // Get the 'name' variable for the current request Request::instance()->param('name'); // Get all variables for the current request (filtered) Request::instance()->param(); // Get all variables for the current request (raw data) Request::instance()->param(false); // Get all variables for the current request (including uploaded files) Request::instance()->param(true); ``` ```php input('param.name'); input('param.'); ``` ```php input('name'); input(''); ``` -------------------------------- ### Partition Method Usage for Select Source: https://www.eyoucms.com/help/develop/shujuku/lianshicaozuo/119.html Shows how to use the partition method with Db::name() for querying data from partitioned tables. The partition parameters should match the data being queried. ```php Db::name('log') ->partition(['user_id' => 110], "user_id", $rule) ->where(['user_id' => 110]) ->select(); ``` -------------------------------- ### Generate Resource Controller - With Namespace Source: https://www.eyoucms.com/help/develop/kongzhiqi/74.html Generate a resource controller using a full namespace for more specific placement. ```bash php think make:controller app\index\controller\Blog ``` -------------------------------- ### Get Route and Dispatch Information Source: https://www.eyoucms.com/help/develop/qingqiu/76.html Retrieve information about the matched route and the dispatch process for the current request. ```php $request = Request::instance(); echo '路由信息:'; dump($request->route()); echo '调度信息:'; dump($request->dispatch()); ``` -------------------------------- ### 获取当前伪静态后缀 Source: https://www.eyoucms.com/help/develop/qingqiu/82.html 在控制器操作方法中,可以使用`Request::instance()->ext()`方法获取当前访问的伪静态后缀。 ```php $ext = Request::instance()->ext(); ``` -------------------------------- ### Accessing 'hello' Action Source: https://www.eyoucms.com/help/develop/kongzhiqi/66.html When accessing the 'hello' action, 'first' and 'three' are executed as pre-action methods, followed by the 'hello' action itself. ```http http://localhost/index.php/index/Index/hello ``` -------------------------------- ### Get Top-Level Column Link Source: https://www.eyoucms.com/help/tag/2018/0828/932.html Use this tag to retrieve the URL of the top-level column associated with the current field. ```HTML {$eyou.field.typeid|gettoptype=###,'typeurl'} ``` -------------------------------- ### Get Top-Level Column Name Source: https://www.eyoucms.com/help/tag/2018/0828/932.html Use this tag to retrieve the name of the top-level column associated with the current field. ```HTML {$eyou.field.typeid|gettoptype=###,'typename'} ``` -------------------------------- ### Get Current Document URL Source: https://www.eyoucms.com/help/tag/list_173_9.html Retrieve the URL of the current article using this simple tag. No additional parameters are required. ```HTML {$eyou.field.arcurl} ``` -------------------------------- ### Nginx服务器(根目录与二级目录均安装)去除index.php规则 Source: https://www.eyoucms.com/help/faq/28349.html 适用于阿里云等空间,当根目录和二级目录都安装了易优CMS时,使用此配置来去除index.php。 ```nginx location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; break; } } location /二级目录名/ { if (!-e $request_filename) { rewrite ^/二级目录名/(.*)$ /二级目录名/index.php?s=/$1 last; break; } } ``` -------------------------------- ### Manual Pagination with `limit` Source: https://www.eyoucms.com/help/develop/shujuku/lianshicaozuo/105.html Demonstrates manual calculation of the `limit` parameter for fetching data from different pages. This requires explicit calculation of the offset for each page. ```php Db::table('think_article')->limit('0,10')->select(); ``` ```php Db::table('think_article')->limit('10,10')->select(); ``` -------------------------------- ### Get Top-Level Column Information Source: https://www.eyoucms.com/help/tag/list_173_7.html Retrieve the name, link, and English name of the top-level column using these EyouCms tags. ```html {$eyou.field.typeid|gettoptype=###,typename} ``` ```html {$eyou.field.typeid|get... ``` -------------------------------- ### 执行安装脚本 Source: https://www.eyoucms.com/help/azwt/2022/0525/28422.html 使用sh命令执行wdCP的安装脚本,开始安装过程。 ```bash sh lanmp.sh ``` -------------------------------- ### Get Download Permissions in Download List Source: https://www.eyoucms.com/help/eyoujq This snippet explains how to call download permissions within the download list in EYOUcms. ```php ``` -------------------------------- ### Get Top-Level Column English Name Source: https://www.eyoucms.com/help/tag/2018/0828/932.html Use this tag to retrieve the English name of the top-level column associated with the current field. ```HTML {$eyou.field.typeid|gettoptype=###,'englist_name'} ``` -------------------------------- ### 选择安装选项 Source: https://www.eyoucms.com/help/azwt/2022/0525/28422.html 在安装过程中,输入数字1以选择默认的apache服务器环境进行安装。 ```bash 1 ``` -------------------------------- ### 允许上传webp图片 Source: https://www.eyoucms.com/help/system/29798.html 在`/core/library/think/File.php`文件中,搜索`// 如果上传的不是图片,或者是图片而且后缀确实符合图片类型则返回 true`,在其上方添加此代码以允许上传webp格式的图片。 ```php if ($extension == 'webp'){ return true; } ``` -------------------------------- ### Get Module, Controller, and Action Names Source: https://www.eyoucms.com/help/develop/qingqiu/76.html Retrieve the current module, controller, and action names from the request. You can also set these values. ```php $request = Request::instance(); echo "当前模块名称是" . $request->module(); echo "当前控制器名称是" . $request->controller(); echo "当前操作名称是" . $request->action(); ``` ```php Request::instance()->module('module_name'); ``` -------------------------------- ### Get Specific HTTP Header Source: https://www.eyoucms.com/help/develop/qingqiu/81.html Directly retrieve the value of a specific HTTP request header, such as 'user-agent'. The header name is case-insensitive. ```php $agent = Request::instance()->header('user-agent'); ``` -------------------------------- ### Controller Rendering Template with View Helper Source: https://www.eyoucms.com/help/develop/kongzhiqi/64.html Shows how to render a template using the convenient 'view' helper function, which simplifies template rendering calls. ```php namespace app\index\controller; class Index { public function index() { return view('index'); } } ``` -------------------------------- ### Define Multi-Level Controller Source: https://www.eyoucms.com/help/develop/kongzhiqi/73.html Define a controller within a multi-level namespace structure. This example shows a `Blog` controller in the `app\index\controller\one` namespace. ```php namespace app\index\controller\one; use think\Controller; class Blog extends Controller { public function index() { return $this->fetch(); } public function add() { return $this->fetch(); } public function edit($id) { return $this->fetch('edit:'.$id); } } ``` -------------------------------- ### Query Multiple Data Records: DedeCMS vs EyouCMS Source: https://www.eyoucms.com/help/eyoujq/11934.html Demonstrates fetching multiple data records, such as all categories, in DedeCMS using `$dsql->Execute()` and `$dsql->getarray()` versus EyouCMS using `db()->query()` and a `foreach` loop. Remember to adjust the database table prefix for EyouCMS. ```php global $dsql; $sql = 'select * from dede_arctype'; $dsql->Execute('me',$sql); while($row = $dsql->getarray()) echo "栏目ID:". $row['id']; echo " -- "; echo "栏目名称:". $row['typename']; echo "
"; } ``` ```php $sql = 'select * from ey_arctype'; $row = db()->query($sql); foreach ($row as $_k => $_v) { echo "栏目ID:". $_v['id']; echo " -- "; echo "栏目名称:". $_v['typename']; echo " -- "; echo "栏目链接:".typeurl('home/Lists/index', $_v); echo "
"; } ``` -------------------------------- ### Get Ad Count in Eyouscms Source: https://www.eyoucms.com/help/eyoujq/list_81_5.html Add a function to `extend/function.php` to retrieve the number of ads within an ad group when a specific tag is not available. ```php // 获取广告数量 function get_ad_num($aid) { $num = M("adbyte")->where("aid = $aid And status=3 ")->count(); return $num; } ``` -------------------------------- ### Get Cookie JavaScript Function Source: https://www.eyoucms.com/help/eyoujq/11108.html This JavaScript function retrieves the value of a specified cookie. It's useful for checking user session information. ```javascript function getCookie(c_name) { if (document.cookie.length>0) { c_start = document.cookie.indexOf(c_name + "=") if (c_start!=-1) { c_start=c_start + c_name.length+1 c_end=document.cookie.indexOf(";",c_start) if (c_end==-1) c_end=document.cookie.length return unescape(document.cookie.substring(c_start,c_end)) } } return ""; } ``` -------------------------------- ### 在模板中使用 Widget 控制器 (action 助手函数) Source: https://www.eyoucms.com/help/develop/kongzhiqi/71.html 在模板文件中使用 `action` 助手函数调用 Widget 控制器的方法。需要指定控制器、方法和层级('widget')。 ```php {:action('Blog/header', '', 'widget')} {:action('Blog/menu', ['name' => 'think'], 'widget')} ``` -------------------------------- ### Controller Rendering Template with View Class Source: https://www.eyoucms.com/help/develop/kongzhiqi/64.html Demonstrates how to render a template within a controller by explicitly creating and using an instance of the think\View class. ```php namespace app\index\controller; use think\View; class Index { public function index() { $view = new View(); return $view->fetch('index'); } } ``` -------------------------------- ### Get Request Instance Source: https://www.eyoucms.com/help/develop/qingqiu/76.html Obtain an instance of the Request class to access request details. You can use either the static method or the helper function. ```php $request = Request::instance(); ``` ```php $request = request(); ```