[pmwiki-users] problem with automatic generated includes

Jan Jacobs Jacobsjan at spector.be
Mon Jun 6 04:15:04 CDT 2005


Hi list,

I defined a markup (see end of message), which searches a wiki page for the (:calendarlist:) keyword, and replaces it with the results of the CalendarList function.  This markup is defined to be run before the include markup is applied, because I will be generating (:include:) inside the CalendarList function.

This almost works like a charm!  I am able to see if a page exists for a certain date, and display the contents on an overview page (something like Outlook Today).  However, some things are not completely correct.  When the target page starts with a list without anything before it (no whitespace, no other text), then the first item is not recognized as a list item on the page with the include.  When the target page ends with a list without whitespace or other text, then the UL list is never closed, resulting in messy markup later on the page.

However, when I make these includes manual on a test page, everything is processed correctly.

Simple testing code is included below.  To test it out, just make a page name on the wiki with as name the date of today, formatted as yyyymmdd.  Put a list of 3 items on it, like: 

*test 1
*test 2
*test 3

without whitespaces or text before/after.  On another page, just put in (:calendarlist:) and view the results.  If you put in the (:include yyyymmdd:) manually, you will see correct markup, but with my generated include, the page is messy.

What could cause this?

Jan Jacobs

PS: as a late remark: when I don't put in the DIV's around the include, markup seems ok, but with the DIV's, it screws up.

------------------------------------------------------------------------------------------------------------------------------------------------

Markup('calendarlist','<include',"/\(:calendarlist:\)/e","CalendarList(\$pagename)");

function CalendarList($pagename) {
      $r = "";
      $date = strtotime("now");
      $r .= "<div>(:include " . date("Ymd", $date) . ":)</div>";
	return $r;
}


-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20050606/fc8df9a5/attachment.html 


More information about the pmwiki-users mailing list