On Wed, 2002-10-30 at 19:41, Tobias Roth wrote:
> Hi
Greetings!
> I probably missed this in the manual, but what is the difference
> between an 'active' and an 'normal' page (the choice in asgard)?
"Normal" or static pages serve only URI requests directed at
themselves. For example, if a page "info" is located under
the root page of non-prefixed host, it would answer at:
/info/ or /info
If /info/misc/ would be called and there wouldn't be such
a page in the system, the request would give a 404 error.
Active pages also respond to URI requests below them in
the hierachy and receive the additional directories as
arguments. For example, a request at:
/info/company.html
Would be directed to the active page "info", which would
receive string "company" as PHP variable $argv[0].
This can be continued further. For example:
/info/company/financials/annual/2002.html
Would be directed to "info" which would get the following
PHP variables:
$argv[0] : ("company")
$argv[1] : ("financials")
$argv[2] : ("annual")
$argv[3] : ("2002")
Also, variable $argc would contain the number
of arguments received (4 in this case).
An easy way to use this is to show articles from a
topic tree. An example:
<?php
/*
Show articles under a topic tree by their "filename"
*/
$my_topic = mgd_get_topic_by_name(0,"Info");
if ($argc >= 1) {
$article = mgd_get_article_by_name($my_topic->id,$argv[0]);
if ($article) {
// I would add the previous example's article handling code here
?>
<h1>&(article.title);</h1>
&(article.content:f);
<?php
} else {
// No article found or incorrect arguments
?>
<h1>Error 404, not found</h1>
<?php
}
} else {
?>
<h1>&(my_topic.name);</h1>
&(my_topic.description:f);
<?php
$art = mgd_list_topic_articles($my_topic->id,"score");
if ($art) {
while ($art->fetch()) {
$safename = rawurlencode($art->name);
?>
<p><a href="&(safename);.html">&(art.title);</a></p>
<?php
}
}
}
?>
/Bergie
--
Henri Bergius [EMAIL PROTECTED]
Consultant Partner Tel: +358-20-198 6032
Nemein Oy http://www.nemein.com/
Nemein.Net - Project tracking solution for consulting companies
http://www.nemein.com/Nemein.Net/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]