Greetings!
On 22 Jan, Derek Beattie wrote:
> 1) I noticed this code in the admin site. What does it do?
>
> <?php header('Cache-Control: no-cache');
> header('Pragma: no-cache'); ?>
It sends those commands with the HTTP header
that is sent back to the browser. If browser
complies with these instructions, it will not
cache that particular page.
For more information on the PHP header() function,
check out the PHP manual:
http://php.net/manual/function.header.php3
These headers must be sent before any actual
data is sent from the page, so a good place to
put them is either in some of the code- elements
(code-init, etc.) or right in the beginning of
the ROOT element.
> 2) How can I have an article title show up in a specific area of a layout? So,
> if I have a child layout that I used for subpages, I want the header to be the
> article title. How do I do this if the header tags are in the layout?
> In my subpage about I have the following code:
> <? $article = mgd_get_article(24); ?>
> <h2>&(article.title);</h2><br />
> &(article.content:h);
One way to do this would be to assign that particular
page a code-init element, where you would fetch the
article.
code-init:
<?php $article = mgd_get_article(24); ?>
head (or whatever it is on your site):
<head>
<title>
<?php if ($article) { ?>
&(article.title);
<?php } else { ?>
<(title)>
<?php } ?>
</title>
<?php if ($article) { ?>
<meta name="description" content="&(article.abstract);">
<?php } ?>
</head>
content:
<h1>&(article.title);</h1>
<p>&(article.abstract);</p>
&(article.content:h);
> In Page Admin, what is the difference between active and static?
Active pages can take arguments in URI format.
For example, if you have an active page /page/, it
gets arguments by /page/arg1/arg2/arg3.html
You can then process these articles as needed. The
arguments are stored into array $argv.
As an example, to be able to call any article
from your server to the same page, turn that
page active, and configure it like in the
previous example, then create the code-init element.
code-init:
<?php
/* Set the root topic of your topic tree for
validation */
$mytopic = 12;
if ($argc == 1 && mgd_is_article_in_topic_tree($mytopic, $argv[0]))
/*
Check if the article ID given in the URI argument matches
with a real article in my site's topic tree.
*/
$article = mgd_get_article($argv[0]);
/*
If so, fetch the article.
*/
?>
After that, just try calling the page with
/path/to/page/123.html where 123 is the ID
number of an article that resides somewhere
in the topic tree you set to the $mytopic
variable.
> Derek
/Bergie
--
-- Henri Bergius -- +358 40 525 1334 -- [EMAIL PROTECTED] --
http://www.iki.fi/Henri.Bergius
--
This is The Midgard Project's mailing list. For more information,
please visit the project's web site at http://www.midgard-project.org
To unsubscribe the list, send an empty email message to address
[EMAIL PROTECTED]