# |
Dec 14th 2017, 21:32 |
dereuromark |
Might be. This is how I do it to render in a certain order: https://github.com/dereuromark/cakephp-flash/blob/master/src/View/Helper/FlashHelper.php#L24 but you can also just fetch them separately: https://github.com/dereuromark/cakephp-flash/blob/master/tests/TestCase/View/Helper/FlashHelperTest.php#L89 |
# |
Dec 14th 2017, 21:32 |
rafael.junqueira.sant |
oh, alright. so it may be an issue, right? |
# |
Dec 14th 2017, 21:32 |
dereuromark |
pull request |
# |
Dec 14th 2017, 21:31 |
rafael.junqueira.sant |
what's a core PR? Tried google, no success |
# |
Dec 14th 2017, 21:30 |
dereuromark |
hm probably no test for this, you can try fixing it and making a core PR if you find out whats going on |
# |
Dec 14th 2017, 21:30 |
rafael.junqueira.sant |
I'm researching about TestCases, 1 min |
# |
Dec 14th 2017, 21:28 |
rafael.junqueira.sant |
since the code of flash/error.ctp and flash/success.ctp are almost identical (the only difference is the class of the message container), I assumed there was something behind the scenes happening and giving the variables the right values, but I'm not sure anymore. |
# |
Dec 14th 2017, 21:28 |
dereuromark |
https://github.com/cakephp/cakephp/blob/master/tests/TestCase/View/Helper/FlashHelperTest.php |
# |
Dec 14th 2017, 21:26 |
rafael.junqueira.sant |
what do you mean by test cases? |
# |
Dec 14th 2017, 21:26 |
dereuromark |
do the test cases yield any answers? |
# |
Dec 14th 2017, 21:25 |
rafael.junqueira.sant |
with the slash it actually finds the element, but the variables do not receive the values of the success and error messages |
# |
Dec 14th 2017, 21:24 |
rafael.junqueira.sant |
dot gives an error |
# |
Dec 14th 2017, 21:24 |
rafael.junqueira.sant |
no, slash / |
# |
Dec 14th 2017, 21:24 |
dereuromark |
you mean dot? |
# |
Dec 14th 2017, 21:23 |
rafael.junqueira.sant |
it works with the slash syntax, just tested. |
# |
Dec 14th 2017, 21:22 |
dereuromark |
or you can use the flash plugin which allows you to re-sort via config beforehand. |
# |
Dec 14th 2017, 21:22 |
rafael.junqueira.sant |
I'll try |
# |
Dec 14th 2017, 21:21 |
dereuromark |
or with dot syntax: flash.success etc, check how the code looks for it in the session |
# |
Dec 14th 2017, 21:20 |
dereuromark |
from the code it should probably be only the type, e.g. "success" etc |
# |
Dec 14th 2017, 21:18 |
dereuromark |
where did you get that idea? |
# |
Dec 14th 2017, 21:15 |
slackebot |
$this->element('flash/error'); ?> What I expected to happen was |
# |
Dec 14th 2017, 21:15 |
rafael.junqueira.sant |
This is in my controller: if ($this->Services->save($service)) { $this->Flash->success(__('The service has been saved.')); return $this->redirect(['action' => 'index']); } $this->Flash->error(__('The service could not be saved. Please, try again.')); Here is what's in my template: <?= $this->element('flash/success'); ?> <?= |
# |
Dec 14th 2017, 21:00 |
slackebot |
print the error or success message by default? Flash component documentation page didn't help me in this one. Thank you |
# |
Dec 14th 2017, 21:00 |
rafael.junqueira.sant |
Greetings I am trying to use the flash success and error elements, but it is giving me the error "Notice (8): Undefined variable: message [APP/Template\Element\Flash\success.ctp, line 3]" instead of printing the message. I could fix it, but I'm trying to learn cakephp the conventional way, without jerry rigging it. Although I don't see it clearly in the code how the Flash->render becomes the variable $message, shouldn't it just |
# |
Dec 14th 2017, 17:14 |
inoas |
does cakephp remove them somehow? |
# |
Dec 14th 2017, 17:13 |
inoas |
but if I add them to index.php they do not appear |
# |
Dec 14th 2017, 17:13 |
inoas |
but I don't see any... if I add them to webroot/test-cors.php <?php header('Access-Control-Allow-Origin: *') ?> ... I can see them |
# |
Dec 14th 2017, 17:13 |
inoas |
I am setting up cors headers in .htaccess |
# |
Dec 14th 2017, 16:09 |
salewilliam09 |
it true, you can build with your idea. |
# |
Dec 14th 2017, 16:03 |
meder_ |
so i guess component |
# |
Dec 14th 2017, 16:03 |
meder_ |
but i want to make a general method to take options |
# |
Dec 14th 2017, 16:03 |
meder_ |
it's not going to be exactly the same, it'll be customized per each controller |
# |
Dec 14th 2017, 16:02 |
salewilliam09 |
If you want dynamic function, i'm thinking build common or components. |
# |
Dec 14th 2017, 16:01 |
salewilliam09 |
You should build main-Controller and extend from Main for sub-controllers. |
# |
Dec 14th 2017, 15:59 |
meder_ |
i have 1 controller and some code that creates a new entity on a model. i want to do similar functionality in another controller - should i throw this into a model function or a component? |
# |
Dec 14th 2017, 15:56 |
salewilliam09 |
Hi all, I have problem with query and subquery same table Tags, I thinking this is big issue from QueryBuilder? |
# |
Dec 14th 2017, 15:47 |
Hendrix |
Hi |
# |
Dec 14th 2017, 15:44 |
spencdev |
hmic It worked. Thank you |
# |
Dec 14th 2017, 15:31 |
hmic |
anywhere else that gets executed before you fire the event is fine too |
# |
Dec 14th 2017, 15:31 |
spencdev |
I took the documentation waaaaay to literal. Thank you, i'll give it a shot |
# |
Dec 14th 2017, 15:31 |
hmic |
bootstrap.php is a save place |