WordPress 24-Hour Trainer. Plumley George. Читать онлайн. Newlib. NEWLIB.NET

Автор: Plumley George
Издательство: Автор
Серия:
Жанр произведения: Зарубежная образовательная литература
Год издания: 0
isbn: 9781118996393
Скачать книгу
in Figure 1.1 that the only file that would be unique to this particular web page is content html. The rest of the files – header, footer, and so on – would be shared by the other pages on the site. So changing that logo for 5,000 pages would simply be a matter of changing the header.html file. If you can start thinking of your web pages in this way – as a set of parts that can be assembled on-the-fly in different ways – you're more likely to think of ways to use this ability to your advantage.

For example, it could be that the actual content of a web page (the material in content.html in Figure 1.1) might be broken down further to allow for greater flexibility. News stories, press releases, or testimonials are good instances of this kind of content. Using testimonials as an example, you can see in Figure 1.2 how dynamic web page thinking could be applied:

Figure 1.2

      Although the value of dynamic web pages is obvious, the concept is not of much use to website owners unless the files required to run them are easy to manage. You could build a dynamicwebsite – even a sophisticated one – with just a set of simple text files. But that would require the website manager to know HTML and other assorted languages, and to be comfortable working with tools such as file transfer programs. Moving those simple text files into a database to increase their flexibility only further complicates the work of the website manager. Enter the content management system, or CMS.

      Content Management Systems

      Most of us tend to think of a CMS merely as a way to avoid having to learn HTML, but editing the text and media on a web page is just a part of what a CMS does. A content management system is a user interface for dynamic web pages.

      Imagine for a moment you had a CMS that provided only a WYSIWYG interface for the full HTML of each individual web page. If you had a 5-page website that rarely changed, that might be enough. But suppose, even on a 5-page website, that you decided you didn't like the top section or header that appears on all the pages of your site. Yes, the CMS makes it easy to drag and drop a new graphic into the header area of the pages, but you'd still need to change the graphic on all 5 pages separately. Now imagine that task on a site with 500 pages or 5,000! Even with search-and-replace capabilities, you would need to upload all 5,000 pages back onto the server to replace the old version, and then do it all again for the next change. Ouch!

      A CMS, however, is much more than a WYSIWYG editor. You want the CMS to keep separate all those elements of a dynamic web page that you saw earlier: the header, footer, sidebar, and so on, and to manage not only their contents, but also how they interact with each other. A CMS instructs the server how to assemble any particular web page based in part on elements you control using its interface.

      From the look of the page to which sidebar elements to include, a CMS provides ways for nontechnical users to control their web pages. The question then becomes: Does your CMS offer a lot of control and an easy-to-use interface?

      Why Choose WordPress?

      There's no shortage of content management systems these days – good ones – but the reason for choosing WordPress as your CMS is twofold:

      ● The simplicity and flexibility of WordPress's design make it easy to learn, easy to expand, and easy to customize.

      ● The WordPress community is so large and so vibrant that you have a huge number of add-on functions and designs to choose from, as well as excellent support, and will have for years to come.

      It's important to keep in mind that no CMS can fulfill everyone's needs right out-of-the-box. The more a CMS tries to be all things to all people, the more bloated it becomes, and that means a steeper learning curve and a greater chance it will break down. A good CMS follows the principles of digital thinking and keeps as many elements separate as possible, meaning each one is fairly simple but when assembled offers great power.

      WordPress is built on this principle. The core software does only basic functionality, to which you then easily add other functions as you need them or remove them when you don't. The look of WordPress is entirely separate from the core software, so it, too, is easily changed. And all these elements outside the core can be modified or new ones can be created to match your exact needs.

      But even the best CMS is only as useful as the community that supports it, and WordPress has community. Whether there is someone building new add-on functionality, offering advice in forums and blog posts, or selling development services, WordPress is the most-supported CMS on the planet.

      How WordPress Assembles Pages

      Part of thinking like WordPress is having a general grasp of how it works. There are four elements of WordPress that interact to create HTML pages: the core files, the theme files, plugin files, and the database.

      The core is the set of files that you download from WordPress.org that provide not only the basic functionality, but also the coordination between all the other elements.

      The theme files have two key functions: Provide the set of HTML files that assemble the final web pages, and control the design of those pages.

      Plugins are groups of files that add more functionality to WordPress. Some plugins consist of a single file, whereas others can have dozens or even hundreds.

      The database has several functions. It keeps track of all the parameters of your WordPress installation, from which themes and plugins you have to the preferences of each individual user. It also stores the text portion of your content. When you write a blog post, for example, it is stored in the database, along with any references to media files, which are stored in folders on the server.

Figure 1.3 shows a simple diagram of how these four elements interact.

Figure 1.3

      The arrows going back and forth between the elements begin to demonstrate the incredible amount of interaction required to generate a web page in a matter of seconds. The number of requests or queries made to the database averages approximately 40 or 50 for a typical WordPress page. Dynamic web pages are not cheap. They can place a heavy load on server resources if a lot of people try to access the site at one time. That's why many sites use a caching system with their CMS, which means that snapshots are taken of each page and stored as single, static HTML pages, avoiding all the back and forth between files and the database. The caching system keeps track if any changes are made to a page and takes a new snapshot as needed. That way you have the advantages of both dynamic page generation and static page serving.

      The advantages of keeping these four elements of WordPress separate are many. Changing the look of your site is as simple as changing the theme. If a plugin starts causing problems for your site, you simply remove it and plug in a new one. If a new social media platform becomes the next big thing, someone will come up with a plugin to interact with it – or you can have your own made. When WordPress needs updating, your site's options and preferences remain untouched in the database. And if your host gives you poor service, you just copy all the files and the database, and move them to a new server.

      But, although WordPress by its nature as a CMS and through its particular design produces dynamic web pages, its built-in tools can go only so far. Sites using WordPress can be more or less dynamic in nature depending on how the user works with WordPress's tools. Some of the power and flexibility in your site comes down to you.

      Your Role in Making Your Site Flexible

      As mentioned earlier, a good CMS needs to have a simple user interface, and WordPress lives up to this requirement. Actually, it was that ease of use that first led me to use WordPress on my clients' sites. Even as it has grown more complex, the developers of WordPress have continually worked to keep the interface user-friendly.

The