1Router::url('/', true) . 'img/example.png' (cakephp 2)
2
3// localhost/domain/event/detail
4$current_url = $this->request->here();
5// => /domain/event/detail
1// In mysql you can order by specific field values, by using ORDER BY FIELD:
2SELECT * FROM city
3WHERE id IN (10, 1, 2)
4ORDER BY FIELD(id, 10, 1, 2) DESC;
5
6// output:
7// order: first those with id = 10, those with id = 1, those with id = 2
8// Do in cake
9 'order' => array(
10 'FIELD(City.id, 10, 1, 2)',
11 ),
12
13// or
14 'order' => array(
15 'FIELD(City.id, 10, 1, 2) DESC',
16 ),
17
18
19
1echo $this->Html->link(__('<i class="fas fa-icons"></i>'), array(
2 'plugin' => 'building',
3 'controller' => 'service_icons',
4 'action' => 'index',
5 '?building_post_id=' . $buildingPost['BuildingPost']['id']), array('class' => 'btn btn-info btn-xs', 'escape' => false, 'data-toggle'=>'tooltip', 'title' => __d('building', 'add_service_icon')));
6
7
8// output
9// http://localhost/paragonasia-portal/admin/building/service_icons/index/?building_post_id=16
1//chnage the layout in Cakephp 4 with the layout file called ajax.php
2$this->viewBuilder()->setLayout('ajax');
11. Add .htaccess
2<IfModule mod_rewrite.c>
3 RewriteEngine on
4 RewriteRule ^$ webroot/ [L]
5 RewriteRule (.*) webroot/$1 [L]
6</IfModule>
7
82. Add Permission tmp, Vendor, Webroot
9- Window Set permisson
10- Linux Set chmod -R 777
1// output, if you wanna get output same below array, you need to use name="Member[verify_code]"
2// name="Member[email]" in form
3
4Array(
5 [Member] => Array (
6 [verify_code] => 123466
7 [email] => huuvi168@gmail.com
8 [lang] => zho
9 [password] => 123
10 [confirm_password] => 123
11) )
12
13 // cake php form
14 <?=$this->Form->create('Member', array('role' => 'form')); ?>
15 <fieldset>
16 <?=$this->Form->input('lang', array('type' => 'hidden', 'value' => $lang, 'required'));?>
17
18 <div class="form-group">
19 <input type="hidden" name="Member[verify_code]" value="<?= isset($verify_code) && !empty($verify_code) ? $verify_code : ''; ?>" />
20 </div>
21
22 <div class="form-group">
23 <input type="hidden" name="Member[email]" value="<?= isset($email) && !empty($email) ? $email : ''; ?>" />
24 </div>
25
26 <div class="form-group">
27 <?=$this->Form->input('password', array('class' => 'form-control', 'placeholder' => __d('frontend', 'new_password'), 'label' => '', 'required')); ?>
28 </div>
29 </fieldset>
30 <?=$this->Form->end(); ?>