Mailing List Archive

Mediawiki extension API
I've read the meta-wiki information page on writing your own mediawiki
extension but I have a question on behaviour.

If you write and extension does the tag (extension) get evaluated every
time the article (page) is loaded or just once and then stored in the DB
as is?

Is it's the latter, is it possible to have truly dynamic content using
media wiki? By this I mean writing an extension that will generated
(possibly) different content every time the article is requested.

I have content that is generated every day on my server and I would like
to have it loaded into an article. I've written an extension that does
this but it seems that the content is just loaded once, and then saved
to the DB. I'd like to write something that went and *always* fetch the
content dynamically off my site system (or whatnot).

Thanks,

Jean
Re: Mediawiki extension API [ In reply to ]
On Mon, 06 Dec 2004 20:10:22 +0900, Jean-Christian Imbeault <jci@gol.com> wrote:
> I've read the meta-wiki information page on writing your own mediawiki
> extension but I have a question on behaviour.
>
> If you write and extension does the tag (extension) get evaluated every
> time the article (page) is loaded or just once and then stored in the DB
> as is?

Well, it's kind of half-way between the two: the tag is evaluated
every time the page is *parsed* (it isn't stored as static in the DB),
but due to caching, this is not the same as every time it is *viewed*
(it may be stored by the server, your browser, or some other
intermediate cache).

For possible ways around this (i.e. to force the page to be re-parsed
on every view), you might want to search the archives of this list
and/or the dev list wikitech-l: type "site:mail.wikipedia.org cache"
or somesuch into Google.

I wonder if it would be good to have some method for this built in to
the distributed code - e.g. a way of an extension setting a special
"no-cache" flag on the article in which it was operating, to indicate
that dynamic content has been added; this would be reset whenever the
page was saved in case the tag were removed...? One problem is that
this would need to propogate back from templates somehow: if
[[Template:foo]] contains "<dynamic>stuff that changes every 5
minutes</dynamic>", then any page containing "{{foo}}" will also need
to remain un-cached... until Template:foo loses the dynamic content,
that is... erk...

--
Rowan Collins BSc
[IMSoP]
Re: Mediawiki extension API [ In reply to ]
From what I understand, no. One work-around for this may be to use an
IFRAME (not directly controlled or limited control), which would be
much easier on the server than clearing the cache every night. The
implementation I would suggest is to hard-code the HTML or set up
certain qualifications and filters through which the data has to pass
through.


On Mon, 06 Dec 2004 20:10:22 +0900, Jean-Christian Imbeault <jci@gol.com> wrote:
> I've read the meta-wiki information page on writing your own mediawiki
> extension but I have a question on behaviour.
>
> If you write and extension does the tag (extension) get evaluated every
> time the article (page) is loaded or just once and then stored in the DB
> as is?
>
> Is it's the latter, is it possible to have truly dynamic content using
> media wiki? By this I mean writing an extension that will generated
> (possibly) different content every time the article is requested.
>
> I have content that is generated every day on my server and I would like
> to have it loaded into an article. I've written an extension that does
> this but it seems that the content is just loaded once, and then saved
> to the DB. I'd like to write something that went and *always* fetch the
> content dynamically off my site system (or whatnot).
>
> Thanks,
>
> Jean
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l@Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>


--
-------------------------------------------------------------------
http://endeavour.zapto.org/astro73/
Thank you to JosephM for inviting me to Gmail!
Re: Mediawiki extension API [ In reply to ]
Jamie Bliss wrote:
>>From what I understand, no. One work-around for this may be to use an
> IFRAME (not directly controlled or limited control), which would be
> much easier on the server than clearing the cache every night. The
> implementation I would suggest is to hard-code the HTML or set up
> certain qualifications and filters through which the data has to pass
> through.

Just a few questions. How would an IFRAME help? Does it somehow make the
browser not cache its contents?

Also What do you mean by hard-code the HTML? My content is dynamic, I
can't hard-code anything since it gets generate on the fly. I must be
missing your point :)

Jc
Re: Mediawiki extension API [ In reply to ]
the <iframe> tag is an HTML tag that acts like a frame, but within
another page. So you write an extension that parses the tag <daily>
and translates it into an <iframe> tag. (You can't have an iframe
directly because of security stuff. Imagine if trolls could embed
random pages in a wiki)

If you're really confused, I could probably write you a small sample.

On Tue, 07 Dec 2004 08:54:26 +0900, Jean-Christian Imbeault <jci@gol.com> wrote:
> Jamie Bliss wrote:
> >>From what I understand, no. One work-around for this may be to use an
> > IFRAME (not directly controlled or limited control), which would be
> > much easier on the server than clearing the cache every night. The
> > implementation I would suggest is to hard-code the HTML or set up
> > certain qualifications and filters through which the data has to pass
> > through.
>
> Just a few questions. How would an IFRAME help? Does it somehow make the
> browser not cache its contents?
>
> Also What do you mean by hard-code the HTML? My content is dynamic, I
> can't hard-code anything since it gets generate on the fly. I must be
> missing your point :)
>
> Jc
>
> _______________________________________________
>
>
> MediaWiki-l mailing list
> MediaWiki-l@Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>


--
-------------------------------------------------------------------
http://endeavour.zapto.org/astro73/
Thank you to JosephM for inviting me to Gmail!
Re: Mediawiki extension API [ In reply to ]
I realized I didn't answer your other questions.

An <iframe> is not handled by the MediaWiki software, it is handled by
the browser. So you write a PHP script to handle the seperate page
(and output some HTTP headers to turn off caching) and reference that
in an <iframe>.

When I mean hard-code the html, I mean what is ouputted by the
extension. Meaning that someone can not place a random page (with,
say, an applet or script to hose your computer or make a thousand
popups appear). That is entirely for security.

On Tue, 07 Dec 2004 08:54:26 +0900, Jean-Christian Imbeault <jci@gol.com> wrote:
> Jamie Bliss wrote:
> >>From what I understand, no. One work-around for this may be to use an
> > IFRAME (not directly controlled or limited control), which would be
> > much easier on the server than clearing the cache every night. The
> > implementation I would suggest is to hard-code the HTML or set up
> > certain qualifications and filters through which the data has to pass
> > through.
>
> Just a few questions. How would an IFRAME help? Does it somehow make the
> browser not cache its contents?
>
> Also What do you mean by hard-code the HTML? My content is dynamic, I
> can't hard-code anything since it gets generate on the fly. I must be
> missing your point :)
>
> Jc
>
> _______________________________________________
>
>
> MediaWiki-l mailing list
> MediaWiki-l@Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>


--
-------------------------------------------------------------------
http://endeavour.zapto.org/astro73/
Thank you to JosephM for inviting me to Gmail!
Re: Mediawiki extension API [ In reply to ]
On Dec 6, 2004, at 7:17 PM, Peter Danenberg wrote:
> IFRAME's are so 1999, Jamie; lol. But seriously: use
> the "Expires" header unless you're uninterested in XHTML;
> IFRAME didn't make the cut in 1.1, and you'll be left in the
> cold come 2.0.

There's always the <object> tag... ;)

-- brion vibber (brion @ pobox.com)
Re: Mediawiki extension API [ In reply to ]
> the <iframe> tag is an HTML tag that acts like a frame, but within
> another page.


IFRAME's are so 1999, Jamie; lol. But seriously: use
the "Expires" header unless you're uninterested in XHTML;
IFRAME didn't make the cut in 1.1, and you'll be left in the
cold come 2.0.

--
Peter Danenberg .
wikisophia.org ..:
Re: Mediawiki extension API [ In reply to ]
I know that a lot of the HTML tags were dropped, but the problem of
MediaWiki caching means that either: (A) A lot of code has to be added
to the cacher to detect dynamic content, or (B) that the actually HTML
stored in the cache is static (that doesn't mean that the content
downloaded by the browser as a result of those tags must be static).
The EXPIRES header would be good for the secondary page.

And even if <iframe> has been dropped from the official spec, they are
still heavily used (Gooogle and SourceForge are 2 examples).

So if perfect validation is a concern, you shouldn't use <iframe>
specifically. The basic concept (dynamic support files or secondary
content) is still the same, even if the specific implementation is
different.

On Mon, 6 Dec 2004 19:17:28 -0800, Peter Danenberg
<danenberg@mitdasein.com> wrote:
> > the <iframe> tag is an HTML tag that acts like a frame, but within
> > another page.
>
>
> IFRAME's are so 1999, Jamie; lol. But seriously: use
> the "Expires" header unless you're uninterested in XHTML;
> IFRAME didn't make the cut in 1.1, and you'll be left in the
> cold come 2.0.
>
> --
> Peter Danenberg .
> wikisophia.org ..:
> _______________________________________________
>
>
> MediaWiki-l mailing list
> MediaWiki-l@Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>


--
-------------------------------------------------------------------
http://endeavour.zapto.org/astro73/
Thank you to JosephM for inviting me to Gmail!