[pmwiki-users] Re: data from wiki page rather than file

chr at home.se chr at home.se
Thu May 5 06:58:02 CDT 2005


On Wed, 4 May 2005, Patrick R. Michaud wrote:

> On Wed, May 04, 2005 at 05:55:01PM -0700, Carl Boe wrote:
> > In general, is there an accepted way to have markup for a page depend upon 
> > and manipulate raw content in another page, not just include it?  Could 
> > this be done with knowledge of modification times, so that a cached page 
> > does not have to regenerate if its dependencies are older than its last 
> > modification date?
> 
> Yes, this can happen -- in general one uses the ReadPage() function
> to get at the wiki page data (or RetrieveAuthFunction() if authorization
> issues need to be handled). 

Maybe it'd be convenient for cookbook authors if there was a function that
they could call to extract text data from wiki pages. Maybe the function 
could be invoked like this:

	$textArray = GetDataFromPage($page, $OptStartTag, $OptEndTag);

where if there are no optional tags, the entire page is returned as a
string in $textArray. However, with tag arguments, the function would scan
for tag-pairs and only return the data in between the tags.  For example,
let's say I have this page:

	bla bla bla
	(:mydata:)
	data data data...
	(:mydataend:)
	bla bla bla

	(:mydata:)
	data2 data2 data2...
	(:mydataend:)

then this invocation

	$textArray = GetDataFromPage($page, '(:mydata:)','(:mydataend:)');

would assign the array $textArray as follows:

	$textArray == array('data data data...', 'data2 data2 data2...')

Just a thought (I know a function like this could be useful to me).

/Christian

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr





More information about the pmwiki-users mailing list