- 1 Introduction
- 2 Installation
- 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
- 5 Advanced
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.
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.
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.