{cms_module_hint} CGBlog How to Use It

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
montedavis
Forum Members
Forum Members
Posts: 64
Joined: Wed Jul 03, 2013 7:44 pm

{cms_module_hint} CGBlog How to Use It

Post by montedavis »

Hello,

I'm hoping someone can help me with understanding how the {cms_module_hint} works with CGBlog. I've spent many hours trying to make this work and reviewing the forum posts, I've also tried using {cms_module_hint} with Products module a few months ago but could never get it to work, it sounds like it should be easy to make this work when reading the CMSMS documentation.

From what I've read it sounds like I should be able to use Pretty URLS and use {cms_module_hint} to direct CGBlog page flow to category specific detail pages and detail templates. Is this correct? or is it entirely not possible to use Pretty URLS and have a category specific detail page using {cms_module_hint} with CGBlog? It sounds like {cms_module_hint} was the solution to this challenge from what I read.

First question should I set the "Default Detail Page" in CGBlog Options? or leave it set to "None" when trying to use the {cms_module_hint} tag? I've tried it either way and no luck.

Second question: Which detail page do you add your {cms_module_hint} code to? the blog default or your custom detail page?

In my latest attempt I tried:

Setting the "Default Blog Detail Page" to a page I created named "blog-detail-page" and added the following code to the "smarty data logic" section:

{cms_module_hint category="Roadside" module=CGBlog detailtemplate="CustomCaseStudiesDetail" detailpage="case-studies-detail"}

I've created a "case studies" page that uses the following CGBlog code in the {content} area to display three blog categories "Roadside", "Streams and Banks" and "Flood Control" using the "Browsecat" action

{CGBlog action="browsecat" browsecattemplate="CustomCaseStudies-Category" summarypage="case-studies-2" summarytemplate="CustomCaseStudiesSummary" detailpage="case-studies-detail" detailtemplate="CustomCaseStudiesDetail"}

The case studies page displays the three blog category: "Roadside", "Streams and Banks" and "Flood Control", category image, text link, etc. and appears to work fine.

I've created a "case-studies-detail" page and also added the following code, entered in the "smarty data or logic" section.

{cms_module_hint category="Roadside" module=CGBlog detailtemplate="CustomCaseStudiesDetail" detailpage="case-studies-detail"}

When I click on a category link the summarytemplate="CustomCaseStudiesSummary" template loads and the blog articles for the specific category are displayed (thumbnails, descriptions, etc.), which is expected as the summary template is passed in the url.

When I click on an article link that is part of the "Roadside" category I want to go to the detail page named case-studies-detail and use the detailtemplate named "CustomCaseStudiesDetail", instead of the default "blog-detail-page" and default "blog detail template" yet I always end up on the "blog-detail-page" unless I turn off "Pretty Urls" but I thought {cms_module_hint} as the work around for this challenge.

Sorry for the long description, Thank you in advance to anyone who can help!

Monte

CMSMS Version 2.2.7

Installed Modules
AdminSearch 1.0.4
CGBlog 1.15.14
CGExtensions 1.61.5
CGSimpleSmarty 2.2.1
CMSContentManager 1.1.6
CMSMailer 6.2.14
Captcha 1.0
CmsJobManager 0.1.2
DesignManager 1.1.4
FileManager 1.6.6
FilePicker 1.0.2
FormBuilder 0.8.1.6
Gallery 2.3.2
JQueryTools 1.4.0.4
MenuManager 1.50.3
MicroTiny 2.2.2
ModuleManager 2.1.3
Navigator 1.0.8
News 2.51.3
Search 1.51.4
TinyMCE 3.2-beta6
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1609
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: {cms_module_hint} CGBlog How to Use It

Post by DIGI3 »

It sounds like you're doing it mostly right, but different configurations can affect where it goes. First I'd say make sure you don't have a config.php setting that changes the processing order, and make sure your template has a {process_pagedata} tag very early, before {content} is assigned.

Generally the module hint would go in the smarty logic field of the page containing the links that you're wanting to modify. So in your case, a module hint to set the detail page would go in the page you have set to show the summaries (not the detail page). To change the detail template itself it would go in the detail page.
Not getting the answer you need? CMSMS support options
montedavis
Forum Members
Forum Members
Posts: 64
Joined: Wed Jul 03, 2013 7:44 pm

Re: {cms_module_hint} CGBlog How to Use It

Post by montedavis »

Hello DIGI3,

Thank you for your response. I don't see anything in the config.php page that sounds like it would affect the processing order. I haven't added anything unusual to the config.php.

In my summary page "smarty data logic" field I did not have the {cms_module_hint} code. I added this but no luck. Do I need to remove the {CGBlog...} calls from the {content} area that duplicate the newly added {cms_module_hint}?

{process_pagedata} is the 2nd line in the header, after {strip}

Should the default blog detail page be set? does this matter when using the {cms_module_hint} code?

I tried your suggestions but no luck.

Monte
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1609
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: {cms_module_hint} CGBlog How to Use It

Post by DIGI3 »

Unfortunately I don't know any further. You'd probably just have to experiment with each setting, and search the forum to see if others have run into it. I know I've had difficulty with a similar issue so it's possible there's not a way to do exactly what you're trying to achieve.

CGExtensions also has its own version of the tag, cge_module_hint, I'm not sure if it works differently but you could try.
Not getting the answer you need? CMSMS support options
montedavis
Forum Members
Forum Members
Posts: 64
Joined: Wed Jul 03, 2013 7:44 pm

Re: {cms_module_hint} CGBlog How to Use It

Post by montedavis »

Thanks DIGI3! I was trying the {cge_module_hint} tag earlier. I'll give that a try in the summary page logic area. Have a great day!
montedavis
Forum Members
Forum Members
Posts: 64
Joined: Wed Jul 03, 2013 7:44 pm

Re: {cms_module_hint} CGBlog How to Use It

Post by montedavis »

I changed {cms_module_hint) to {cge_module_hing} but no luck. My URL string looks like this on my summary page:

/index.php?mact=CGBlog,cntnt01,default,0&cntnt01browsecattemplate=CustomCaseStudies-Category&cntnt01summarytemplate=CustomCaseStudiesSummary&cntnt01category=Roadside&cntnt01detailpage=case-studies-detail&cntnt01category_id=3&cntnt01returnid=59

the "returnid=59" is the "set" blog detail page in the CGBlog module. I cannot get that to change when using the {cms_module_hint} tag.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: {cms_module_hint} CGBlog How to Use It

Post by velden »

I've created a "case-studies-detail" page and also added the following code, entered in the "smarty data or logic" section.

{cms_module_hint category="Roadside" module=CGBlog detailtemplate="CustomCaseStudiesDetail" detailpage="case-studies-detail"}
When I click on an article link that is part of the "Roadside" category I want to go to the detail page named case-studies-detail and use the detailtemplate named "CustomCaseStudiesDetail", instead of the default "blog-detail-page" and default "blog detail template" yet I always end up on the "blog-detail-page" unless I turn off "Pretty Urls" but I thought {cms_module_hint} as the work around for this challenge.
If you're trying to get different behavior for that specific category I don't think that will work this way.

cms_module_hint is used to change the behavior of the module just before it's loaded. Note that at that time, the current page itself is already 'loaded' and can't be changed anymore.

If you want a different detail-page for an item of a specific category while on the same summary page there are links to articles of other categories too, I think you should use {cms_action_url} (https://docs.cmsmadesimple.org/tags/cms ... action_url).
Use that to create the detail url only for the articles of the specific category and only supply the parameters needed:
module=CGBlog action=detail detailpage='case-studies-detail' articleid=$entry->id

Side note: It is well possible I don't understand your goals exactly. Especially because you say it works well without pretty urls.
montedavis
Forum Members
Forum Members
Posts: 64
Joined: Wed Jul 03, 2013 7:44 pm

Re: {cms_module_hint} CGBlog How to Use It

Post by montedavis »

Thank you Velden,

I will take a look at your suggestion and see if that will work.

I was able to get a different "Detail Page" to load using the {cge_module_hint} tag but the detail page template would not change from the selected default detail page template choice so it wasn't much help.

My issue with getting the correct "Detail Page" to load was stemming from my "URL Template" entry in the CGBlog options that I either created or was there by default, something like: {$orig_title}/{$title}/{$postdate} once I removed this entry I was able to get a detail page to load using the {cge_hint_module} but like I said the detail page template would never load.

I'm now trying to just figure out how to get the cateogry name to display on the summary page template when it displays the articles for a specific category.

Thank you,

Monte
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: {cms_module_hint} CGBlog How to Use It

Post by velden »

I built an sample site for this and I struggled too with the default url template.
Once I cleared the url for the specific blog article I got a working url using this code in the summary template

(note that my special category = 'cat2' and the detail page alias 'detail-cat-2')

Code: Select all

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

{$detailurl=$entry->detail_url}
 {foreach from=$entry->categories item='category'}
   {if $category.name == 'cat2'}{cms_action_url module=CGBlog action=detail articleid=$entry->id detailpage='detail-cat-2' assign=detailurl}{/if}
 {/foreach}

...
<a href="{$detailurl}" title="{$entry->title|escape:htmlall}">{$entry->title|escape}</a>
</div>
In the 'Smarty data or logic that is specific to this page' of page 'detail-cat-2' I have:

Code: Select all

{cms_module_hint module=CGBlog detailtemplate=detail2}
'detail2' is the name of the specific CGBlog detail template.

That works, but from a multiple perspectives it's a rather bad implementation: first something or someone has to think of clearing the url (or perhaps just don't set it at all if possible) and the urls won't have a consistent look if some are emptied and others not.

In the CGBlog help there's a hint about this behavior:
Article URL's
This module allows the entry author or editor to specify a unique URL for each article. Because there is no page-id on the URL the default detail page preference is used to determine the CMSMS conent page that will be displayed when rendering the entry.
I think the only way to get it working without hacking or generating inconsistent urls is by clearing the url template and using my example above.
User avatar
sbupravi
Power Poster
Power Poster
Posts: 257
Joined: Sun Oct 07, 2012 9:29 pm
Location: Adler

Re: {cms_module_hint} CGBlog How to Use It

Post by sbupravi »

Hello Velden!
Please tell me how to apply this to "Products"?
velden wrote: Sun Nov 01, 2020 10:39 am I built an sample site for this and I struggled too with the default url template.
Once I cleared the url for the specific blog article I got a working url using this code in the summary template

(note that my special category = 'cat2' and the detail page alias 'detail-cat-2')

Code: Select all

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

{$detailurl=$entry->detail_url}
 {foreach from=$entry->categories item='category'}
   {if $category.name == 'cat2'}{cms_action_url module=CGBlog action=detail articleid=$entry->id detailpage='detail-cat-2' assign=detailurl}{/if}
 {/foreach}

...
<a href="{$detailurl}" title="{$entry->title|escape:htmlall}">{$entry->title|escape}</a>
</div>
...
If i do so:

Code: Select all

{$detailurl=$entry->detail_url}
 {foreach from=$entry->categories item='category'}
   {if $category->name == 'CategoryName'}{cms_action_url module='Products' action='detail' product=$entry->id detailpage='PageAlias' assign=detailurl}{/if}
 {/foreach}
Then I get 404: page not found.

P.S. "detailpage" doesn't worked.
cjcollen
Forum Members
Forum Members
Posts: 36
Joined: Sat Aug 04, 2018 4:20 pm
Location: Shropshire, UK

Re: {cms_module_hint} CGBlog How to Use It

Post by cjcollen »

I feel your pain, montedavis. In the past, I struggled with this problem and gave up trying to figure out cms_module_hint.

I don't use CGBlog but use News instead but my solution would be the same, I think.

So, I use a separate content page for each of my News categories, each one has the following tag to show a list of news articles for the specified category:

{News summarytemplate="my-summary-template-name" detailtemplate="my-detail-template-name" detailpage="my-item-page-name" moretext="Read the full article" category="my category name"}

I also use a separate content page for the News detail page which is not the default. This is blank, not shown in menu

And this enables me to have a completely different template for the detail page from the default one set in News module settings.

The generated URL for the detail article looks like this:

h t t p s://yourdomain.com/news/17/122/My-news-item-title/d,my-detail-template-name

On the News edit page, there is a URL (slug) field. This needs to be left blank and let the system generate the URL otherwise it will pick up the default News detail template which is not what I want.

And if you wanted to include a category summary list, then this would be easy to do with just links to those category content pages.

Hope this helps.
Post Reply

Return to “CMSMS Core”