CGBlog - A several of things

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
phreerider
Forum Members
Forum Members
Posts: 24
Joined: Wed Dec 31, 2008 9:16 pm

CGBlog - A several of things

Post by phreerider »

- How do I have the blog entry's title in the HTML Meta title tag?

- Is there search module for CGBlog?

- Comments - Use CGFeedback? Can I show how many comments made on summary page?

Ie. Nov 23, 2009 | Posted in General, Video Blog | 3 Comment(s)

- What module to use to share the blog via twitter, facebook, email, etc... ?

Thanks!
Last edited by phreerider on Tue Nov 24, 2009 5:22 am, edited 1 time in total.
Peciura

Re: CGBlog - A several of things

Post by Peciura »

- How do I have the blog entry's title in the HTML Meta title tag?
1. You have to specify witch page will show blog entries in detail mode (you can create one just for this purpose).  Lets call it "blog_details".
2. Open page "blog_details" and paste "title}"/>" in "Page Specific Metadata:"
(3.) To make sure page is displaying Blog entry in detail mode you can create UDT that checks $_GET variable for url parameter "mact" and searches substrings "CGBlog" and "detai" in it's value.
- Is there search module for CGBlog?
CGBlog is searchable by built in search module.
- Comments - Use CGFeedback? Can I show how many comments made on summary page?
thats right - use CGFeedback.

1. In CGBlog summary template after each summary i added link to comment form (just below blog record in detail page)

Code: Select all

<a href="{$entry->detail_url}#cgblog_comment" title="comment it">Comment it {assign var='temp' value=$entry}
{CGFeedback key1="CGBlog" key2=$entry->id action='summary' summarytemplate='counter' lang=$lang}
{assign var='entry' value=$temp}</a>
2. Place anchor "#cgblog_comment" to jump to comment section in CGBlog detail template

3. Anchor and CGFeedback tags in blog detail template:

Code: Select all

<div class='paragraph'>
<a name='cgblog_comment'/>
{startExpandCollapse id="cgblog_comment" title="Add Comment"}
{CGFeedback key1="CGBlog" key2=$entry->id inline=0 lang=$lang}
{stopExpandCollapse}
</div>

{assign var='temp' value=$entry}
<div class='paragraph'>
{CGFeedback key1="CGBlog" key2=$entry->id action='ratings' ratingstemplate='blog_summary' lang=$lang}
</div>
{assign var='entry' value=$temp}

{assign var='temp' value=$entry}
<div class='paragraph'>
{CGFeedback key1="CGBlog" key2=$entry->id action='summary' summarytemplate='blog_summary' lang=$lang}
</div>
{assign var='entry' value=$temp}
   a. "" is specific to my style,
   b. "{startExpandCollapse id="cgblog_comment" title="Add Comment"}" and "{stopExpandCollapse}" makes comment form collapsable.
   c. "{assign var='temp' value=$entry}" "{assign var='temp' value=$entry}" prevents variable {$entry} from being overwritten.
   d. "ratingstemplate='blog_summary'" and "summarytemplate='blog_summary'" adjusted to particular layout of my page.

4. Create "summarytemplate='counter'" to display number of comments nextto link "Comment it" in brackets "(" and ")". If no comments displays nothing.

Code: Select all

{if !empty($comments)}
{foreach from=$comments name='temp_counter' item='temp'}  
{/foreach}
({$smarty.foreach.temp_counter.total})
{/if}
- What module to use to share the blog via twitter, facebook, email, etc... ?
Download tag "SocialBookmarking" from http://dev.cmsmadesimple.org/projects/socialbks

Have a nice day. :)
phreerider
Forum Members
Forum Members
Posts: 24
Joined: Wed Dec 31, 2008 9:16 pm

Re: CGBlog - A several of things

Post by phreerider »

Thank you!

Good karma coming your way soon :)

Cheers,
Colin
phreerider
Forum Members
Forum Members
Posts: 24
Joined: Wed Dec 31, 2008 9:16 pm

Re: CGBlog - A several of things

Post by phreerider »

I've tested it... all good except one thing, the counter number are repeating for every blog entries on the summary page.

ie.

Blog Title #1

Summary

Nov 26, 2009 | Comment it (3)

--

Blog Title #2

Summary

Nov 25, 2009 | Comment it (3)

--

Blog Title #3

Summary

Nov 21, 2009 | Comment it (3)

--

Any idea how to fix it? Thanks.
Peciura

Re: CGBlog - A several of things

Post by Peciura »

I think it is just mater of placing thing to the right place.
Post CGBlog summary and detail templates you have created.
phreerider
Forum Members
Forum Members
Posts: 24
Joined: Wed Dec 31, 2008 9:16 pm

Re: CGBlog - A several of things

Post by phreerider »

Ok, here is the code:

Summary:

Code: Select all

<!-- Start CGBlog Display Template -->

{foreach from=$items item=entry}
<div class="CGBlogSummary">



<div class="CGBlogSummaryLink">
<h2 class="blog-link"><a href="{$entry->detail_url}" title="{$entry->title|escape:htmlall}"  class="blog-link">{$entry->title|escape}</a></h2>
</div>


{if $entry->summary}
	<div class="CGBlogSummarySummary">
		{eval var=$entry->summary}
	</div>

{else if $entry->content}

	<div class="CGBlogSummaryContent">
		{eval var=$entry->content}
	</div>
{/if}
<p style="margin-bottom: 30px;"><a href="{$entry->detail_url}" title="{$entry->title|escape:htmlall}"  class="external">Read more...</a></p>
<div style="font-size: 10px; border-bottom:1px dotted #363636; margin-bottom: 30px; padding-bottom: 10px; margin-top: 30px;">
{if $entry->postdate}
		{$entry->postdate|cms_date_format} | <!-- AddThis Button BEGIN -->
<a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&pub=xa-4b0e3f8a04ddb216">Share</a> | <__script__ type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pub=xa-4b0e3f8a04ddb216"></__script>
<!-- AddThis Button END -->
{/if}
<a href="{$entry->detail_url}#cgblog_comment" title="comment it">Comment it {assign var='temp' value=$entry}
{CGFeedback key1="CGBlog" key2=$entry->id action='summary' summarytemplate='counter' lang=$lang}
{assign var='entry' value=$temp}</a>
{if !empty($comments)}
{foreach from=$comments name='temp_counter' item='temp'}  
{/foreach}
({$smarty.foreach.temp_counter.total})
{/if}
</div>


{if isset($entry->extra)}
    <div class="CGBlogSummaryExtra">
        {eval var=$entry->extra}
	{* {cms_module module='Uploads' mode='simpleurl' upload_id=$entry->extravalue} *}
    </div>
{/if}
{if isset($entry->fields)}
  {foreach from=$entry->fields item='field'}
     <div class="CGBlogSummaryField">
        {if $field->type == 'file'}
          <img src="{$entry->file_location}/{$field->value}"/>
        {else}
          {$field->name}: {eval var=$field->value}
        {/if}
     </div>
  {/foreach}
{/if}

</div>
{/foreach}

{if $pagecount > 1}
  <p>
{if $pagenumber > 1}
{$firstpage} {$prevpage} 
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
 {$nextpage} {$lastpage}
{/if}
</p>
{/if}
<!-- End CGBlog Display Template -->
Detail:

Code: Select all

{* set a canonical variable that can be used in the head section if process_whole_template is false in the config.php *}
{if isset($entry->canonical)}
  {assign var='canonical' value=$entry->canonical}
{/if}

{if $entry->postdate}

{/if}
<h1 style="margin-top: 0px; margin-bottom: 40px;">{$entry->title|escape}</h1>


<div id="CGBlogPostDetailContent">
	{eval var=$entry->content}
</div>

{if $entry->extra}
	<div id="CGBlogPostDetailExtra">
		{$extra_label} {$entry->extra}
	</div>
{/if}

{if isset($entry->fields)}
  {foreach from=$entry->fields item='field'}
     <div class="CGBlogDetailField">
        {if $field->type == 'file'}
	  {* this template assumes that every file uploaded is an image of some sort, because CGBlog doesn't distinguish *}
          <img src="{$entry->file_location}/{$field->value}"/>
        {else}
          {$field->name}: {eval var=$field->value}
        {/if}
     </div>
  {/foreach}
{/if}

<div style="border-bottom:0px dotted #363636; margin-bottom: 30px; padding-bottom: 10px; margin-top: 30px; font-size: 10px;">
{if $entry->postdate}
		{$entry->postdate|cms_date_format} | <!-- AddThis Button BEGIN -->
<a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&pub=xa-4b0e3f8a04ddb216">Share</a><__script__ type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pub=xa-4b0e3f8a04ddb216"></__script>
<!-- AddThis Button END -->
{/if}

</div>

<div class='paragraph'>
<a name='cgblog_comment'></a>
{startExpandCollapse id="cgblog_comment" title="Add Comment"}
{CGFeedback key1="CGBlog" key2=$entry->id inline=0 lang=$lang}
{stopExpandCollapse}
</div>

{assign var='temp' value=$entry}
<div class='paragraph'>
{CGFeedback key1="CGBlog" key2=$entry->id action='ratings' ratingstemplate='blog_summary' lang=$lang}
</div>
{assign var='entry' value=$temp}

{assign var='temp' value=$entry}
<div class='paragraph'>
{CGFeedback key1="CGBlog" key2=$entry->id action='summary' summarytemplate='blog_summary' lang=$lang}
</div>
{assign var='entry' value=$temp}

phreerider
Forum Members
Forum Members
Posts: 24
Joined: Wed Dec 31, 2008 9:16 pm

Re: CGBlog - A several of things

Post by phreerider »

One more thing - Can I do the recent comments with CGFeedback too? Thanks
Peciura

Re: CGBlog - A several of things

Post by Peciura »


{foreach from=$items item=entry}





detail_url}" title="{$entry->title|escape:htmlall}"  class="blog-link">{$entry->title|escape}



{if $entry->summary}

{eval var=$entry->summary}


{else if $entry->content}


{eval var=$entry->content}

{/if}
detail_url}" title="{$entry->title|escape:htmlall}"  class="external">Read more...

{if $entry->postdate}
{$entry->postdate|cms_date_format} |
Share |

{/if}
detail_url}#cgblog_comment" title="comment it">Comment it {assign var='temp' value=$entry}
{CGFeedback key1="CGBlog" key2=$entry->id action='summary' summarytemplate='counter' lang=$lang}
{assign var='entry' value=$temp}
{if !empty($comments)}
{foreach from=$comments name='temp_counter' item='temp'} 
{/foreach}
({$smarty.foreach.temp_counter.total})
{/if}




{if isset($entry->extra)}
   
        {eval var=$entry->extra}
{* {cms_module module='Uploads' mode='simpleurl' upload_id=$entry->extravalue} *}
   
{/if}
{if isset($entry->fields)}
  {foreach from=$entry->fields item='field'}
     
        {if $field->type == 'file'}
          file_location}/{$field->value}"/>
        {else}
          {$field->name}: {eval var=$field->value}
        {/if}
     
  {/foreach}
{/if}


{/foreach}

{if $pagecount > 1}
 
{if $pagenumber > 1}
{$firstpage} {$prevpage}
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber
{/if}
Red part should be in in CGFeedback summarytemplate ("counter"). You need 2 summary templates for CGFeedback:
1. To display comments (e.g. "Sample")
2. To count comments for an blog entry ("counter")

Variable {$comments} is assigned to proper value only in CGFeedback templates, outside - last known values is used.

One more thing - Can I do the recent comments with CGFeedback too? Thanks
Sure. Lets say you want visible 11 recent comments :
1. call tag {CGFeedback key1="CGBlog"  action='summary' pagelimit=11   summarytemplate='recent_comments'}
   by default feedback is sorted by create date and in descending order so it is not necessary to add params:
      a. sortby="created"
      b. sortorder="DESC"
2. Create new feedback template "recent_comments". Basically you just need to delete pagination part in new template

Code: Select all

{if $pagecount > 1}
<p>
  {if $pagenum > 1}
    <a href="{$firstpage_url}" title="{$mod->Lang('lbl_goto_firstpage')}"><<</a> 
    <a href="{$prevpage_url}" title="{$mod->Lang('lbl_goto_prevpage')}"><</a> 
  {/if}
  {$mod->Lang('lbl_page')} {$pagenum} {$mod->Lang('lbl_of')} {$pagecount}
  {if $pagenum < $pagecount}
     <a href="{$nextpage_url}" title="{$mod->Lang('lbl_goto_nextpage')}">></a> 
    <a href="{$lastpage_url}" title="{$mod->Lang('lbl_goto_lastpage')}">>></a>
  {/if}
</p>
{* pagecount *}{/if}
newagekat
Forum Members
Forum Members
Posts: 161
Joined: Mon Feb 06, 2006 6:06 pm

Re: CGBlog - A several of things

Post by newagekat »

Hi:

Sorry for re-opening this post.  I followed your instructions exactly.  I seem to have this error:
Notice: Undefined variable: showall in ...../modules/CGFeedback/action.ratings.php on line 79
I'm using cmsms v1.8 with
CGBlog 1.4
CGExtensions 1.19.1
CGFeedback 1.2
CGSimpleSmarty 1.4.5

Any ideas if this is related to the error i now have in Captcha v0.4.2
Notice: Undefined variable: selectedindex in ...../modules/Captcha/lib/classes/module/class.captcha.php on line 785

thanks again for your help, Peciura.
newagekat
Forum Members
Forum Members
Posts: 161
Joined: Mon Feb 06, 2006 6:06 pm

Re: CGBlog - A several of things

Post by newagekat »

never mind fixed it.  there was some google analytics that were not liberalized.  My mistake.
newagekat
Forum Members
Forum Members
Posts: 161
Joined: Mon Feb 06, 2006 6:06 pm

Re: CGBlog - A several of things

Post by newagekat »

Quick question.  if i wanted to remove the rating system and simplify the comment section, is it best to apply display: none; in the stylesheet or to remove it from the template?  if the latter, how do I do this?  the site I'm working on is http://keepsakefamilytreevideo.com/newsite/index.php?mact=CGBlog,cntnt01,detail,0&cntnt01articleid=1&cntnt01detailtemplate=KFLV&cntnt01returnid=62

if it looks awful in IE, let me know.  I usually tackle IE last  ;D
Peciura

Re: CGBlog - A several of things

Post by Peciura »

Delete rating field from CGFeedBack form

Code: Select all

  <div class="row" style="margin: 1em;">
    <div class="col30" style="float: left; width: 29%;">
      {$mod->Lang('prompt_your_rating')}:
    </div>
    <div class="col70" style="float: left; width: 70%;">
      <select name="{$actionid}rating">
        {html_options options=$rating_options selected=$rating}
      </select>
    </div>
  </div>
  <div class="clearfix"></div>
and remove rating report from summary ( and detail template if you use it)

Code: Select all

    <div class="feedback_item_rating">
      {$mod->Lang('lbl_rating')}: {$one.rating}  
      {section name='rating' start=1 loop=6}
        {if $smarty.section.rating.index <= $one.rating}
          <img src="{$rating_imgs.img_on}" alt=""/>
        {else}
          <img src="{$rating_imgs.img_off}" alt=""/>
        {/if}
      {/section}
    </div>
newagekat
Forum Members
Forum Members
Posts: 161
Joined: Mon Feb 06, 2006 6:06 pm

Re: CGBlog - A several of things

Post by newagekat »

Sweet.  that's great!

one last itsy bitsy thing.  i'm adding the return link at the bottom of the detail feedback template, but it's not working.  I thought we were able to do this according to the Help.

code added is:

Code: Select all

{if $return_url != ""}
<div id="NewsPostDetailReturnLink">{$return_url}{if $category_name != ''} - {$category_link}{/if}</div>
{/if}
Any ideas?
hoodedman
New Member
New Member
Posts: 9
Joined: Sun May 02, 2010 2:21 pm

Re: CGBlog - A several of things. AGAIN!

Post by hoodedman »

Hi, sorry, I gotta re-open the discussion, because I'm interested in some things:
 1. How can I maintain pagenation per category when I browse them??? Is that possible, because
 it is not working, only on the main page of blog entries.
  (SOLVED:  just added pagelimit to browsecat mode) :D

 2. How can I show(include) empty categories in category list (browsecat mode)?  

 3. Is it possible to integrate a CGCalendar in CGBlog, or any calendar, I mean create links per date numbers in each months?
 
 4. I need pagination like this "Pages: 1. 2. 3. 4. >  >>". Has someone done this one already??

Appriciate any help :)
Last edited by hoodedman on Sat Sep 18, 2010 10:20 pm, edited 1 time in total.
Peciura

Re: CGBlog - A several of things

Post by Peciura »

3. It can be done with a single UDT
4. I have done somewat similar pagination for Products and "ugly url" You can easily adopt it to any module http://forum.cmsmadesimple.org/index.ph ... #msg223502

If you need more help post summary template and link to your page.
Last edited by Peciura on Sun Sep 26, 2010 8:06 am, edited 1 time in total.
Post Reply

Return to “Modules/Add-Ons”