# |
Jul 13th 2017, 08:24 |
savant |
I typically just add a value in my application |
# |
Jul 13th 2017, 08:24 |
saeideng |
but i worry about other files |
# |
Jul 13th 2017, 08:23 |
saeideng |
I know I should update bootstrap/middleware/index.php |
# |
Jul 13th 2017, 08:23 |
saeideng |
but |
# |
Jul 13th 2017, 08:23 |
saeideng |
nut I want update that |
# |
Jul 13th 2017, 08:22 |
savant |
we dont set a version in composer.json |
# |
Jul 13th 2017, 08:22 |
saeideng |
i want compare by latest version |
# |
Jul 13th 2017, 08:22 |
saeideng |
how I can to detect cakephp/app version on my exist programs? |
# |
Jul 13th 2017, 08:21 |
saeideng |
hi |
# |
Jul 13th 2017, 08:16 |
marcusgoede |
i do that because i need a place where the bake shell can find the value with the translate function __(‘value’) and put it into the pot file. is there a better way with just one file to maintain? |
# |
Jul 13th 2017, 08:10 |
hmic |
savants one is faster, this is more readable and flxible, i usually prefer using sprintf for string formatting |
# |
Jul 13th 2017, 08:10 |
jarard01 |
hmic thanks - yes I just tried that and I'm going to use that approach |
# |
Jul 13th 2017, 08:09 |
hmic |
jarard01, you could use printf number formatting too like sprintf('%010d', $int); |
# |
Jul 13th 2017, 08:08 |
jarard01 |
thanks savant that worked |
# |
Jul 13th 2017, 08:08 |
hmic |
marcusgoede: why translate on loading the file? - you will not need all of them in every case for sure. so thats quite a bit of wasted resources. just translate them when you output them - this is how it's usually done and best practise anyways! |
# |
Jul 13th 2017, 08:08 |
jarard01 |
hi neon1025 o/ |
# |
Jul 13th 2017, 08:06 |
neon1024 |
Morning everyone |
# |
Jul 13th 2017, 07:58 |
savant |
http://php.net/manual/en/function.str-pad.php |
# |
Jul 13th 2017, 07:58 |
jarard01 |
so 1 would be come 00000001 |
# |
Jul 13th 2017, 07:58 |
jarard01 |
is there a cake way to add or pad a a number with leading 0's |
# |
Jul 13th 2017, 07:29 |
marcusgoede |
ok thanks |
# |
Jul 13th 2017, 07:29 |
savant |
sure |
# |
Jul 13th 2017, 07:29 |
marcusgoede |
it works in AppController::beforeFilter(), is that good practice? |
# |
Jul 13th 2017, 07:29 |
savant |
you can load it in your AppView |
# |
Jul 13th 2017, 07:29 |
savant |
if its only for templates |
# |
Jul 13th 2017, 07:29 |
savant |
i would load it after you’ve set the language. |
# |
Jul 13th 2017, 07:28 |
marcusgoede |
for example options for select inputs like [‘active’ => __(‘active’)] |
# |
Jul 13th 2017, 07:27 |
savant |
what is in that file? |
# |
Jul 13th 2017, 07:26 |
marcusgoede |
where is a good place to load configuration file with Configure::load() which contain translated values with __()? When I load the config in bootstrap.php the values will be translated to the apps default language, not the current one |
# |
Jul 13th 2017, 07:00 |
spriz |
Okay :slightly_smiling_face: Nice to hear I'm not the only one @savant :tada: |
# |
Jul 13th 2017, 06:19 |
savant |
but I wouldnt write the second way normally at the application later |
# |
Jul 13th 2017, 06:18 |
savant |
or plugins/behaviors that need to be generic |
# |
Jul 13th 2017, 06:18 |
savant |
unless im doing some weird stuff with relations |
# |
Jul 13th 2017, 06:18 |
savant |
i use the former |
# |
Jul 13th 2017, 06:17 |
spriz |
Personally I've used the "old" (first) in own project code and the second only in behaviors, plugins etc. |
# |
Jul 13th 2017, 06:16 |
spriz |
Question regarding syntax for the 3.x orm - which one do you prefer and why? https://gist.github.com/Spriz/645b9e96c1430f141f3d49e225e4ede6 |
# |
Jul 12th 2017, 22:03 |
spencdev |
But generally, and I don't know you're situation so take it for what it's worth, you use the same controller as your model, unless it's an associated table. Or like I said, depending on the situation |
# |
Jul 12th 2017, 22:01 |
spencdev |
You can, I just didn't mean that modifying is the ONLY thing you can do |
# |
Jul 12th 2017, 22:00 |
aaronc |
Gotcha, working now. Why did you explicitly state that I can't modify anything from that Model? Should I just create an edit method for each of those controllers and redirect to that if they choose to edit it? |
# |
Jul 12th 2017, 21:57 |
spencdev |
Not modify, but work with |
# |
Jul 12th 2017, 21:56 |
spencdev |
If you're purposely trying to use ListsController to modify Tests table, you have to load that table in using `$this->loadModel('Tests');` |