Magento – Passing data between a controller and a block

You don’t. In Magento’s MVC approach, it’s not the responsibility of the controller to set variables for the view (in Magento’s case, the view is Layout and blocks). Controllers set values on Models, and then Blocks read from those same models. In Magento’s view of the world, having a Block relying on the controller doing … Read more

Set session variable in laravel

The correct syntax for this is: Session::set(‘variableName’, $value); For Laravel 5.4 and later, the correct method to use is put: Session::put(‘variableName’, $value); To get the variable, you would use: Session::get(‘variableName’); If you need to set it once, I’d figure out when exactly you want it set and use Events to do it. For example, if … Read more

HttpContext.Current.Session is null when routing requests

Got it. Quite stupid, actually. It worked after I removed & added the SessionStateModule like so: <configuration> … <system.webServer> … <modules> <remove name=”Session” /> <add name=”Session” type=”System.Web.SessionState.SessionStateModule”/> … </modules> </system.webServer> </configuration> Simply adding it won’t work since “Session” should have already been defined in the machine.config. Now, I wonder if that is the usual thing … Read more

Is there a best practice and recommended alternative to Session variables in MVC

You will never get unanimous opinion on anything in any large group of people. That’s just human nature. Part of that stems from the Dunning-Kruger Effect which states that the less someone knows about a subject, the more likely they are to over value their expertise in that subject. In other words, lots of people … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)