- 1 Introduction
- 1.1 About zentaoPHP
- 1.2 Features
- 1.3 License
- 2 Installation
- 2.1 System Requirement
- 2.2 Install zentaoPHP
- 3 Quick Start
- 3.1 Echo Hello World!
- 3.2 Use MVC to echo Hello World!
- 3.3 Example: Deploy the blog built in zentaoPHP
- 4 Basics
- 4.1 Basic Concepts
- 4.2 Request Types
- 4.3 Create Links
- 4.4 Class: HTML, JS, and CSS
- 5 Advanced
- 5.1 Directory Structure
- 5.2 DAO
- 5.3 Pager Solutions
- 5.4 Data Validation
Create Links
- 2018-07-12 10:38:35
- tengfei
- 6338
- Last edited by tengfei on 2019-09-16 14:11:15
Because zentaoPHP has two request types, so try not to spell the code of the link manually to create links when generating links. Call the createLink method provided by the system to generate links.
1. $this->createLink()
Let's say we will create a link for the view method of the blog module and pass a parameter id=17. You should call it as shown below,
echo $this->createLink('blog', 'view', 'id=17&cat=123')
The first parameter is the module name, the second parameter is the method name, the third parameter is the parameter, and the key1=value1&key2=value2 is used to pass the parameters.
If the request type is PATH_INFO, the link created is blog-view-17-123.html. If it is GET, the link is m=blog&f=view&id=17&cat=123&t=html.
2. helper::createLink()
The $this->createLink () method can be directly invoked in control and view. If you want to call it elsewhere, you can use helper:: createLink (), the parameters are the same.
3. createLink() in js
zentaoPHP also has a JS version of the createLink () to generate links when interacting with JS. Refer to the definition in app/demo/www/js/my.js for specific codes.
However, before calling the JS version of createLink (), you have to call js:: exportVars () to output the configuration parameters of the current system.