PHP – Web Design Ledger https://webdesignledger.com By Web Designers for Web Designers Thu, 21 Apr 2016 20:49:41 +0000 en-US hourly 1 https://wordpress.org/?v=6.4.3 https://webdesignledger.com/wp-content/uploads/2015/08/cropped-Web-Design-Ledger-512x512-Pixel-32x32.png PHP – Web Design Ledger https://webdesignledger.com 32 32 Using .htaccess to Make URL SEO Friendly https://webdesignledger.com/using-htaccess-make-url-seo-friendly/ https://webdesignledger.com/using-htaccess-make-url-seo-friendly/#comments Mon, 18 Apr 2016 19:00:16 +0000 http://webdesignledger.com/?p=34963

Everyone wants to rank their site on the first page of search engine results. There are many factors which influence search engine rankings, and one of them is human readable URLs or SEO friendly URLs. A SEO friendly URL must reflect the content of the site or blog. To know more about SEO friendly URLs, […]

Read More at Using .htaccess to Make URL SEO Friendly

]]>

Everyone wants to rank their site on the first page of search engine results. There are many factors which influence search engine rankings, and one of them is human readable URLs or SEO friendly URLs. A SEO friendly URL must reflect the content of the site or blog. To know more about SEO friendly URLs, you can read this article from Search Engine Journal.

How to Make URLs SEO Friendly Banner

There are two ways you can make human readable URLs in PHP. One, by using Request_URi method and second via the .htaccess file. In this tutorial, I will be coming up with SEO friendly URLs for the blog using a .htaccess file. You can use the same practice to create the same for any store.

Let’s get started.

Let us suppose you are running a blog which is developed using custom PHP code. So, whenever you insert a new post on your blog, then the URL will be generated like this:

www.yoursite.com/index.php?blog_id=1234

In this tutorial, we will be changing the above URL to this:

www.yoursite.com/my-seo-url/

So whenever a person runs the above URL, the same content will be generated as generated when you are giving a blog ID to URL.

Step 1: Changes in Table

First, you need to alter your table in which your article is saved. Create a new column in it and name it seo-url.

Step 2: Function to Make SEO Friendly URL

Let us create a function which will generate SEO friendly URL for you based on the article title.

  
function seo_url($vp_string)

    {

        $vp_string = trim($vp_string);

        $vp_string = html_entity_decode($vp_string);

        $vp_string = strip_tags($vp_string);

        $vp_string = strtolower($vp_string);

        $vp_string = preg_replace('~[^ a-z0-9_.]~', ' ', $vp_string);

        $vp_string = preg_replace('~ ~', '-', $vp_string);

        $vp_string = preg_replace('~-+~', '-', $vp_string);

        $vp_string .= "/";

        return $vp_string;

    }

The above function will take article title as a string and return SEO URL. Like this:

my-SEO-URL/

You need to save this URL in the same column which we created in the previous step.

Step 3:  Changes in .htaccess file

Since we have generated an SEO URL, let us make some changes in .htaccess which will redirect the URL to the content that is saved in the database. If you haven’t created any, then create a new file and name it .htaccess. Now paste the following code in it:

RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(([A-Za-z0-9]+[-]+[A-Za-z0-9]+)+[/])$  index.php?blog_url=$1    [NC,L]    # Handle blog requests

Let’s understand the above code step by step:

The first line is telling Apache that we are going to rewrite some rules

RewriteEngine On

The second and third line is a condition which is checking that the calling URL is not a file or directory name. If it is one of them, the URL will not be rewritten.

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

And the last line is our rewrite URL. Now here’s how this is working: The word after RewriteURL  “^(([A-Za-z0-9]+[-]+[A-Za-z0-9]+)+[/])$” is a Regex expression which checks the URL after the “slash(/)” of a complete domain name. You can use this site to learn more about Regex.

Now if the URL is matched by Regex expression the matched URL will then be redirected to index.php?blog_url=(matched URL) in the blog_url variable.

Note: If there is an error in .htaccess file you will get 500 internal server error.

Step 4: Changes in Index File

Now in URL index.php file you will get this URL using $_GET[‘blog_url’] and match this URL from your table and can show the full article quickly. For example, in your index.php file your database query will be changed into this:

$url = $_GET['blog_url'];

$query = "SELECT articles.article_name,articles.article_content,categories.category_name,articles.img,users.u_fname,users.u_lname,DATE_FORMAT(articles.date,'%d %b, %Y') as dates

FROM article

INNER JOIN users

ON users.user_id = article.user_Id

INNER JOIN articles

ON articles.article_id = article.article_id

INNER JOIN categories

ON categories.category_id = articles.category_id

WHERE articles.url = '$url'";

And all things will remain the same. When you run your new URL, you will get the same content as you are getting when sending blog IDs.

Summary

In the article above, I have taught you how to create SEO friendly URLs, what changes will be required and how to redirect the URL. If you are unable to understand it through my article, feel free to contact me or leave a comment below. I’ll get back to you as soon as I can.

Read More at Using .htaccess to Make URL SEO Friendly

]]>
https://webdesignledger.com/using-htaccess-make-url-seo-friendly/feed/ 2
PHP 7: What’s New & How Will It Affect a WordPress Site? https://webdesignledger.com/php-7-whats-new-how-will-it-affect-a-wordpress-site/ https://webdesignledger.com/php-7-whats-new-how-will-it-affect-a-wordpress-site/#comments Thu, 12 Nov 2015 17:39:07 +0000 http://webdesignledger.com/?p=32635

PHP 7, a major update to the server-side web development language PHP, is right around the corner. According to PHP 7 project timetable mentioned on PHP.net wiki, if everything goes as planned, its final version will be released on Nov 12, 2015. Meanwhile, you as a future user may consider playing around with the latest […]

Read More at PHP 7: What’s New & How Will It Affect a WordPress Site?

]]>

PHP7

PHP 7, a major update to the server-side web development language PHP, is right around the corner. According to PHP 7 project timetable mentioned on PHP.net wiki, if everything goes as planned, its final version will be released on Nov 12, 2015. Meanwhile, you as a future user may consider playing around with the latest beta to have an overview of what features the new version of PHP offers and how it will shape up and affect your development work.

If you’re a website developer/owner running their sites on WordPress (or on any other PHP-powered CMS such as Joomla, Drupal, Magento), then you’ve landed to the right blog post. This informative guide will not only give you a taste of what’s new coming in PHP 7 but also will answer all your questions related to the new PHP version!

Wordpress-php7-performance

Drupal on PHP7

Let’s dive in!

What’s New in PHP 7?

First of all, let’s take a closer look at some of the exciting features and improvements that you’ll see in PHP version 7:

Huge Performance Improvements:

PHP has always been criticized for performance-related issues, which is greatly improved in PHP 7. Even, the poor performance of PHP prompted Facebook to build HHVM – a virtual machine designed to maximize the performance of PHP based applications. Since the new version of PHP is based on the PHPNG project (PHP Next-Gen), it gives up to 50% boost to real-world apps and performs faster than HHVM.

Twice as fast as Previous Versions:

PHP 7 is almost 2X faster than PHP 5.x. It not only executes your code faster but also requires fewer servers to handle the same amount of requests per second. As an example, the WordPress homepage now requires 72% lesser CPU instructions to execute than before. That’s because PHP 7 receives a brand new version (refactored) of Zend Engine, which adds a significant speed enhancement to the language.

New Operators:

PHP 7 introduces two new operators: Spaceship (Combined Comparison) and Null Coalescing. Where the Spaceship operator (<=>) makes your chained comparison more concise, on the other hand, Null Coalescing (??) operator is used to check if something exists. However, these both tasks could be accomplished before, but probably not in all conditions.

Return & Scalar Type Hints:

In the new PHP version, developers would be able to use Booleans, Strings, Floats and Integers as type hints for functions. Also, they’ll be allowed to declare the return type of a function. This will save them passing and returning wrong types from functions, which may lead to unpredictable behavior in code.

Engine Exceptions:

Handling existing fatal and recoverable fatal errors has always been a herculean task for PHP developers. But now, exceptions implemented in the brand spanking new Zend engine will facilitate error handling in your application. The new Engine Exceptions will replace these kinds of errors, making it possible for developers to catch all fatal errors and take appropriate action immediately.

Consistent 64-Bit Support:

Even though the native environment of PHP is Linux, but still you can run it on a Windows-powered system. Since the previous versions of PHP doesn’t have support for a large file or 64-bit integer, the x64 builds of PHP for Windows have been considered experimental yet. To the contrary, version 7 features consistent 64-bit support that enables you to confidently run PHP on a 64-bit Windows system.

Group Use Declarations:

PHP 7 introduces a new concept, called Group Use Declarations, which dramatically improves the implementation of PHP namespace. The new syntax makes it possible for you to import multiple classes from the same namespace. Needless to say, this new feature will save you a lot of typing time and also make your code shorter and readable.

Supports Anonymous Classes:

Like other programming languages such as Java and C#, the new version of PHP enables you to use anonymous classes in your code. An anonymous class is a class with no name. When used properly, anonymous classes can not only improve your coding but also can speed up execution time to a great extent.

Abstract Syntax Tree (AST):

Another big change made to PHP core is the use of Abstract Syntax Tree (AST) as an intermediary stage in the language compilation process. This improvement would mainly be visible to developers and not have any direct impact on userland code. There are several advantages of using AST, including the potential for more optimizations, the scope for utilizing tools like static code analyzers and better code quality etc.

Deprecated Items Removed:

To make PHP even faster, a number of deprecated functionalities and dead or unsupported Server APIs and extensions have been eliminated from the version 7.  Some of the items that are removed from PHP 7 are PHP4 style constructors, ASP style tags, ereg and MySQL extensions etc. For more details, you may check out removed deprecated functionalities in PHP7.

But, where is PHP 6?

After getting acquainted with the exciting features of PHP 7, you would definitely want to know why PHP moved to version 7 from version 5. What happened to version 6? Well, PHP 6 was an experimental project that was officially started in 2005 and unfortunately abandoned in 2010. One of the main reasons behind the termination of version 6 was technical difficulties faced by PHP core developers during the implementation of language-integrated Unicode.

Meanwhile, people around the web adopted the name PHP 6 and started writing books and developing resources related to version 6. Since there might be confusion between the former attempt and the current development work, the PHP core team was compelled to seriously think about the name of the new major release. And finally, the development team decided to skip the logical number 6 and launch the new version under the name of PHP 7.

How Can PHP 7 Really Affect Your WordPress Site?

Despite the fact that WordPress core development team is continuously working on making the CMS ready for PHP7, the latest version of PHP can break your site. The reason is the incompatibility of themes and plug-ins with PHP 7. Even though WordPress has suggested theme and plugin authors to get familiarize with all backward incompatible changes and update things accordingly, most of the themes and plug-ins are not yet ready for the upcoming release of PHP 7.

Since WordPress has started fixing every possible issue related to PHP 7, more and more people are now taking necessary steps toward making their themes and plug-ins compatible to PHP 7. For instance, the author of Simple Social Icons has already updated the plug-in to make it PHP 7compatible. That means, soon after PHP 7 official release, not only WordPress would fully support PHP 7 but also all themes and plug-ins would have been updated to work with version 7. In a nutshell, consider upgrading your site to PHP 7 only when you found everything – hosting server, themes, plug-ins and WordPress – compatible to version 7.

Crucial Things to Consider When Migrating from PHP 5 to PHP 7

So if you’ve decided to move your WordPress site from PHP 5 to PHP 7 right after the official release of version 7, here are some best practices that you should follow to prevent any issues before, during and after migration:

Watch for Notifications:

Before implementing any PHP update, most of the hosting providers send a notification to site owners. The purpose of this notification is to make you inform about the update so that you could keep a look out to see if something goes wrong. So continuously watch for notifications and inform your hosting provider immediately if you found anything wrong.

Backup Your WordPress Site:

Even if you’re fully confident that the PHP update will not break your website, it’s always good to have a fallback plan. Whether or not you receive the notification from your hosting provider, always have a saved copy of your site on multiple locations. This will save you from any unforeseen disaster that may occur during migration.

Keep Everything Updated before Migration:

Before moving to PHP 7 from PHP 5, update all elements – including themes, plugins and WordPress itself – related to your WordPress site. This will prevent these (and other) elements from stop working after PHP gets updated. Also, if a certain element is not compatible with the new version of the language, it’ll no longer function.

Contact Your Hosting Provider:

For further help, you may consider contacting your web host’s support team. In case, your web host is unable to completely resolve your issues, then install a new copy of WordPress and restore your site from a backup.

Author Bio
Ajeet is a senior web developer at WordPress Integration – PSD to WordPress service provider, where he is responsible for writing custom JavaScript code during the conversion process. In his spare time, he writes on different topics related to WordPress, JavaScript and Web Design to share his work experience with others. You can follow WordPressIntegration on Facebook

Read More at PHP 7: What’s New & How Will It Affect a WordPress Site?

]]>
https://webdesignledger.com/php-7-whats-new-how-will-it-affect-a-wordpress-site/feed/ 6
Build a Flat-File Website with Grav CMS https://webdesignledger.com/grav-cms/ https://webdesignledger.com/grav-cms/#respond Wed, 28 Oct 2015 15:33:30 +0000 http://webdesignledger.com/?p=32203

Most PHP CMS’ on the market run a traditional database engine – commonly MySQL. But in recent years PHP developers have been mixing it up to move around towards different paths, one of which is a flat file database system. Grav CMS is one such example. Grav is completely open source and runs on top […]

Read More at Build a Flat-File Website with Grav CMS

]]>

Most PHP CMS’ on the market run a traditional database engine – commonly MySQL. But in recent years PHP developers have been mixing it up to move around towards different paths, one of which is a flat file database system.

Grav CMS is one such example. Grav is completely open source and runs on top of PHP. It uses a variety of great technologies like:

If you already know a lot about PHP then Grav could be worth learning. It’s one of the more exotic choices, but it’s also frequently updated with careful attention to detail.

Grav CMS engine

Visit the Grav GitHub repo to find install documentation & learn more about the system.

You can also learn a lot from the Grav features page and the online Grav learning center.

While currently on version 0.9, Grav is one of the more stable and interesting PHP CMS’ on the market. If you’re curious then download a copy and test it out whenever you have some time.

Interested users can also check out the Grav GitHub page or follow the official Twitter account @getgrav.

Read More at Build a Flat-File Website with Grav CMS

]]>
https://webdesignledger.com/grav-cms/feed/ 0
Phalcon is a PHP Framework with C Extensions https://webdesignledger.com/phalcon-php-framework/ https://webdesignledger.com/phalcon-php-framework/#comments Mon, 26 Oct 2015 19:35:53 +0000 http://webdesignledger.com/?p=32148

Phalcon PHP is a high-performance PHP framework that’s both open source and highly-customizable. It runs on PHP with the ability to also tie into C extensions. If you’re a PHP developer this may already sound confusing. But in truth Phalcon is meant to be quick and simple – the framework can tie into classes & […]

Read More at Phalcon is a PHP Framework with C Extensions

]]>

Phalcon PHP is a high-performance PHP framework that’s both open source and highly-customizable. It runs on PHP with the ability to also tie into C extensions.

If you’re a PHP developer this may already sound confusing. But in truth Phalcon is meant to be quick and simple – the framework can tie into classes & functions found in the C extensions, but they’ll run in PHP code.

Take a look at the install page to get an idea of the setup process.

There’s also a very in-depth documentation area that explains all the primary features and methods you’ll get right out of the box.

Folks who are just getting started will likely have reservations. It may even take some courage just to install & try to use Phalcon. But thankfully there’s an incredible discussion forum along with many Stack Overflow questions to get you on the right track.

You can also try tweeting the official Twitter account @phalconphp with any questions you may have.

Since Phalcon is open source you’ll find everything you need right on GitHub. The repo has a download link for the latest version of Phalcon + basic install instructions.

If you want to see the app in action then take a look at this tutorial video for creating a new Phalcon webapp.

Read More at Phalcon is a PHP Framework with C Extensions

]]>
https://webdesignledger.com/phalcon-php-framework/feed/ 1
Laracasts hosts the best Laravel PHP Screencasts https://webdesignledger.com/laracasts-php-screencasts/ https://webdesignledger.com/laracasts-php-screencasts/#comments Wed, 21 Oct 2015 21:45:47 +0000 http://webdesignledger.com/?p=31816

PHP developers already know the tremendous hurdle it takes to get into writing code. Beginners who only understand HTML/CSS will have an uphill battle – yet somewhere along the way it all starts to “click” and the process becomes so much more enjoyable. But how do you deal with that initial hike up the mountain? […]

Read More at Laracasts hosts the best Laravel PHP Screencasts

]]>

PHP developers already know the tremendous hurdle it takes to get into writing code. Beginners who only understand HTML/CSS will have an uphill battle – yet somewhere along the way it all starts to “click” and the process becomes so much more enjoyable.

But how do you deal with that initial hike up the mountain? And is there any way to make it slightly less miserable?

Laracasts is the alternative to browsing YouTube for videos to teach yourself programming. Laracasts is a premium resource with an incredible library of Laravel + PHP programming screencasts. You can browse through individual lessons for a certain topic, or even dive head-first into collections about higher-level topics like authentication or OOP.

Each video is put together much like the tutorials you’d find on YouTube, but they’re much more concise with a clear focus.

Laracasts will prove useful to developers at all skill levels. Nobody knows everything and to be a good developer you need to thirst for greater knowledge.

Laracasts homepage

The site is managed by Jeffrey Way who puts together screencasts based on his years of extensive knowledge in the PHP/Laravel community. Pricing starts as low as $9/month which is much cheaper than you’d pay for the same education anywhere else.

If you have time check out the Laracasts FAQ page to get a better understanding of how it all works.

You can also find more info on the Laracasts Facebook page or by visiting the official Twitter account @laracasts

Read More at Laracasts hosts the best Laravel PHP Screencasts

]]>
https://webdesignledger.com/laracasts-php-screencasts/feed/ 1
Sphido Open Source CMS written in PHP https://webdesignledger.com/sphido-cms/ https://webdesignledger.com/sphido-cms/#respond Mon, 12 Oct 2015 21:15:20 +0000 http://webdesignledger.com/?p=31878

Much like the other PHP-based CMS’, Sphido stands out for certain unique features that make it worthwhile on certain projects. WordPress is great for blogs & portfolios, Magento is great for eCommerce. Sphido is great for speed and efficiency. It’s a lightning-fast CMS based on a flat file database structure. Naturally this is not going […]

Read More at Sphido Open Source CMS written in PHP

]]>

Much like the other PHP-based CMS’, Sphido stands out for certain unique features that make it worthwhile on certain projects. WordPress is great for blogs & portfolios, Magento is great for eCommerce.

Sphido is great for speed and efficiency. It’s a lightning-fast CMS based on a flat file database structure.

Naturally this is not going to be the best solution for every single project. Sphido is such a small release with a small community that it’s going to be difficult justifying it consistently. But the flat file structure allows for an easier setup and maintenance.

Sphido cms website

The CMS can be installed at a break-neck speed but it’s the config, theming, and structuring that takes more effort.

If you don’t have time to learn a new CMS engine then Sphido will not appeal to you. But if you like to tinker with new stuff then why not give it a shot?

You can pull down a copy of the full CMS from its GitHub repo. Installation can be handled by the dependency manager Composer if you have that installed via command line.

Those who are lost should check the Sphido documentation or check the GitHub issues tab for related info.

Read More at Sphido Open Source CMS written in PHP

]]>
https://webdesignledger.com/sphido-cms/feed/ 0
October: A Free PHP Laravel-Based CMS Platform https://webdesignledger.com/october-laravel-cms/ https://webdesignledger.com/october-laravel-cms/#comments Mon, 05 Oct 2015 18:05:33 +0000 http://webdesignledger.com/?p=31716

Over the past few years Laravel has become one of the most beloved PHP frameworks of the entire industry. It offers a solution for every situation with plenty of room for extending your own libraries. Most CMS engines are built on top of their own libraries but a newcomer named October CMS does just the […]

Read More at October: A Free PHP Laravel-Based CMS Platform

]]>

Over the past few years Laravel has become one of the most beloved PHP frameworks of the entire industry. It offers a solution for every situation with plenty of room for extending your own libraries.

Most CMS engines are built on top of their own libraries but a newcomer named October CMS does just the opposite.

October is a platform meant to get “back to the basics”. It’s completely open source built on top of Laravel with support for themes, extensions, and all the regular stuff you’d expect from a quality CMS engine.

The core is still very small with an overall install base of ~60,000 websites. October’s open source platform currently offers 160+ plugins with 30+ unique themes and a growing audience of supporters every month.

October CMS open source

To get started check out the online documentation to learn more about the admin panel + theme setup. You can also download the full October source directly from the GitHub repo.

If you’re unfamiliar with Laravel then October may offer a slight learning curve. But if you’re willing to stick with it you might find October more user-friendly compared to WordPress or Drupal.

October’s dashboard is perhaps the most interesting aspect of the CMS. It’s meant to be insanely simple for clients who may not fully comprehend the more complex functionality of competitors.

Live examples can be found in the October site gallery with lots of clever design inspiration.

There’s also a free intro video covering October’s dashboard and setup process. If you’re itching for a new PHP-based CMS then check it out and see if it could work for any future projects.

Read More at October: A Free PHP Laravel-Based CMS Platform

]]>
https://webdesignledger.com/october-laravel-cms/feed/ 1