The best way to learn how to use the WebCore is by example. See the documentation for more information.

The requested URL is always shown first; if a page uses one or more WebCore templates, those are shown afterwards.

00 <?php
01   include_once ('software/webcore_init.php');
02   $Page->title->subject = 'Why earthli WebCore?';
03   $Page->location->append ('WebCore', './');
04   $Page->location->append ($Page->title->subject);
05   $Page->start_display ();
06 ?>
07 <div class="main-box">
08   <div class="columns text-flow">
09     <div>
10       <h2><a id="short_answer">The short answer(s)</a></h2>
11       <p class="quote-block">Because almost all websites need the same basic
12       components in order to be great.</p>
13       <p class="quote-block">Because it's insane to do any kind of software
14       development without a good library.</p>
15       <h2><a id="long_answer">The long answer</a></h2>
16       <p>This is best told as the evolution of a hobby site.</p>
17       <p>You want to build your own website. You'd like to start by posting some of your
18       pithy commentary and build out from there. Polls, reviews, who knows?</p>
19       <p>There are a lot of kits out there to help you out, but they all kind of do
20       the same thing: help you make a blog. Well, what if you want a bit more? What if
21       you want to mix and match features &mdash; even build a whole new type of website?
22       You may still need all the standard equipment these kits provide, but using
23       them might seriously handcuff your creativity.</p>
24       <p class="quote-block">What you need is an honest-to-goodness website-building
25       library. Period.</p>
26       <p>You need something that's designed from the get-go to be extendible, customizable and
27       that doesn't make unalterable assumptions about what you want. On the other hand,
28       it's got to provide all of the stuff you might need.</p>
29       <p>Tricky.</p>
30       <h2><a id="old_fashioned">Building your site (the old-fashioned way)</a></h2>
31       <p>Let's walk through building your website <em>without</em> a library.</p>
32       <h3><a id="stage_1">Stage 1: Basic blogging</a></h3>
33       <p>Maybe you want to be able to post a bunch of links on a page, or, better yet,
34       write up stories or journal entries, blog-style. Ok, that shouldn't be too hard.
35       Just pop the text in there and you're up and running.</p>
36       <ul>
37         <li>Static web pages aren't really too maintainable, so you get yourself a
38         database and start storing your stories there.</li>
39         <li>Maybe you should know when you posted each story. Add a field for that.</li>
40         <li>Maybe you've got a friend who's posting stories too. You'd like to know who
41         posted what. Add a field for that.</li>
42       </ul>
43       <h3><a id="stage_2">Stage 2: Security rears its ugly head</a></h3>
44       <p>You can't both update the same page at the same time; that's just asking for
45       trouble. So, you need a place where you can add stories with a web form. You've
46       got to make a form and make it validate the content.</p>
47       <ul>
48         <li>Who gets access to the form?</li>
49         <li>Just you and your buddy right? What about future editors?</li>
50         <li>How do you protect that page? Apache or system users and/or groups?</li>
51       </ul>
52       <p>So your site's getting users and they're noticing some typos. They're sending
53       you emails, but would like to comment on the story directly. Now you've got to
54       extend your form to support editing existing stories. You've also got to build
55       in something that lets users make comments (but not create or edit stories).</p>
56       <ul>
57         <li>Who gets to edit what?</li>
58         <li>Can your buddy edit your stories?</li>
59         <li>Who's allowed to make comments?</li>
60         <li>Can you ban unruly users?</li>
61         <li>What is a user? Do people just enter a name when the make a comment?</li>
62       </ul>
63       <h3><a id="stage_3">Stage 3: Formatting and layout</a></h3>
64       <p>You're getting fancier stories and you'd like to put in lists and images and
65       other fancy formatting. No problem; you're entering your stories in raw HTML
66       anyway. So are your users when they make comments.</p>
67       <ul>
68         <li>How do you stop someone from posting malicious JavaScript to your site?</li>
69         <li>It would be nice to have paragraphs and basic formatting just show up
70         automatically.</li>
71         <li>Which tags are allowed and which aren't?</li>
72       </ul>
73       <p>You want to link in an image you made. You've got to attach it to the system
74       somehow. Just FTP it up and dump it in a folder, then reference it. Easy. Don't
75       forget to make a thumbnail.</p>
76       <ul>
77         <li>How do you upload files? How do users upload files? (They probably shouldn't
78         have FTP access.)</li>
79         <li>What if you or a user forgets the thumbnail?</li>
80         <li>What if they don't know how to make one? Or put it in the wrong spot? Or
81         name it wrong?</li>
82       </ul>
83       <h3><a id="stage_4">Stage 4: Bells and whistles</a></h3>
84       <p>Users think it would be cool to get notifications when a new story is posted.
85       They don't think HTML emails are cool (too much junk and too many viruses).</p>
86       <ul>
87         <li>You can't realistically keep HTML and plain-text versions of your stories
88         around.</li>
89         <li>You'll have to parse the hell out of your HTML format just to look OK as
90         plain text.</li>
91       </ul>
92       <p>Users think skinning the site is cool too; they're getting bored of your same
93       old theme and layout. You want to get fancy with CSS, but you need to first
94       figure out which browser you're targeting.</p>
95       <ul>
96         <li>Time to redesign your pages to share common styles (maybe you already did
97         that).</li>
98         <li>Time to hack together a <a href="features.php#browser">browser-detector</a>
99           to degrade gracefully (for IE).</li>
100       </ul>
101       <h3><a id="stage_5">Stage 5: Searchability/usability</a></h3>
102       <p>Your stories are getting bigger, but you don't always have time to write it
103       and post it. You're saving stuff on your desktop in text files before posting.</p>
104       <ul>
105         <li>Wouldn't it be cool if you could store unfinished stuff in a hidden area on
106         your site?</li>
107       </ul>
108       <p>You've got quite a few stories now and it's getting harder to find stuff. You'd
109       like to be able to find all the stories you've created. In the last month. Of a
110       certain topic. It would be nice to split stories into different sections, so
111       users can more easily find what they want.</p>
112       <ul>
113         <li>Users want to be able to subscribe to specific sections.</li>
114         <li>They also want to save their searches because they're sick of making them
115         again and again.</li>
116         <li>Saved searches are pretty cool. Can I print this list? Can I show it on my
117         user home page?</li>
118         <li>Do I have a user-specific home page? What can I customize?</li>
119       </ul>
120       <h3><a id="stage_6">Stage 6: Security rears its ugly head II</a></h3>
121       <p>The site's humming along and you want to make a registered-user only area.
122       There are also some private areas for editors and premium users/subscribers. You'll
123       need to make some sort of user groups just to keep it manageable. You need to
124       define who gets to do what.</p>
125       <ul>
126         <li>Security's getting to be a nightmare, what with public/private areas, hidden
127         files and all that.</li>
128       </ul>
129       <h3><a id="stage_7">Stage 7: PostGreSQL sounds cool</a></h3>
130       <p>MySQL seemed like a good choice at first, but its full-text search isn't
131       doing it for you. You'd like to flip to a different database and see how that
132       works.</p>
133       <ul>
134         <li>Too bad your SQL is all over your site and some of it's pretty MySQL-specific.</li>
135       </ul>
136       <p>And, finally, the <em>killer</em>...</p>
137       <h3><a id="stage_8">Stage 8: Reuse</a></h3>
138       <p>Now you think you'd like to open up a site for game reviews. You can't just
139       start simple, can you? You've got to have all of the same features as your story
140       site, right up front. Too bad the code for your story site just kind of grew and
141       isn't all that refactorable.</p>
142       <p>Time to start copy/pasting...</p>
143       <h2><a id="spare_grief">Spare yourself the grief</a></h2>
144       <p class="quote-block">Focus on your <em>own</em> application's features, not a <em>web</em>
145       application's features.</p>
146       <p>When you think about making a website, you know exactly what you want. You
147       want everything, but you don't have the time (and maybe not the skills) to do it.
148       So you skip it all and put up something fast. It works for a while, but you have
149       to spend way too much time on details instead of adding more application-specific
150       functionality.</p>
151       <p>When you start with an earthli WebCore application, you've already got an
152       enormous base of software on which to build. You can focus on things that make
153       your application <em>special</em> instead of rushing to catch up with all of the
154       features that make your application <em>great</em>.</p>
155       <h2><a id="general_solution">A general solution</a></h2>
156       <p class="quote-block">Don't let the limited reusability of other products
157       define your application.</p>
158       <p>You may have noticed that the product we built above exists already. It's
159       called SlashCode or PHPNuke or Mambo. Bulletin boards like PHPBB, vBulletin and
160       other do those things too. They also have a lot of other bells and whistles, but
161       most of these products are really domain-specific. What if you want to make a
162       photo-album manager (just off the <a href="./app_albums.php">top of my head</a>)?
163       <ul>
164         <li>Could you use one of these to do that without some pretty heavy modification?</li>
165         <li>Is there a clear-cut interface between the core functionality and
166         application-specific functionality?</li>
167       </ul>
168       <p>Probably not.</p>
169       <p>That's what the earthli WebCore offers: you get to reuse code for similar
170       tasks in vastly different applications. What's more, with a clean separation
171       between application and library code, if a new, advanced feature like moderation
172       is added (a la Slashdot), it can be written generically and made available for
173       any WebCore application that wants to use it.</p>
174       <h2><a id="finished_products">Finished products</a></h2>
175       <p class="quote-block">It's not just theory &mdash; it really works.</p>
176       <p>This application/library separation isn't just a theory. It already exists
177       and there are, to date, four applications built on top of the WebCore: <a href="./app_albums.php">Albums</a>,
178       <a href="./app_news.php">News</a>, <a href="./app_projects.php">Projects</a> and <a href="./app_recipes.php">Recipes</a>.</p>
179       <p>Two of them, News and Recipes, are relatively thin layers: they don't add to
180       the base functionality of the WebCore very much at all. Looking at the code, you
181       see that these applications mostly focus laser-like on defining the UI for the
182       application. The core logic is already in place, so you're free to define
183       properties and decide how the app's going to look.</p>
184       <p>Albums and Projects are larger applications, adding a lot of properties and
185       utilizing multiple object types within one application, journals and pictures in
186       Albums and changes, jobs, components, branches and releases in Projects. At each
187       point, the application only contains code to define features specific to its
188       problem domain. Projects doesn't need to implement threaded commenting. The
189       WebCore's already got that covered.</p>
190       <p>On the other hand, the WebCore is fully object-oriented (as far as PHP 4.x
191       allows), so it's not a big deal to create a customized comment object for an
192       application and link that in instead. If you need more properties, you just
193       define them in a descendent class and tell your application to use that class
194       instead when creating/editing/storing comments. Find out more in <a href="features.php#customizing">customization</a>.</p>
195       <h2><a id="conclusion">Conclusion</a></h2>
196       <p>Websites are software. Writing HTML may not be programming, but making a good
197       website today sure is. While PHP is free, fast and pretty easy to use, it doesn't
198       deliver the tools you really need to make a great website. If you use only PHP
199       to build your site, you've got a long hard slog ahead of you.</p>
200       <p>Do yourself a favor and <a href="download.php">try out</a> the earthli
201       WebCore. You'll be glad you did.</p>
202       <p class="info-box-bottom">Still not convinced? Read more about earthli WebCore's
203       extensive <a href="features.php">features</a>.</p>
204     </div>
205     <div class="right-sidebar text-flow">
206       <h2>
207         Table of Contents
208       </h2>
209       <ul>
210         <li><a href="#short_answer">The short answer(s)</a></li>
211         <li><a href="#long_answer">The long answer</a></li>
212         <li>
213           <div>
214             <a href="#old_fashioned">Building your site (the old-fashioned way)</a>
215             <ul>
216               <li><a href="#stage_1">Stage 1: Basic blogging</a></li>
217               <li><a href="#stage_2">Stage 2: Security rears its ugly head</a></li>
218               <li><a href="#stage_3">Stage 3: Formatting and layout</a></li>
219               <li><a href="#stage_4">Stage 4: Bells and whistles</a></li>
220               <li><a href="#stage_5">Stage 5: Searchability/usability</a></li>
221               <li><a href="#stage_6">Stage 6: Security rears its ugly head II</a></li>
222               <li><a href="#stage_7">Stage 7: PostGreSQL sounds cool</a></li>
223               <li><a href="#stage_8">Stage 8: Reuse</a></li>
224             </ul>
225           </div>
226         </li>
227         <li><a href="#spare_grief">Spare yourself the grief</a></li>
228         <li><a href="#general_solution">A general solution</a></li>
229         <li><a href="#finished_products">Finished products</a></li>
230         <li><a href="#conclusion">Conclusion</a></li>
231       </ul>
232     </div>
233   </div>
234 </div>
235 <?php $Page->finish_display (); ?>
236