1. Trang chủ
  2. » Công Nghệ Thông Tin

Tự học HTML và CSS trong 1 giờ - part 69 pot

10 99 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 440,41 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Content Management Systems and Publishing Platforms Throughout the course of this book, you’ve learned how to build websites by hand, creating HTML pages one by one.. These types of appl

Trang 1

This page intentionally left blank

Trang 2

Content Management

Systems and

Publishing Platforms

Throughout the course of this book, you’ve learned how to build websites

by hand, creating HTML pages one by one In this lesson, you learn how

to use applications to manage aspects of your website These types of

applications are generally called content management systems, and I

explain how to use them to keep track of your content so that it’s easier

to publish and maintain

In this lesson, you learn the following:

n How content management systems came into being

n How to decide whether to use a content management system for

your website

n What the common types of content management systems are

n How to work with hosted web applications in general

n How to use four popular content management applications:

WordPress, Drupal, TypePad, and MediaWiki

Trang 3

The Rise of Content Management

Content management systems were invented to deal with the complexity and tedium of

managing large collections of HTML documents by hand A content management system

is an application that manages website content in a form that’s convenient for editing and

maintenance and publishes the content as HTML Some content management systems

generate HTML programmatically on-the-fly, whereas others generate static files and

publish them Most content management systems are web applications themselves Users

enter and manage content via HTML forms, and the content management system takes

care of storing the content in a database of some kind Generally, content management

systems provide some kind of facility for creating templates and then merge the content

entered by users with the templates to produce a finished website When templates are

updated, all the pages that use those templates automatically have the changes applied to

them

Content management systems were initially deployed at the largest sites, such as online

news sites, online catalogs, and technical sites that published lots of data These systems

were generally custom built and rather complicated Content management eventually

became an industry unto itself, with many companies producing large, expensive systems

aimed at publishers, large corporate websites, and other customers who had lots of web

content and a few hundred thousand dollars to spend to deploy a system to manage that

content

At the same time, content management systems aimed at individuals also became

increasingly popular, except that they weren’t called content management tools Instead,

they were called weblogging (blogging) tools, wikis, photo galleries, and so on

These days, most websites are built using content management systems of some kind,

and some of the largest and busiest websites utilize content management tools that were

originally aimed at individuals running small sites For example, one of the busiest sites

on the Web, Wikipedia.org, is an encyclopedia written and edited by volunteers that was

built using a content management system called a wiki Wikis started out as a way to

make it easy for individuals to quickly publish content on the Web without any

knowl-edge of HTML Now you can download and use MediaWiki, the tool behind Wikipedia,

free of charge You’ll learn more about it later in this lesson

Content Management in the Cloud

These days, many web publishers do not even host their own content management

sys-tems They subscribe to applications provided by companies that specialize in managing

these sorts of applications So, for example, instead of installing the WordPress blogging

tool, you can just sign up for an account at WordPress.com and set up your blog,

658 LESSON 22: Content Management Systems and Publishing Platforms

Trang 4

avoiding the task of downloading WordPress, installing it on a server, and making sure

that it all works The advantage is ease in getting started and reduced maintenance over

time, and the disadvantage is lack of control When you set up your own copy of

WordPress, you can install your own themes and plug-ins, or even modify WordPress

itself if you need to Using the version of WordPress provided by WordPress.com

elimi-nates some of that flexibility

The other major trend in web development is sites making it easy to use content from

websites on other websites In Lesson 12, “Integrating Multimedia: Sound, Video, and

More,” you learned how to upload videos to YouTube and then embed those videos in

your own pages Doing so enables you to avoid the hassle of encoding video yourself,

renting space to put the videos online, and providing a player that works in every popular

browser Allowing this kind of flexibility is becoming increasingly common So, rather

than going out and finding one tool that gives you all the features you require, you can

mix and match tools as needed to offer your users exactly the kind of experience you

want

By combining services that provide content management, user community features, and

multimedia hosting, you can offer your users capabilities that, not too long ago, would

have been completely out of reach for the individual web publisher Right now, in an

afternoon, you can create a new blog on WordPress.com, populate it with videos hosted

on Vimeo, and allow your users to discuss the videos using a third-party comments tool

like Disqus (http://disqus.com/)

Is a Content Management System Right

for You?

It might seem odd to talk about using an application to manage your content now after

you’ve worked through 21 lessons explaining how to build web pages from scratch

However, those skills will serve you well whether you use a content management system

or not Content management systems can take a lot of drudgery out of web publishing

without limiting the amount of creativity you can apply in designing your web pages

Some work is involved in learning, setting up, and customizing a content management

system When you’re creating a website, it’s probably easier to start with just a few static

files and leave aside the content management system As your site gets bigger, though, at

some point the work involved with dealing with static files offsets the initial investment

required to start working with a content management system You have to figure out

whether that initial time investment will be worth the effort

22

Trang 5

Another common trade-off with content management systems is that they vary in

flexi-bility Some, such as photo galleries, are built to handle specific kinds of content You

wouldn’t use photo gallery software to manage an online news site, for example Others

are more flexible For example, Drupal is designed as a generic content management

sys-tem for any type of content Generally speaking, the more flexible a content management

system is, the more work it is to set up So, if you know you’re publishing a photo

gallery, setting up a photo gallery package probably makes more sense than setting up a

general-purpose content management system and customizing it to present photos

In Lesson 20, “Putting Your Site Online,” I talked about the various options for web

hosting A similar set of options is available when it comes to content management

sys-tems You can write your own This provides the most flexibility, but it can be a huge

amount of work You can install and manage an application that someone else wrote and

customize it for your own needs Generally, to go this route, you need your own server or

at least an account with a web hosting provider The final option is to sign up for a

hosted application For many kinds of web applications, free versions are even available

They make sure that the servers stay up and that the application is running properly, and

you just focus on entering your content and making whatever customizations are

avail-able Hosted applications are generally the least flexible, but they’re also the easiest to

get started with

Types of Content Management Systems

Content management systems can be sorted into rough categories As you’ve probably

figured out, there’s more to it than just deciding to use a content management system

You have to figure out what type of content you have and which content management

system makes the most sense for you In some cases, multiple content management

sys-tems may be the answer You might prefer to publish your writing using a blogging tool

and to publish your photos using a photo gallery application Here’s a discussion of some

common types of content management systems

Blogging Tools

It seems you can’t escape the term weblog (or more commonly, blog) these days A web

log is just a website where new items are published in reverse chronological order The

items can be articles, links, recipes, photos, or anything else Generally the most recent

items are displayed on the front page, the site maintains an archive of earlier material,

and in many cases the site allows users to publish comments of their own You can find

blogs on just about any topic of interest, and increasingly blogs are integrated into other

types of websites For example, many magazines and newspapers publish blogs as part of

660 LESSON 22: Content Management Systems and Publishing Platforms

Trang 6

their sites Companies are using blogs to communicate directly with their customers

Political campaigns are using them to get their message out In large part, the reason

blogs have taken off is that the format is easy to work with You can publish short items

as frequently as you like, and users know that when they visit the site they’ll always see

the latest and greatest information right up front In this lesson, I discuss a blogging

package you can install yourself called WordPress as well as a hosted blog tool called

TypePad Google also offers a hosted solution that’s free to use called Blogger, which

you can find at http://www.blogger.com, and many people are starting to use Tumblr

(http://tumblr.com), a tool that makes it easy to create a blog around snippets found on

other sites You may want to check them out, too

Community Publishing Applications

Community publishing applications are similar to blogging tools in that they are usually

built around publishing items by date right up front They differ from blogging tools in

that they are more centered around providing features for all the site’s users, not just the

site’s author or authors Generally, these applications enable users to register as members

of the site, submit stories, and engage in discussions among themselves Sites that

incor-porate this kind of functionality include http://reddit.com/ and http://digg.com/

Drupal (http://drupal.org) is the most popular application in this category right now It’s a

community publishing system written in PHP The application is written in a modular

fashion so that you can include only the features you want

Wikis

Wiki-style systems take the most radical and counterintuitive approach to content

man-agement Most wikis not only allow anyone to view articles but also to edit them Some

wikis require users to register before they can view or edit articles, but the wiki

philoso-phy is that every user is an editor When most people hear about this concept, they

imag-ine that the result will be anarchy, but as long as there is a critical mass of users who

want the wiki to be useful, this type of system is resistant to attempted defacement

Wikis generally keep a history of changes made to every article, so it’s easy to go back to

an older version of a page if someone deletes things he shouldn’t or otherwise submits

unwanted changes

The most famous wiki is Wikipedia (http://wikipedia.org), an online encyclopedia

writ-ten and edited by volunteers Not only can anyone view the articles in the encyclopedia,

but they can also edit them If you know something about Fargo, North Dakota, that’s not

already in Wikipedia, you can look it up there and add your own information Attempted

vandalism is taken care of by volunteers who keep an eye out for it, and volunteers

han-dle disputes over controversial content, too

22

Trang 7

The name wiki comes from the name of the original wiki software, which was called

WikiWikiWeb, taken from an airport bus route in Honolulu, Hawaii To read more about

the nature of wikis and their history, why not read about them in Wikipedia? The URL is

http://en.wikipedia.org/wiki/Wiki

Aside that everyone can edit the pages in a wiki, the other distinguishing feature of

wikis is that they generally provide their own markup language rather than HTML

Generally wiki markup is less flexible than HTML but also a bit easier to get the

hang of Unfortunately, wiki markup usually differs between wiki software packages,

so learning MediaWiki’s markup language won’t help you out a whole lot if you start

using TWiki, for example

Wikis aren’t right for every project If you want to publish your poetry online, putting it

up on a page where anyone can edit it probably isn’t a good idea On the other hand, if

you need a site where a group can collaboratively write documentation for a project, a

wiki can be a great choice Here’s a list of other popular wiki applications and hosts:

n WikiWikiWeb (http://c2.com/cgi/wiki)—The original wiki.

n MediaWiki (http://www.mediawiki.org/)—The software behind Wikipedia I

dis-cuss it more later in this lesson

You can find a comparison of various wiki software packages at

http://en.wikipedia.org/wiki/Comparison_of_wiki_software

There’s also a list of hosted wikis that you can use at

http://en.wikipedia.org/wiki/Comparison_of_wiki_farms

Image Galleries

As digital cameras have grown more popular, so too has sharing photos online There are

many photo-sharing sites online that you can use to host your photos Some popular

choices include Flickr (http://flickr.com/), Picasa (http://picasa.google.com/), and

SmugMug (http://smugmug.com)

If you just want to upload pictures and share them with your friends and family

mem-bers, these sites provide an easy way to do that In some cases, however, you might want

to host your own image galleries A number of popular image gallery applications are

available that vary in terms of complexity and the extent to which they can be

cus-tomized The good ones take care of creating thumbnails of your images for you so that

you can just upload your photos without dealing with image-editing programs

662 LESSON 22: Content Management Systems and Publishing Platforms

Trang 8

General-Purpose Content Management Systems

There are far too many general-purpose content management systems to list here Some

content management systems are just toolkits that enable you to build something on your

own Others are highly structured with tons of features that you control via configuration,

rather than by writing code on your own Here are some features that these

general-pur-pose content management systems tend to have in common:

n Templating system—All content management systems provide some way for you

to specify how your content will be laid out on the page and how the pages

con-taining the content will look Most templates take the form of HTML files with

special markers that indicate where each piece of content goes In many cases, the

templates are just regular PHP, JSP, or ASP pages In other cases, the content

man-agement system will provide its own template language

n Data repository—Content management systems produce web pages, but they

usu-ally store the data in some structured format, whether it’s in a relational database or

in XML files When users enter data, it is stored so that the system can merge the

data with the templates to generate HTML when the documents are

published

n Workflow system—Controlling who gets to edit which content as well as

manag-ing processes for movmanag-ing content from draft to published status are big parts of

many content management systems Some provide rigid systems that you have to

work within; others let you modify the workflow to suit your own organization

Generally, complex workflow features are part of larger content management

sys-tems They’re not useful for individuals or small groups

n System for writing and editing content—All content management systems

pro-vide some way for you to get your content into the system Some enable you to

enter it using HTML forms; others provide integration with external tools such as

Microsoft Word

n System for publishing content—After content is in the repository and has been

approved for publishing, a content management system has to merge that content

with a template and publish it on a web page Some content management systems

produce actual HTML files; others generate the HTML on-the-fly for every

request Which approach is used usually depends on how much dynamic content

appears on the page Most content management systems that don’t publish static

files provide some mechanism for caching so that data that hasn’t changed can be

read from the cache rather than being generated dynamically

22

Trang 9

Working with Packaged Software

So far, this book has been about building things from scratch This lesson, on the other

hand, is about applying tools to make building things a bit easier However, as I’ve

men-tioned, using existing tools can be a job unto itself Before you can start using

MediaWiki to manage your content, you have to download it and get it installed on a

server and configured properly The same is true with any software package Even if you

go with a hosted solution, you still have to set things up so that the software enables you

to accomplish your goals

You may also be wondering at this point why you bothered to learn HTML, CSS,

JavaScript, and everything else in between if you’re going to let an application do your

work for you This is one of the most common misconceptions about this kind of

soft-ware Content management systems make some things more convenient, but you’ll still

apply all the skills you learned over the course of the book to make your pages look the

way you like

Before discussing specific applications, I’m going to discuss some topics that pertain to

nearly all applications of this kind: relational databases and deployment issues

Relational Databases

In Lesson 21, “Taking Advantage of the Server,” and in this lesson, I’ve brought up the

subject of relational databases more than once, but I haven’t explained what they are or

how they work Relational databases are by far the most popular data repository for web

applications There are a number of reasons for that:

n They can scale from the smallest to the largest of applications—You can start a

website on a web hosting account on a server that’s shared with 50 other people

and eventually wind up running 50 servers of your own and use a relational

data-base to store your data the entire way

n They are flexible when it comes to the types of data they can store—All

rela-tional databases store their data in tabular format Each record is a row in a table,

and the columns describe the properties of each record In other words, if you have

a table to store information about people, every person will have the same

proper-ties The actual structure of your tables can be customized to suit just about any

task You can create a table of links that has names, URLs, and descriptions for

each link, or a table of invoices that lists the customer, amount, shipping address,

and item ordered for each invoice The columns in the table can be configured to

hold numbers, dates, short strings, large bodies of text, or even binary files

664 LESSON 22: Content Management Systems and Publishing Platforms

Trang 10

n You can create relationships between tables—That’s where the “relational” in

relational database comes from You can relate articles to authors, invoices to

cus-tomers, or even people to other people within the same table The relational model

is very, very powerful

n Relational databases use a standard query language called SQL (Structured

Query Language)—Although some differences exist between database vendors, if

you know SQL you can work with just about any relational database

n Relational databases are popular—The basic technology behind relational

data-bases hasn’t changed much in the past 20 years, and they are the foundation of

many business applications What has changed is that now several relational

data-bases are freely available, providing powerful features once only associated with

the most expensive software targeted at large corporations Relational databases are

so popular and common that using them for data storage for an application is often

an easy decision

Relational databases are usually deployed as a service that is accessible over the network,

much like an HTTP server The difference is that instead of using HTTP to

communi-cate, the database will use its own proprietary protocol To communicate with a database,

you generally need some kind of client or library provided by the database vendor PHP

has clients for most popular relational databases built in, so you can just use the

func-tions associated with your database and not install anything extra

Most hosting providers that allow you to use PHP, CGI scripts, or some other scripting

environment also provide access to relational databases You may have to fill out a

spe-cial form to have a database set up for you After it’s set up, your hosting provider will

give you the hostname of your database server and a username or password You can use

that information to access the database, or in the case of packaged software, you can use

it to configure the software so that it can access the database

After a relational database is installed, all the administrative tasks—from creating

spe-cific databases to creating and managing users—are accomplished using SQL So to

con-figure a database for a particular application, you generally create a new user and

database for it to use and then run an installation script that creates all the tables that the

application needs and inserts the initial data into the database You hosting provider will

often take care of creating the user and database, and you will run the installation script

that builds the initial database

22

Ngày đăng: 05/07/2014, 20:21