WordPress VS PHP Scripting
This is my comparison and contrast between WordPress(E-reader's digest) and PHP Scripting(Furniture shop) to build websites. If you are interested in learning one or the other, this may give you an enlightenment to make your mind up to decide which one you would start with first.
Both websites have responsive navigation which automatically fits the users' screen size from a single URL. As can be seen below, they are very similar navigations in terms of how they work and are viewed by users. However, there are a few distinctions to achieve the same functionality between the two websites.
The WordPress theme provides a responsive layout as default. Therefore, it doesn’t require any hand-coding unless a user wants to make any customisations for cosmetic purposes. It can be simply created by adding up the menu categories from the admin page.
On the other hand, Furniture Shop requires web programming skill to implement responsive navigation such as comprehending what a responsive design and media query are and how to create grid/flex layouts. For the Furniture shop, CSS bootstrap framework is used to reduce the initial set-up time for CSS. As such, HTML formatting, pictured below, was the prime task and all CSS classes are preconfigured from bootstrap; they have been added to class attributes accordingly in order to create the user interface. Since the navigation is present throughout all pages on the website, it is modularised into
navigation.php in the components folder, so that it can be embedded throughout all the pages by using
<?php includes 'components/navigation.php' ?>.
With E-reader’s digest, the data tables are preconfigured and the data is populated automatically when categories, posts and other data is created by users. The easy-to-use interface is intuitive and allows for the creation of a website even without knowing about the database. At the same time, the provision of preconfigured options in WordPress could be seen to somewhat limit creativity; WordPress might be seen more like a paint-by-numbers picture compared to the blank canvas offered by PHP Scripting.
The database for Furniture Shop was created with phpMyAdmin which supports MySQL with its intuitive web interface. Creating, dropping and modifying tables, columns and data isn’t challenging and it actually can be comparable with the former method thanks to its web interface. But, the difference with WordPress is that the connection and closure of database and query statements should be hardcoded in a PHP file to communicate with the database. Once specific data from products table is called, the relevant data based on columns’ name would be displayed according to a unique product_id. Unlike the former method, the configuration and displaying of columns is up to the developer so that the customisation pertains to the programming logic.
The thumbnail of E-reader’s digest was created by a plugin called Advanced Excerpt. It automatically generates thumbnails of all the posts based on the user’s setting, as can be seen in the image below. While it might be desirable to allow users to have full control of the thumbnail customisation, ‘Advanced Excerpt’ is arguably very helpful for non-technical users.
With regards to Furniture Shop, the thumbnails, which were created by hand-coded PHP, HTML and CSS, can be seen below. The benefit of this method is having full control of the thumbnail component such as styling, layout and content. Owing to the bootstrap framework, the fluid layout was easily achieved by adding a few CSS classes.
- Detail page
The detail page of WordPress was generated by creating a post using its WYSIWYG editor. This is the power of WordPress’ Content Management System (CMS) which provides several component blocks such as Heading, Paragraph, Table, Columns, etc and reusable blocks can be created by grouping them.
This is arguably the best way to create a blog post as bloggers can be creative online without web programming skills and present their work in a way they want to.
While this is the case, when considering an e-commerce website with a thousand products that need to be uploaded, this kind of repetitive creation for each product page could be seen to be cumbersome and inefficient.
On the other hand, the detail page of Furniture Shop avoids the aforementioned potential disadvantage of the WordPress website. Each thumbnail of a product item is wrapped by
<a> tag and the hyperlink contains a query parameter “product_id” with a unique ID for the product. As soon as a user clicks the hyperlink, PHP scripting starts communicating with the database to request the product data which has the same ID from the products table.
Once it successfully retrieves the data, the rest of the codebase runs and the display of the detail page is completed. If not retrieved, it will show an error message. By doing so, it eliminates the onerous amount of work to create each detail page per item.
PHP Scripting requires more time for the initial configuration and codebases should be hard coded to communicate with the database. Besides, the logic which tells a browser what to do and how to do the tasks needs to be explicit. At the same time, PHP scripting generally allows have full control over a website in areas such as layout, styling, performance optimisation, website architecture and Search Engine Optimisation, etc.
It would be fair to say that both WordPress and PHP Scripting have their advantages and disadvantages. Programming is about problem-solving and trade-offs. The best decision would be the most viable and achievable one within the given time, resources and knowledge as a developer.
Hope you find this was helpful for you and why don't you crack on it?