Function Overloading and Overriding in PHP

FUNCTION OVERLOADING AND OVERRIDING IN PHP

Function Overloading and Overriding concept come from polymorphism of OOP. According to Object Oriented Programming, function overloading means multiple method/function have the same name but different parameters. And in the child class having the same name, same parameters as in its parent it called method overriding.

Generally, PHP doesn’t support function overloading directly like other languages such as C++, JAVA etc. But we can overcome this issue with using the PHP magic method __call().

Function Overloading:

If we convert this snippet of code in C++ or JAVA, then it will be working properly. This is the basic example of function overloading for C++ or JAVA programming language. but this code will not work for the PHP. It will show “PHP Fatal error: Cannot redeclare SocialMedia::sharaMessage()” error message. But if we want to do something like that, then we will have to use PHP magic method __call().

Solution:

See the above code snippet, here __call function is triggered when invoking inaccessible methods in an object context.

Function Overriding:

Function overriding is quite easy in PHP. Overriding is the process of modifying something of the inherited method. In the OOP sense if a parent class has a function (e.g testMethod()) and another class inherited from that parent class. And that child class has same method (e.g testMethod()), that means child class’s testMethod() overring the parent class’s testMethod(). That’s call function overriding.

Example:

From the above code snippet, you can see ParentClass class sharing() function. ChildClass inherited from ParentClass. And ChildClass also has the same function sharing(). So ChildClass’s sharing() overriding his ParentClass class.

I hope this article will help you to understand the function overloading and overriding in PHP. Happy Coding!!!

The awkward truth about HTML E-mail Templates

Most of email clients don’t support every type of HTML content we see on the web. Web browser are able to display only scripts, animations, and complex web applications, while  typical email inbox isn’t built to handle those type of content.

So with this article , i’ll  cover up about content types to avoid in your email designs, and what to use instead.

Email HTML v. Web HTML

The viewing technology of a typical email client isn’t as up-to-date as a web browser. Web browsers display interactive, dynamic content, and they update often. But interactive elements like Flash, JavaScript, or HTML forms won’t work in most email inboxes.

View the table below to learn more.

Safe to use

Use with caution

Do not use

  • static, table-based layouts
  • HTML tables and nested tables
  • template width of 600px-800px
  • simple, inline CSS
  • web-safe fonts
  • background images
  • custom web fonts
  • wide layouts
  • image maps
  • embedded CSS
  • JavaScript
  • <iframe>
  • Flash
  • embedded audio
  • embedded video
  • forms
  • <div> layering

Things to remember Designing a Mobile Friendly Website

Keep it Easy

Remember that simplicity is an absolute necessity for a mobile friendly website. Even for a desktop site, overloaded contents should not be good. If a mobile website is heavy  it means no friendliness at all. But to make an over-complicate website is much easier.

Be Concise

What’s the motivation behind the plan of a mobile application or mobile websites? That is getting clients where they require as speedy as could be expected under the condition, with least taps, swipes, and consideration required. If a screen can be skipped, skip it – there must be nothing unnecessary on a mobile website.

Open the Door

In any case, before your guests even begin surfing over your site, they need to enter it. Since the server distinguishes cell phones, ensure that mobile guests are naturally redirected to the mobile page.

Consider the Context

At the point when choosing contents and features for your site, don’t rush, think them over, think what your visitors will require and what they’ll search for. It can be an element of direct correspondence amongst you and your visitors (a telephone number, a tick to call, a feature of web-based booking/reservations and so forth.). It can be a chart of principle services with data; you may give clients location if vital. You characterize what’s essential in your specific business that must be first conveyed to the consideration of mobile visitors.

Keep it Short

Try not to permit a lot of content contribution for clients. It’s a significant issue in the world of tablets, smartphones, where writing something that surpasses a tweet, a message or a comment, is awful. Even you require filing a form for reasons unknown, as signup, ensure it’s short – a login/email and a password, or whatever. Each extra field decreases client fulfillment.

Brand it

Obviously, you need the design of your site to showcase your brand with logo, colors, and style, make it noticeable. There’s dependably a method for carefully consolidating them into the design, without hurting ease of use.

Don’t Overcrowd

Try not to want to put a lot of data on one screen page. That is doing a reversal to crowding the interface and making route troublesome. Any visitor must be empowered to effectively scroll through pages of your site, with no weight on consideration.

Keep Clear

Keep your mobile pages as clear as could be allowed. If it’s expected to get to the full data on some issue, there can be a link to the full form of your website.

Design for the Screen

Your designers will counsel you on settling on choices about the looks of your mobile site. These are such standards as the legitimate size of buttons and spaces between them (to anticipate tapping a wrong button); ignoring from overloading pages with different pictures; or deserting those meddlesome popups. These and different recommendations will make your site more good-looking – in light of the fact that here appeal implies comfort being used.

The Importance of Open Graph (OG) Tags

The OG protocol permits to transform a site into items in social sites’s graph. This permits to modify what and how the data moves from a site over to a guests’ Facebook page, and from that point to their companions’ pages.

The tags let you decide people seeing about the site when they view a like, comment or share on their timeline. This implies when a client clicks a Like button on your page, a connection is made between your page and the client. Your page will show up in the “Preferences and Interests” area of the client’s profile, and you can distribute upgrades to the client. Your page will appear in similar spots that Facebook pages appear around the site.

blog_image

OG Site Name :

The site name tag should look like this –
<meta property=”og:site_name” content=”Site Name” />

This one isn’t an obligatory tag, so peoples won’t see it in any data that shows up with a social sites like, comment or share.

 

OG Title Tag :

<meta property=”og:title” content=”The Title” />

This is how it defines the contents title. It serves a comparable need as the customary meta title tag in the code. The Title text shown on Facebook feed is in bold and extremely eye-catching. There is no restriction on the quantity of characters, yet it’s best to remain somewhere around 60 and 90.

 

OG Description Tag :

The Description tag looks like this –

<meta property=”og:description” content=“Enter a description” />

Similarly as with the title, the depiction should be as convincing and drawing in as you can make it to guarantee that peoples seeing a specify of your page on their Facebook Timeline will need to visit. Similar remains constant for Google+ discussions. Make them need to visit your site basically in view of what your portrayal says in regards to your page.

 

OG Type Tags :

There are two Type tags: website and article. They look like this –

<meta property=”og:type” content=”website” />
<meta property=”og:type” content=”article” />

The Homepage of a site is website and every other page of a site is an article. The principle contrast between the two is that a Like will say “[FB user] likes a link.” for a site (home page) and “[FB user] likes an article.” for other pages.

 

OG URL Tag :

The URL tag look like this –

<meta property=”og:url” content=”http://www.yourdomain.com/” />

This tag is always the full URL of the page. In the example just above, this is for the home page.

 

OG Image Tag(s) : 

The Image tag looks like this…

<meta property=”og:image” content=”http://www.yourdomain.com/selected-image.jpg” />

The image attribute tags look like this …
<meta property=”og:image:type” content=”image/png”>
<meta property=”og:image:width” content=”1120″>
<meta property=”og:image:height” content=”1080″>

 

About OG Tags :

There’s never been a superior time to begin looking into and enhancing your titles and depictions. Also, there’s never been a superior time to compose convincing, engaging with content the first run through, so that you never miss the opportunity to transform a potential guest into a glad guest, one who then shares your site to every last bit of her companions!

Secure Your WordPress Website

WordPress is now the most popular CMS(Content Management System) in the world. According to data from the WordPress website 25% of the all website in the world is using WordPress CMS. When that many websites run on same platform, there is a risk of possible security breach due to some exploits or bugs in  the CMS or in the web server. So, you must be prepared for all possible catastrophe. So, always follow the best practices.

1. Get a good web hosting

The first thing you need to do is, choosing a good web host provider. When selecting web host avoid providers who don’t have properly updated web server. Select a provider with regular updates of software , provide great supports, keep backup of your data and most importantly have a great track record.

2. Always keep the core updated

WordPress frequently provides with important security updates and bug fixes. This updates keep you safe from known security issues and bugs in WordPress itself. Not updating the WordPress will make your site unsecured and buggy. To help you in this, WordPress have a option to keep Auto-Update on. Thus, WordPress will automatically update itself when a security update is available.

3. Use up-to-date plugin and themes

When choosing for a plugin or theme, make sure they provide regular updates. Avoid plugin or theme which is not updated for 1 year or more. Just like the core, you must use updated version of the plugin or themes to make your websites safe.

4. Use Plugins/Themes from trusted provider

You should always plugin from trusted developer to make sure they don’t contains malware. Providers Like, wordpress.org official directory, themeforest.net, woothemes and other reputed marketplace make sure the quality of the product they deliver. You should read the review of previous users before deciding to use.

5. Use Backup and Security Plugin in WordPress

WordPress have some pretty backup and security plugin available. Make sure you are using one of them. If possible use offsite backup, limit login attempt and configure notification on file updates or modification.

6. subscribe to a monthly maintenance package

Many company provides monthly maintenance package for very little cost. If you don’t have lots of technical knowledge or are not willing to spend a long time maintaining your website, you should have subscribe to such services. They will take care of all aspects of this.

Here in Preview Technologies we provides a very good WordPress Maintenance service. If you need it, please contact with our sales departmentword