cakephp-3.1

CakePHP 3.1-rc1 utf-8 special chars output

南楼画角 提交于 2020-01-05 00:53:57
问题 During the migration from 2.6 to 3.1 may encounter problems with the display of special characters in the Croatian language. The content is taken from the database. Content is stored in a database via CakePHP 2.x applications, and can be displayed properly. but when I connect a new application I have a problem with the proper display of these characters čćšđž. database / tables : MyISAM utf8_general_ci cakephp 2.x app public $default = array( 'datasource' => 'Database/Mysql', 'persistent' =>

How to make cakephp 3 url ready for marketing?

不羁的心 提交于 2019-12-25 01:54:32
问题 I am new for cakephp. I am trying to rewrite the url to make it SEO friendly. I have create module in cakephp3 for cms page. Page Table - url field would like to use as "about-us" CREATE TABLE IF NOT EXISTS `pages` ( `id` int(11) NOT NULL, `title` varchar(100) NOT NULL, `detail` text NOT NULL, `url` varchar(225) NOT NULL, ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1; Current URL (working)- https://example.com/pages/view/8 I want to make this like below. https://example.com/about

How to Filter Associated Data using FriendsOfCake Search plugin for CakePHP 3.1.0

♀尐吖头ヾ 提交于 2019-12-23 04:45:46
问题 Plugin: FriendsOfCake\Search CakePHP: 3.1.0 I'm currently adding the ability to filter my Orders controller on the index() method. I'm needing to be able to search Orders my the name of the User who placed the order. Each order is associated with the Users model: $this->belongsTo('Users', [ 'foreignKey' => 'user_id', 'joinType' => 'INNER' ]); When I build my searchConfiguration() method in the OrdersTable.php file I have the following: ->value('first_name', [ 'field' => $this->aliasField(

Intervention Image: Save image directly from an url with original file name and ext?

主宰稳场 提交于 2019-12-20 12:17:02
问题 How to get the filename, when taking image from a remote server? And how to save with original size and filename? // Take remote image $img = Image::make('http://image.info/demo.jpg'); // how to save in the img/original/demo.jpg $img->save(????); I use Intervention, (http://image.intervention.io/api/make) to build CakePHP 3 image Behavior, I want to provide an easy uploading from remote servers, and keep the original image as a source for future manipulation. EDIT I ask, is there the

Intervention Image: Save image directly from an url with original file name and ext?

你离开我真会死。 提交于 2019-12-20 12:16:01
问题 How to get the filename, when taking image from a remote server? And how to save with original size and filename? // Take remote image $img = Image::make('http://image.info/demo.jpg'); // how to save in the img/original/demo.jpg $img->save(????); I use Intervention, (http://image.intervention.io/api/make) to build CakePHP 3 image Behavior, I want to provide an easy uploading from remote servers, and keep the original image as a source for future manipulation. EDIT I ask, is there the

Cakephp 3.1 - How to redirect based on query string values?

落爺英雄遲暮 提交于 2019-12-20 06:15:44
问题 We recently updated our site from pure php to cakephp 3 and having trouble redirecting urls that have params to a new url. For example this redirect works fine $routes->redirect('/webcast.php', '/webcast', ['status' => 302]); But if there's parameters, it doesn't work $routes->redirect('/webcast.php?id=100', '/webcast', ['status' => 302]); Any ideas? Thanks. 回答1: The router doesn't support matching on query strings, the URL passed to the router when checking for a matching route won't have

Subqueries in CakePHP 3?

半世苍凉 提交于 2019-12-20 02:37:25
问题 I have two tables products and product_categories that are associated through a third table, products_categories_products , according to CakePHP BelongsToMany conventions (Edit: these associations are established in ProductsTable.php and ProductCategoriesTable.php ). I want to generate a list of product categories, using the image from the best selling products to represent each category. I can achieve my desired outcome using the following function: public function findImages(Query $query,

CakePHP 3 changing the radio input template

二次信任 提交于 2019-12-18 04:17:18
问题 Cakephp 3 create a radio container with label -> input like that <div class="radio"> <label class="radio-acces-checked" for="condition-access-1"> <input id="condition-access-1" type="radio" value="1" name="condition_access"> Free access </label> </div> ... I would like change structure but it does not work, it's always the same strucure... Do you have an idea about how to solve my problem ? $myTemplates = [ 'radioWrapper' => '<div class="radio">{{label}}{{input}}</div>' ]; echo $this->Form-

CakePHP 3.1: Validation for translate behaviour fields (i18n)

£可爱£侵袭症+ 提交于 2019-12-13 08:44:08
问题 I'm trying to add an item including multiple translations in one form with the CakePHP translate behaviour. How can I validate the translation fields? E.g. make specific languages required? Let's assume you have a simple items table with a separate translations table items_i18n , set up as described in the book. As simple example the items table has only one field title to translate and I want to save the title in five languages. So I make a form like this (in add view template): echo $this-

cakephp 3.1 input field with european date format

自闭症网瘾萝莉.ら 提交于 2019-12-13 07:03:05
问题 I have a table with records of users (name, forename, birthdate, etc.) and I want to find users by name or birthdate or every possible combination of this. My code works well, but the birthdate is stored in the american format (YYYY-MM-dd), so I have to search after dates in this format to get the right record. That´s really annoying, because in Germany we use the european format (dd.MM.YYYY) and I want to search for the dates by our habitual format. Now I need help to give the input field