Skip to main content

Posts

Showing posts with the label PHP

Using Angular with Laravel / Conflict between Laravel Blade and Angular

The Conflict: Peoples who are using Laravel and AngularJs may know, Laravel’s Blade templating engine and AngularJs uses the same markup when displaying variables {{ variableName }} Solution 1 (Laravel): Laravel Blade template engine comes with an option to change the literal tags. so if you want to keep the angular syntax, then include the following code in  app/routes.php //general syntax Blade::setContentTags('<%', '%>'); //for escaped data: Blade::setEscapedContentTags('<%%', '%%>'); Solution 2 (AngularJs): AngularJs comes with an option to change the literal tags using $interpolateProvider It should be declared within your module. angular.module('MyApp', [], function($interpolateProvider) { $interpolateProvider.startSymbol(' '); });

Exception Handling in PHP

Notices:   These are trivial, non-critical errors that PHP encounters while executing a script Example :  Accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all - although you can change this default behavior . Warnings: These are more serious errors Example: attempting to include() a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination. Fatal errors: These are critical errors Example: Instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHP’s default behavior is to display them to the user when they take place. Parse Error: When we make mistake in PHP code like, missing semicolon or any unexpected symbol in code What are Exceptions? Exceptions are the PHP 5 way of flagging up an unexpected event. They contain an info...