# |
Nov 12th 2019, 13:17 |
massimoi |
this is what I did in Cake2, but how can I get the path of the view in Cake3? If I do $this->viewBuilder()->getTemplatePath( ); I always get a empty string |
# |
Nov 12th 2019, 13:16 |
admad |
@conehead then there's no way to get all the children in a single query |
# |
Nov 12th 2019, 13:16 |
slackebot1 |
array_unshift($path,$locale); } |
# |
Nov 12th 2019, 13:16 |
massimoi |
@tobse not sure to have understood... what I see is localization, meaning I can edit single strings in the page. But how do I choose a different .ctp when the language is different? if ($this->theme) { $theme_path = DS . 'Themed' . DS . $this->theme ; } if ($locale andand file_exists(APP . 'View' . $theme_path . DS . $this->viewPath . DS . $locale .DS. implode('/', $path) . $this->ext )) { |
# |
Nov 12th 2019, 13:15 |
conehead |
Ah. Seems to be for Tree-Behavior. I am not using that behavior...just threaded data :S |
# |
Nov 12th 2019, 13:15 |
conehead |
I will have a look thanks. Never have seen `for` |
# |
Nov 12th 2019, 13:14 |
admad |
`->find('children', [for =>id])->find('threded')` |
# |
Nov 12th 2019, 13:13 |
conehead |
Which does not seem to be a nice solution :P |
# |
Nov 12th 2019, 13:13 |
conehead |
And just chain them like 20 times |
# |
Nov 12th 2019, 13:13 |
conehead |
this won't get me all children. Could do ``` 'contain' => [ 'Children' => [ 'Children' => [ ... ], ], ]; ``` |
# |
Nov 12th 2019, 13:11 |
dereuromark |
contain => Chhildren? |
# |
Nov 12th 2019, 13:09 |
conehead |
Hm is there a simple way to find all threaded data from a specific node? Simple `->where(['id' => $id])` will always return only the one result as the children are filtered as well |
# |
Nov 12th 2019, 12:38 |
dereuromark |
you shouldnt do that. but if you do, best to use the whitelist, instead of forceEnable as global one |
# |
Nov 12th 2019, 12:37 |
rsteenge |
How can i active the DebugKit toolbar outside of the local environment? I tried the following command in my bootstrap.php : Configure::write('DebugKit.forceEnable', true); |
# |
Nov 12th 2019, 12:08 |
tobse |
For a simple language switcher you just need to edit the content of your static pages. Use the language functions and define the locale like described here. https://book.cakephp.org/3/en/core-libraries/internationalization-and-localization.html#changing-the-locale-at-runtime If you have larger content-blocks you can use switch-case for each language-version in your ctp-file |
# |
Nov 12th 2019, 12:01 |
pieceof |
edit config/routes.php |
# |
Nov 12th 2019, 11:59 |
pieceof |
web ui -> localization L10n, content -> internazionalization i18n |
# |
Nov 12th 2019, 11:55 |
massimoi |
Hi, can anybody help me with this simple problem. I'm used to CakePHP 2.x and I'm new to CakePHP3. I need a simple thing: I need elements and static pages to be in different languages. In 2.x I edited the path of the page in the PagesController, but new I don't understand how to do it. Can you help? Thanks |
# |
Nov 12th 2019, 11:32 |
development |
Played with it a bit. It's unfortunate that I develop on Windows (no symlinks), but what I wanted to achieve works. Thanks for the quick reply! |
# |
Nov 12th 2019, 11:31 |
slackebot1 |
$validator->isArray('semestershelves') ->requirePresence('semestershelves') ->notEmptyArray('semestershelves', __('Please choose at least one entry.'); ``` Or do I have to run the validation manually before building the entity in the controller? Or put the validation into the associated model? Thanks for any advice. |
# |
Nov 12th 2019, 11:31 |
tobse |
Hi to all, one question about validation of associated models. I'm having a "belongsToMany"-association between "contents" and "semestershelves". "content" belongs to one or many "semestershelves". In my form I have multiple checkboxes of entries of the associated model. What I like to obtain is a validation-error when no checkbox is checked. I tried the following in the default validator of the contents-table: ``` |
# |
Nov 12th 2019, 11:12 |
hmic |
val: remove/disable the behavior |
# |
Nov 12th 2019, 11:02 |
val |
Hi, what is the proper way to remove unnecessary join to i18n table in models that use TranslateBehavior in 3.x when the translation field is not supposed to be retrieved? |
# |
Nov 12th 2019, 10:37 |
jotpe |
Both approaches not working |
# |
Nov 12th 2019, 10:37 |
slackebot1 |
<jotpe> |
# |
Nov 12th 2019, 10:36 |
jotpe |
I tried this: |
# |
Nov 12th 2019, 10:36 |
jotpe |
Anyone knows how to pass cli params to a engine in CakePDF? https://github.com/FriendsOfCake/CakePdf#configuration |
# |
Nov 12th 2019, 10:27 |
development |
Didn't know about the symlink option. I will try that, thanks! |
# |
Nov 12th 2019, 10:26 |
challgren |
Have you tried https://book.cakephp.org/3/en/console-and-shells/plugin-shell.html#plugin-assets |
# |
Nov 12th 2019, 10:25 |
development |
Morning all, could anyone tell me how I can trigger all css/js files within a certain plugin folder with .htaccess? When I use "<FilesMatch "\.(css|js)">" it only triggers files that are in /webroot and not files that are in /plugins/MyPlugin/webroot. I would like to set the cache headers for cetrain js/css files which reside inside a plugin folder. |
# |
Nov 12th 2019, 09:11 |
challgren |
@mehov for example LastPass will autofill forms even hidden fields |
# |
Nov 12th 2019, 09:10 |
challgren |
evening |
# |
Nov 12th 2019, 07:57 |
javier.villanueva |
morning |
# |
Nov 12th 2019, 07:57 |
admad |
moin |
# |
Nov 12th 2019, 07:57 |
jotpe |
Morning |
# |
Nov 12th 2019, 07:56 |
admad |
3.x csrftoken is per session, so it's always going to remain same either way |
# |
Nov 12th 2019, 07:54 |
admad |
@mehov apparently it was required because of some safari shenanigans https://github.com/cakephp/cakephp/commit/27994ab1d8d66d61581ae13f5c5fceb61d36d933 |
# |
Nov 12th 2019, 07:52 |
mehov |
okay, got it thanks for explaining! :) |
# |
Nov 12th 2019, 07:51 |
admad |
maybe someone wanted to be overcareful for no reason :slightly_smiling_face: |
# |
Nov 12th 2019, 07:51 |
mehov |
okay then why do all these hashes and tokens have autocomplete="off" even though they're hidden? (not being a dick, just learning) |
# |
Nov 12th 2019, 07:51 |
admad |
in 4.x you won't even have the `_method` named input for post forms |