Blogs Module - Short Category not showing

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
ryani210693
Forum Members
Forum Members
Posts: 10
Joined: Wed Dec 03, 2008 11:21 pm

Blogs Module - Short Category not showing

Post by ryani210693 »

Hi.

When attempting to show the 'short category' in the Blogs module on a page with the following...

Code: Select all

{cms_module module='Blogs' show="shortcategory"}
...it returns a blank content area, even though i have specified templates, stylesheets and entries. I already have the standard Blogs showing on a  different page as showing everything, but I'm trying to put a shortcategory on a different page.

When also seeing about specifying the category ID with the following code...

Code: Select all

{cms_module module='Blogs' show="shortcategory" catid="pollyblogs"}
...it returns the following error on the page-

Code: Select all

Fatal error: Call to undefined method Blogs::UnixTimeStamp() in /home/pollymac/public_html/modules/Blogs/action.showshortcategory.php on line 27
Hopefully someone can shed some light on the problem, even though i do already understand there are some bugs within this module; though I have searched on the forum and cannot find anyone with the same problem i am having.

Cheers. Ryan.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Blogs Module - Short Category not showing

Post by Dr.CSS »

That error sounds like a time/date problem you may have to remove any calls for time/date and see if it works then try the newer date parameters...
ryani210693
Forum Members
Forum Members
Posts: 10
Joined: Wed Dec 03, 2008 11:21 pm

Re: Blogs Module - Short Category not showing

Post by ryani210693 »

I've removed all references of time in the shortcategory template, yet it still does not work (it returns the same error). I've had a look at the php file 'action.showshortcategory.php'. The line causing the problem is as follows-

Code: Select all

$onerow->unixtime = $this->UnixTimeStamp($time);
I'm baffled!

Cheers. Ryan.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Blogs Module - Short Category not showing

Post by Dr.CSS »

You may want to go to forge and report it as a bug to the module dev....
ryani210693
Forum Members
Forum Members
Posts: 10
Joined: Wed Dec 03, 2008 11:21 pm

Re: Blogs Module - Short Category not showing

Post by ryani210693 »

Probably best!

Cheers.
cms_man
Forum Members
Forum Members
Posts: 12
Joined: Mon May 04, 2009 8:00 pm

Re: Blogs Module - Short Category not showing

Post by cms_man »

Hi   guys ,


I have been puzzled also  how to make that work and here is the solution. Maybe it is not the right one , but at least works  for me.

Here is  the     action.showshortcategory.php  which I have changed. I have  got it  from action.showcategory.php
and then changed the last line which is

Code: Select all

echo $this->ProcessTemplateFromDatabase('showcategory');
To :

Code: Select all

 echo $this->ProcessTemplateFromDatabase('showshortcategory');  
   

and  then I have  changed the  template  to show only titles
You can see it  here   http://sbypc.ameravant.com/blog/

This is  the template  code to display only titles  :

Code: Select all

 <div class="blogs-showblogsentries">
{if $itemcount>0} {foreach from=$items item=entry}
  <div class="blogs-showblogsentry">
    <div class="blogs-showblogsentrytime">{$entry->time} {$writtenby} {$entry->author}</div>
    <div class="blogs-showblogsentrytitle">
      <a href="{$entry->entryurl}">
      {$entry->title}
      </a>
    </div>
    </div>
{/foreach}
{/if}
</div> 




action.showshortcategory.php   code

Code: Select all

<?php

if (!isset($gCms) || !isset($params["catid"])) return;

$catid=$params["catid"];
$category=$this->GetCategory($catid);

if ($this->GetPreference("enablebreadcrumb")=="1") {
  $this->smarty->assign('breadcrumb', $this->GetBlogBreadcrumb($id,$returnid, $this->GetPreference("breadcrumbroot"),$catid));
}

$numentries=-1; if (isset($params["numentries"])) $numentries=$params["numentries"];

$shortlength=$this->GetPreference("shortwordlength",30);
if (isset($params["shortlength"])) $shortlength=$params["shortlength"];

$moretext=$this->GetPreference("moretext","...");
if (isset($params["moretext"])) $moretext=$params["moretext"];


$oldestfirst=false;
if (isset($params["oldestfirst"]) && ($params["oldestfirst"]=="true")) {
  $oldestfirst=true;
}
$dbentries=$this->GetEntries(true,$catid,$numentries,$oldestfirst);
if ($dbentries===false) return;
$entries=array();
if (count($dbentries)==0) {
  $this->smarty->assign('noentriestext', $this->Lang("noentries"));
} else {
   $mostrecent=true;
  foreach ($dbentries as $db_entry) {
    $onerow = new stdClass();
    if ($mostrecent) {
      $onerow->mostrecent=1;
      $mostrecent=false;
    } else {
      $onerow->mostrecent=0;
    }
	
/* $onerow->title=$this->CreateLink($id, 'showentry', $returnid, $db_entry["title"], array('entryid'=>$db_entry["id"]));*/	


///////////////////////////////////////////// ADDED/////////////////////////////////////////

//LINK  "entryid"
  $prettyurl = 'Blogs/'.$db_entry['id'].'/'.$returnid.'/'.strtolower(munge_string_to_url($db_entry['title']));
  $onerow->title=$this->CreateLink($id, 'showentry', $returnid, $db_entry["title"], array('entryid'=>$db_entry["id"]),
				   '', false, false, '', false, $prettyurl);


// $onerow->title=$this->CreateLink($id, 'showentry', $returnid, $db_entry["title"], array('entryid'=>$db_entry["id"]), 
// '', false, false, '', false, 'Blogs/'.$db_entry["id"].'/'.$returnid);
////END "entryid"////////////////////////////


 $onerow->author=$db_entry["author"];
 
 /* $shorttextlink=$this->CreateLink($id, 'showentry', $returnid, $moretext, array('entryid'=>$db_entry["id"]));
    $onerow->shorttext=strip_tags(substr($db_entry["text"],0,$shortlength))." ".$shorttextlink;*/
	
	
////////LINK "moretext"


$onerow->morelink=$this->CreateLink($id, 'showentry', $returnid, $moretext,
				 array('entryid'=>$db_entry["id"]), '', false, false, '', false, $prettyurl);
 
/////////////////////////////////////////////END ADDED/////////////////////////////////////////


     $onerow->shorttext=strip_tags($this->TruncateText($entry["text"],$shortlength))." ".$onerow->morelink;
     $onerow->truncatedtext=strip_tags($this->TruncateText($entry["text"],$shortlength));
    $onerow->text=nl2br($db_entry["text"]);
    $onerow->unixtime=$db_entry["createtime"];
    $onerow->time=$this->Lang("created").": ".$this->MakeDateTime($db_entry["createtime"]);
    $onerow->dateonly=$this->MakeDate($db_entry["createtime"]);
    $onerow->timeonly=$this->MakeTime($db_entry["createtime"]);
    $latestcommenttime=$this->GetLatestCommentTime($db_entry["id"]);
    //$latestcommenttime=$db_entry["commenttime"];
    if ($latestcommenttime>0) {
      $onerow->time.="   ".$this->Lang("latestcomment").": ".$this->MakeDateTime($latestcommenttime);
    }
    $nocomments=$this->CountComments($db_entry["id"]);
    if ($nocomments==1) $nocomments.=" ".$this->Lang("comment"); else $nocomments.=" ".$this->Lang("comments");

  /*  $onerow->comments=$this->CreateLink($id, 'showentry', $returnid, $nocomments, array('entryid'=>$db_entry["id"]));*/
	
///////////////////////////////////////////// ADDED/////////////////////////////////////////
//LINK "comments"

      $onerow->comments=$this->CreateLink($id, 'showentry', $returnid, $nocomments, array('entryid'=>$db_entry["id"]),
					  '');

$onerow->comments=$this->CreateLink($id, 'showcategory', $returnid, $nocomments, 
array('entryid'=>$db_entry["id"]), '', false, false, '', false, 'Blogs/'.$db_entry["id"].'/'.$returnid);

/////////////////////////////////////////////END ADDED/////////////////////////////////////////



    $onerow->files=$this->GetEntryFileLinks($db_entry["id"]);
    array_push($entries, $onerow);
  }
  $this->smarty->assign_by_ref('items', $entries);
}

if ($this->GetPreference("showrssicons")=="1") {
  $link="<img src='modules/Blogs/icons/rss.png' alt=\"RSS\" /> ".$this->Lang("subscribecategory");
  //$params=array("showtemplate"=>"false",'show'=>"category","catid"=>$catid);
  $href="<a href='".$this->config["root_url"]."/modules/Blogs/rssfeed.php?id=$id&show=category&catid=$catid&returnid=$returnid' target='_blank'>".$link."</a>";
//  $href=$this->CreateLink($id, 'rss', $returnid, $link, $params,'',false,false,'',true,'news/rss');
  $this->smarty->assign('rsslink', $href);
}


$this->smarty->assign('itemcount', count($entries));
$this->smarty->assign('categorytitle', $category["title"]);
$this->smarty->assign('categorydescription', nl2br($category["description"]));

echo $this->ProcessTemplateFromDatabase('showshortcategory');

?>
 
Post Reply

Return to “Modules/Add-Ons”