WordPress 24-Hour Trainer. Plumley George

Чтение книги онлайн.

Читать онлайн книгу WordPress 24-Hour Trainer - Plumley George страница 3

WordPress 24-Hour Trainer - Plumley George

Скачать книгу

the case in the early days of the Internet, when most web pages were stored as single HTML files. The fact that no assembly was required to produce the code you see in your browser is why they are called static files. They're easy to create and they load quickly (an important factor at a time when computers and Internet speeds were slow), but they aren't flexible. Suppose you decided to change the logo at the top of each of your website's pages, and it had a new file name. With static files, you would need to manually go in and replace the HTML in every file. Not so bad on a 5-page site, but what if you had 5,000 pages? Yes, there's such a thing as search-and-replace functions in HTML editors, but aside from the fact that methods like that are not user-friendly, they solve only one limitation of static files. Suppose you wanted an entirely different header area depending on what part of your site the visitor is on?

The answer is to break up the structure of web pages in such a way that different files control different parts of the final page. So instead of storing web pages as single files, the server would store a series of files that are then assembled into a single file at the moment the page is requested by someone's browser. It is this assembly process that leads us to refer to these types of web pages as dynamic. Figure 1.1 shows one way to split up a static HTML file.

Figure 1.1

      Notice 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

Скачать книгу