[pmwiki-users] Nested divs needed for blog styling...

Mikael Nilsson mini at nada.kth.se
Mon Dec 12 08:17:21 CST 2005



mån 2005-12-12 klockan 10:41 +0100 skrev Mikael Nilsson:
> I think rather that the loop needs to be reengineered to call
> MarkupToHTML in the inner loop, allowing you to use HTML outside of that
> call...

Something like this....:

Don't apply this, it's an ugly hack.


--- kob.php     2005-12-10 22:24:40.000000000 +0100
+++ kob-1.0.4/kob.php   2005-12-12 15:09:44.901670355 +0100
@@ -424,17 +424,18 @@
     $group  = $pieces[0];
   }

-  $digest = get_raw_digest($group);
-  $html   = MarkupToHTML($pagename, $digest);
+  $digest = get_raw_digest($group, TRUE);
+  //$html   = MarkupToHTML($pagename, $digest);

-  return $html;
+//  return $html;
+  return $digest;
 }



-function get_raw_digest($group)
+function get_raw_digest($group, $converttohtml)
 {
-  global $calendar_months_number, $max_blog_entries;
+  global $calendar_months_number, $max_blog_entries, $pagename;

   $digest = "";
   $entries_found = 0;
@@ -472,14 +473,23 @@
        // find max_entries.  So I figure we can safely add a divider after we've
        // at least one entry
        if($entries_found > 0) {
-         $digest .= "\n----\n";
+          if($converttohtml)
+            $digest .= "<hr>";
+          else
+           $digest .= "\n----\n";
        }
        $entries_found++;

        // Append the entry to the giamondous list
        $snippet  = ReadPage($entryname);
        $stuffing = $snippet['text'];
-       $digest  .= $stuffing;
+       if($converttohtml) {
+           $digest  .= "\n<div class='blogitem'>\n";
+           $digest  .= MarkupToHTML($pagename, $stuffing);
+           $digest  .= "\n</div>\n";
+        }
+        else
+           $digest .= $stuffing;
       }
     }
   }
@@ -669,7 +679,7 @@

   // Get the raw digest for RSS transformation
   //  TODO: Generalize page and group
-  $source = get_raw_digest($blog_group);
+  $source = get_raw_digest($blog_group, FALSE);


/Mikael

-- 
Plus ça change, plus c'est la même chose





More information about the pmwiki-users mailing list