I'm beginner in programming, i use cakephp 3.3 version and i want to understand how to activate session and use in controller and how to send flash message like this:$this->session->flash('items was updated'). What line have to add to activate session and where, how to use correctly? Thanks!
https://www.google.co.nz/url?q=http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html&sa=U&ved=0ahUKEwj8soeQ6N7QAhWGzbwKHTXsCuQQFggLMAA&sig2=Yi_7YH9XKwQ3sZvzd0kpeA&usg=AFQjCNGz10_vrov2Lw7bCkB5sgc2b8asOA
have a look on here
have you used setFlash in the controller and are you using the default layout??
have you also followed the blog tutorial i think that went over using flash messages ands its a great tutorial
Related
I'm building a suite of REST micro-services using .Net Core 3.0 Preview 6. All these services will have the same start up logic. So, I'm trying to place all the code in a .Net Standard library.
The goal is to have the IHostBuilder:CreateHostBuilder method, as well as the Startup:Configure and Startup:ConfigureServices class and methods in the library. The library will also contain error handling logic, customized http response messages, etc.
However, I can't seem to find the correct package that contains the ConfigureWebHostDefaults method. I tried adding the Microsoft.AspNetCore package 2.2.0, but that didn't resolve the issue.
I added the Microsoft.Extensions.Hosting (3.0.0-preview-6) package, that also doesn't resolve the issue.
Is what I'm attempting even possible?
Thanks
-marc
I resolved it, not the best way, but it works. I decided to make the library targeted specifically for .NET Core 3.0. So, I changed the targetframework in the project file. That change automatically resolved my other issue.
Import the Microsoft.AspNetCore package, and use WebHost.CreateDefaultBuilder() instead. According to the code it is built from, both CreateDefaultBuilder() and ConfigureWebHostDefaults() call the same internal method: ConfigureWebDefaults().
The only downside of this is that the returned host will be an IWebHost instead of an IHost.
I have develop my web application by using cakephp 3.1. My service provider has update the php version to 7.2. Now my application is not work well, as it was working with PHP5.6, Its showing different warnings with debug=true; and the big problem is its not showing line which have some problem, if some is there. Here is warning message.
Warning: count() [function.count]: Parameter must be an array or an object that implements Countable in D:\xampp7\htdocs\bighris\vendor\cakephp\cakephp\src\Database\QueryCompiler.php on line 115
In case some errors are there its not showing it, in the following way, there I can't find the line number and the file which have the problem.
https://www.screencast.com/t/qIQB1YIW
Please help me to solve the issue, Thanks
As per the Cakephp github issues:
PHP 7.2 has changed count's behavior
that's why you are getting errors.
PHP 7.2 has changed count's behavior causing problems with QueryCompiler
You can follow the below link or change your PHP version to 7.1 or less to resolve this issue.
Stop warnings when using count in QueryCompiler in PHP 7.2
it looks like you are passing some wrong data to count function, guess you are passing some query directly to count. Or something like that.
If you may show the code of the controller you are facing issue it may be a great help.
there is solution for you....
2020-09-30 06:22:30 Warning: Warning (2): count() [function.count]: Parameter must be an array or an object that implements Countable in [D:\xampp\htdocs\gym_master\vendor\cakephp\cakephp\src\Database\QueryCompiler.php, line 126]
please check your php version...
I'm building a codeigniter 3(.1.9 older version) apps using mysql, I need to extend / override codeigniter $this->db,
so if myapps using
$this->db->insert
$this->db->update
$this->db->replace and
$this->db->delete
there will be a log in a file for CRUD actions.
You cannot Change/Modify/Replace Database classes.
According to CodeIgniter Official Documentation
"The Database classes can not be extended or replaced with your own classes. All other classes are able to be replaced/extended."
You can check the Official Documentation here.
I don't really understand what is the utility of this operation:
soomla::CCStoreController::sharedStoreController()->storeOpening();
In the documentation it is said this should be called when you want to show the storefront, but I'm coding my own storefront.
Thanks in advance.
We have removed those functions. You don't need to call storeOpening() and storeClosing() anymore.
If you're on Android AND you have your own storefront, you should call startIabServiceInBg() and stopIabServiceInBg() when you open and close your storefront. You don't have to do that though.
storeOpening() and storeClosing() methods are just for create and delete Store instance for platform API's. If you are creating Store Layer then just call them in onEnter() and onExit() methods respectively.
I often see Grails sample code where the programmer has called a method called encodeAsHTML(). I figure I should probably use this in my Grails applications (for security reasons, I assume?), but I was wondering when I should use this method. What objects/properties/etc. are candidates for the encodeAsHTML() method?
Thank you!
Use encodeAsHTML() (or encodeAsJavaScript, etc) for everything that you've got from user. For every string that could be modified by user (got from input form, from request parameter, from external API call, etc)
See also:
https://en.wikipedia.org/wiki/Cross-site_scripting
https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet
https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
I am not sure when this was introduced to Grails, but if in Config.groovy you set grails.views.default.codec="html" then encodeAsHTML() is called whenever you use ${} in GSPs.
Source: http://alwaysthecritic.typepad.com/atc/2010/06/grails-gsp-html-escaping-confusion.html