Page 1 of 2
CGBlog - A several of things
Posted: Tue Nov 24, 2009 3:40 am
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!
Re: CGBlog - A several of things
Posted: Tue Nov 24, 2009 11:13 am
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.

Re: CGBlog - A several of things
Posted: Tue Nov 24, 2009 5:58 pm
by phreerider
Thank you!
Good karma coming your way soon
Cheers,
Colin
Re: CGBlog - A several of things
Posted: Thu Nov 26, 2009 10:42 am
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.
Re: CGBlog - A several of things
Posted: Thu Nov 26, 2009 12:33 pm
by Peciura
I think it is just mater of placing thing to the right place.
Post CGBlog summary and detail templates you have created.
Re: CGBlog - A several of things
Posted: Thu Nov 26, 2009 10:38 pm
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}
Re: CGBlog - A several of things
Posted: Thu Nov 26, 2009 11:29 pm
by phreerider
One more thing - Can I do the recent comments with CGFeedback too? Thanks
Re: CGBlog - A several of things
Posted: Fri Nov 27, 2009 10:19 am
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}
Re: CGBlog - A several of things
Posted: Wed Jul 28, 2010 11:45 pm
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.
Re: CGBlog - A several of things
Posted: Thu Jul 29, 2010 8:17 pm
by newagekat
never mind fixed it. there was some google analytics that were not liberalized. My mistake.
Re: CGBlog - A several of things
Posted: Thu Jul 29, 2010 10:19 pm
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

Re: CGBlog - A several of things
Posted: Fri Jul 30, 2010 6:20 am
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>
Re: CGBlog - A several of things
Posted: Fri Jul 30, 2010 7:29 pm
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?
Re: CGBlog - A several of things. AGAIN!
Posted: Sat Sep 18, 2010 10:02 pm
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)
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

Re: CGBlog - A several of things
Posted: Fri Sep 24, 2010 12:23 pm
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.