Re: Suggestion for the News site



Joakim Ziegler wrote:
> 
> On Fri, Feb 09, 2001 at 08:21:29PM -0500, Miguel de Icaza wrote:
> 
> >> With all due respect, Miguel, you seem to not quite know what you're talking
> >> about here. I've been seeing what people want to do with the GNOME site for
> >> over a year now, and I might have some better idea of this.
> 
> > Well, as I stated in my mail I might not know what are the solutions,
> > but I would get the idea that content management would be based around
> > keeping information in a representation-independent location and have
> > this mapped into HTML at some point.
> 
> Ok. Your alternatives for this are basically either some sort of XML
> representation, or a database. Neither will allow you to do
> "representation-independent" content, since you'll have to store some level
> of HTML-like formatting in the database or XML (unless your XML is very
> high-level, like DocBook, but I *really* don't think we want to do that sort
> of thing). Not to say that specific parts of the content, like the newsitems
> on Gnotices, should be flat HTML files or HTML files with some templates, but
> that'll always be specific to each application and subsection of the site.
> I've used many of, and looked at about all web content management systems
> in existence, at least the free ones, over a span of about 8 years, and let
> me tell you, there's no system that does what you want in a general fashion.

Perhaps there is no system but we could make one :). The main idea is to
store the content in one file, and make one extra file for each
representation system you want.
For example in PHP could be:
The index.php file (if you points your browser (or PDA, etc) to
http://gnome.org/devel/index.php?output=htm&lang=es), calls another file
who have the content and knows how to translate it. Pieces of content
are dumped to string variables. Next the index.php, replaces the tags in
the selected template (the kind of output you want) with these variables
and outputs the result back to the browser.
You always have the same tags (that represents content pieces), the only
thing you need to transform the output in different ways is to place
these tags in different ways in different templates.

If we enhance the idea, we could easy make nice things. For example:
* we can do an "url library", so if you want to make a link to a page or
piece of information, you only need to link to the correct entry in the
library.
* an "edit this page" system, so people can easy edit contents.
* a "track this page" system, so if the page changes people could be
notified.
* and many others like "print this page" or "send this page to a
friend".

If you can read some php code, here is the basic idea:

index.php (the url you want to see)
------------------------------------
<?php
// Selects the correct template, from the $output var in HTTP_GET_VARS
if ($output == 'htm'){
	$tamplate = 'index.htm';
}
$tpl = new Template ($template, $output);
// Cache system
if ($tpl->is_cached()){
	$tpl->send_cached_page();
	exit;
}
// Executes index.msgs
include ('./index.msgs');
// Assign template tags to vars from index.msgs
// a template tag could be something like {TITLE} inside the template
$tpl->assign(array(
	TITLE => $title,
	BODY => $body)
);
// We can do a render system, so if the output is other than html,
// translates msgs to it. For example: <a href="url.htm">here</a>
// should become: "here: url.htm" if the output selected is plain text.
$tpl->render_msgs();
// Replace all the template tags with its messages
$tpl->parse ();
$tpl->send_to_browser();
?>

index.msgs (storage content and process tranlations)
This file is data for .po files
----------------------------------------------------
<?php
// reads the $lang var from HTTP_GET_VARS
putenv ("LANG=$lang");
bindtextdomain ("myPHPApp", "./locale");
textdomain ("myPHPApp");
// translate messages
$title = gettext ("This is the title");
// messages are in some kind of restricted html language, so the
// render can easy transform it to another formats
$body = gettext ("This is the long body <a href=\"./more.php\">here
more</a>".
		"but the this <b>body</b> is very important");
?>

index.htm (the html template)
-----------------------------
<html>
<title>{TITLE}</title>
<body>
{BODY}
</body>
</html>

index.txt (the plain text template)
------------------------------------
Title: {TITLE}
~~~~~~~~~~~~~~
{BODY}


Tomas V.V.Cox




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]