BLOG:CMS :: Support Forum

Support Forum for BLOG:CMS

You are not logged in.

#1 12.04.2005 19:23

Chris..S
BLOG:CMS Senior
Registered: 14.01.2005
Posts: 78

Updates to NP_OffsetArticles & NP_LatestItems

The same simple update to each of these two plug-ins to allow the blog to be specified.  Update does not break any existing use of the plug-in.

In each plug-in file the same two changes need to be made.

(1) add another parameter, blogname='' to doSkinVar() function

(2) replace line containing $blogid = getCurrentBlogId(); with $blogid = (!empty($blogname)) ? strval(getBlogIDFromName($blogname)) : strval(getCurrentBlogId());

NP_OffsetArticles.php - summary of changed code

Code:

   function getDescription() {
      return 'This plugin displays previous X and next X articles, and also date and time of last comment made. Use <%OffsetArticles(n,page,blog)%> at the end of default skin and <%OffsetArticles%> in default template.';
   }

...

   function doSkinVar($skinType, $numOfPosts= '5', $postsPerPage= '5', $blogname = '') {
      $offset=0; 
      if (isset($_GET['offset'])) $offset=intval($_GET['offset']); 
      $data = explode("/",serverVar('REQUEST_URI'));
      for ($i=1;$i<count($data);$i++) if ($data[$i]=='offset') $offset=intval($data[$i+1]);
 
      $today=date('d.m.y',time());
      $onedaybefore=date('d.m.y',strtotime ("-1 day",time()));
      $twodaysbefore=date('d.m.y',strtotime ("-2 days",time()));
      
//      $blogid = getCurrentBlogId(); 
      $blogid = (!empty($blogname)) ? strval(getBlogIDFromName($blogname)) : strval(getCurrentBlogId());

NP_LatestItems.php - summary of changed code

Code:

   function getDescription() {
      return 'This plugin displays links to the most recent n items of the specifed blog.
              Usage: &lt;%LatestItems(n,blog)%&gt;';
   }

...


   function doSkinVar($skinType, $numOfPosts= '5', $blogname= '') {
      $blogid = (!empty($blogname)) ? strval(getBlogIDFromName($blogname)) : strval(getCurrentBlogId());

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson

TOPlist