# |
Jul 23rd 2018, 13:23 |
flavius |
4 seconds of loading to be exact |
# |
Jul 23rd 2018, 13:23 |
flavius |
you press ctrl + space and you're greeted with a "loading", how wonderful :P |
# |
Jul 23rd 2018, 13:22 |
flavius |
this feels sluggish |
# |
Jul 23rd 2018, 13:22 |
flavius |
my other IDE took it's sweet time to cache everything, sure i had to wait a bit to load the whole project but when it was ready everything was instant |
# |
Jul 23rd 2018, 13:21 |
flavius |
maybe there's a setting somewhere, however i'm a newb :slightly_smiling_face: |
# |
Jul 23rd 2018, 13:20 |
flavius |
and the loading is annoying me, it's not "instant" like i'm used to |
# |
Jul 23rd 2018, 13:20 |
flavius |
so now that works after trying it a second time |
# |
Jul 23rd 2018, 13:19 |
flavius |
File uploaded https://cakesf.slack.com/files/U75U0UMR9/FBUKW2QBT/image.png / https://slack-files.com/T053DPNCM-FBUKW2QBT-ba48a1b9b0 |
# |
Jul 23rd 2018, 13:17 |
dereuromark |
what code exist is still lacking? i am curious |
# |
Jul 23rd 2018, 13:16 |
flavius |
even with dereuromark's IDE helper |
# |
Jul 23rd 2018, 13:16 |
flavius |
@neon1024 so you haven't used it in any projects yet huh? im also trying it out but there's some code assist things that are lacking |
# |
Jul 23rd 2018, 13:15 |
flavius |
@dereuromark :slightly_smiling_face: |
# |
Jul 23rd 2018, 13:15 |
dereuromark |
I prefer components :slightly_smiling_face: |
# |
Jul 23rd 2018, 13:15 |
flavius |
you can have private functions that are helpers for those actions however |
# |
Jul 23rd 2018, 13:15 |
flavius |
public functions in controllers go to actions (URL) |
# |
Jul 23rd 2018, 13:14 |
flavius |
>> is this right ? yep |
# |
Jul 23rd 2018, 13:01 |
mr.mjsm |
File uploaded https://cakesf.slack.com/files/UBN7KUDRA/FBUKK0LGZ/-.php / https://slack-files.com/T053DPNCM-FBUKK0LGZ-9eaa362de6 - <@U75U0UMR9> ok i did it like this and it worked thanks. my question now. i wrote a method in my UserController to display the name. now i feel this is wrong, these type of method should be put in a helper. is this right ? so the controller should only have add edit delete index or actions that require a URL |
# |
Jul 23rd 2018, 12:34 |
neon1024 |
@flavius I gave VS Code a bit of a try out, but I haven’t used it properly for a whole day yet |
# |
Jul 23rd 2018, 12:33 |
dereuromark |
highstrike: dont tell them lies. tabs are superior. it is just that the psr people are 90s :slightly_smiling_face: and as such cake has to do that now. |
# |
Jul 23rd 2018, 12:22 |
mr.mjsm |
thanks |
# |
Jul 23rd 2018, 12:22 |
mr.mjsm |
ok i think i got it. will work on it |
# |
Jul 23rd 2018, 12:22 |
flavius |
you write your function in your custom helper and you call that function from your templates |
# |
Jul 23rd 2018, 12:21 |
mr.mjsm |
and i can call the function from my helper method ? |
# |
Jul 23rd 2018, 12:20 |
flavius |
and then all your templates can access that function :slightly_smiling_face: |
# |
Jul 23rd 2018, 12:20 |
flavius |
https://book.cakephp.org/3.0/en/views/helpers.html |
# |
Jul 23rd 2018, 12:19 |
flavius |
just like `$this->Html` is HtmlHelper in the cake's core |
# |
Jul 23rd 2018, 12:18 |
flavius |
then you are looking for a view helper |
# |
Jul 23rd 2018, 12:18 |
mr.mjsm |
File uploaded https://cakesf.slack.com/files/UBN7KUDRA/FBW6UTTT9/-.php / https://slack-files.com/T053DPNCM-FBW6UTTT9-5977770f01 - i want to use something like this in my index ctp |
# |
Jul 23rd 2018, 12:17 |
flavius |
you can however use `$this->set('variable_name', $variable)` to pass to the template the `$variable_name` |
# |
Jul 23rd 2018, 12:16 |
flavius |
public functions in controller generally mean they are actions |
# |
Jul 23rd 2018, 12:16 |
flavius |
you shouldn't add functions / methods in the template file |
# |
Jul 23rd 2018, 12:15 |
mr.mjsm |
i have another question, can I use this method in my index ctp ? |
# |
Jul 23rd 2018, 12:15 |
flavius |
lel |
# |
Jul 23rd 2018, 12:14 |
mr.mjsm |
good point. come to our university, you will be distinguished prof. in the first week |
# |
Jul 23rd 2018, 12:13 |
flavius |
because a tab could be a different number of columns depending on your environment, but a space is always one column :slightly_smiling_face: |
# |
Jul 23rd 2018, 12:12 |
mr.mjsm |
isn't it better to use tabs for indentation ? that's what i was taught for python |
# |
Jul 23rd 2018, 12:12 |
flavius |
for indentation |
# |
Jul 23rd 2018, 12:12 |
mr.mjsm |
why ? |
# |
Jul 23rd 2018, 12:12 |
flavius |
also don't use tabs, use spaces :slightly_smiling_face: |
# |
Jul 23rd 2018, 12:11 |
flavius |
``` public function displayName($id) { $this->loadModel('Users'); $user = $this->Users->get($id); echo $user->name; } ``` |
# |
Jul 23rd 2018, 12:11 |
flavius |
so you need to add `$this->loadModel('Users');` in that function to make it work |