Difference between #36 and #37 of
Yii v2 snippet guide III

Revision #37 has been created by rackycz on Feb 18, 2021, 10:12:10 AM with the memo:

Replace
« previous (#36) next (#38) »

Changes

Title unchanged

Yii v2 snippet guide III

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

tutorial,yii2,beginer

Content changed

[...]
],
],
```
Now the language-switching links will produce URL like this: http://myweb.com/en/site/index . Without the rules the link would look like this: http://myweb.com/site/index?sys_lang=en . So the rule works in both directions. When URL is parsed and controllers are called, but also when a new URL is created using the URL helper.

**Search and replace
 Yii::t()** --- Simple usage in format Yii::t('text','text') can be searched using following regex for example in Notepad++. If you want to modify it massively, you can use the "replace" command, also in Notepad++. **Yii::t()**
 
``` search: Yii::t\('([^']*)'[^']*'([^']*)'[^\)]*\) replace with: Yii::t\('$1','$2'\) ``` **URLs (in Notepad++) **
 
```
 
return $this->redirect('/controller/action')->send(); // NO
 
return $this->redirect(['controller/action'])->send(); // YES
 
 
search: ->redirect\(['][/]([^']*)[']\)
 
replace: ->redirect\(['$1']\)
 
 
====
 
 
return $this->redirect('controller/action')->send(); // NO
 
return $this->redirect(['controller/action'])->send(); // YES
 
 
search: ->redirect\((['][^']*['])\)
 
replace: ->redirect\([$1]\)
 
```
 
 
**Running Yii project in Vagrant. (Simplified version)**
---
- Do you want your colleague-developers to use identical environment like you have?
- Or do you want to easily setup whole server after you reinstalled your computer?

This is when Vagrant is helpful.
[...]
8 0
4 followers
Viewed: 191 062 times
Version: 2.0
Category: Tutorials
Written by: rackycz
Last updated by: rackycz
Created on: Jan 21, 2021
Last updated: a year ago
Update Article

Revisions

View all history