News showing template in url when using pretty urls

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
howey
Forum Members
Forum Members
Posts: 158
Joined: Fri Sep 14, 2007 1:05 pm

News showing template in url when using pretty urls

Post by howey »

Hi

There was a previous post

viewtopic.php?f=8&t=81636&p=344063&hilit=news+pretty+urls#p344063

That noted that they were getting a suffix to the url when using pretty urls with news stories.

/news/68/98/my-article-is-cool/d,news-article.html

I had the same until I made the detail template the default. I wondered if this was a bug?
cjcollen
Forum Members
Forum Members
Posts: 36
Joined: Sat Aug 04, 2018 4:20 pm
Location: Shropshire, UK

Re: News showing template in url when using pretty urls

Post by cjcollen »

I don't think it is a bug, Howey. I, too encountered a similar problem recently and I posted to this forum earlier this month:

viewtopic.php?f=8&t=82103

I also answered my post.

I found that even if you set the default news detail page in News setting but also included the detailtemplate parameter in the News tag, it will show the detail suffix at end of URL.

I think this means that you could override the default setting if you wanted to show another news detail template for that particular News tag call.
howey
Forum Members
Forum Members
Posts: 158
Joined: Fri Sep 14, 2007 1:05 pm

Re: News showing template in url when using pretty urls

Post by howey »

Hi

I solved this the same way, set the detail template as default. It does mean however if I want to use other templates on another page I run into the same problem.

I your post you said you used the url (slug). I had a problem with this, when a value is entered the detail template shows in the default page ie home page. This was mitigated by setting a default page to display the news?

I was trying to format og: values in the head as well. All got very frustrating so I have settled on the default page being set for the news items in the News admin and the detail template set as default. I am using the News module to display "jobs" on another page, just using a different category. But not using url (slug). I can live with the odd formatting on this page.

Ideally, it would be good to be able to set different templates, detail page and url (slugs), but this has been beyond me.

Even with these minor frustrations I still think CMS Made Simple is fab. Just the flexibility and ease of implementation is great.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: News showing template in url when using pretty urls

Post by velden »

Did you check: https://docs.cmsmadesimple.org/tags/cms ... odule_hint ?

The point here is: you can't have a pretty url ánd put all needed parameters in it.

So I think you should get an url to a specific page (ID, which I guess is one of the numbers in the pretty url) and on that page use the cms_module_hint tag to tell the News module what template to use for that specific page.
You can put the {cms_module_hint} tag in the 'Smarty data or logic that is specific to this page' field of the page.
Then verify your template uses the {process_pagedata} tag too.
howey
Forum Members
Forum Members
Posts: 158
Joined: Fri Sep 14, 2007 1:05 pm

Re: News showing template in url when using pretty urls

Post by howey »

Hi

Operator error maybe?

I tried adding the code to both the Smarty logic for the page and also directly within the template just below the process_pagedata. and removed the param from the News tag

Code: Select all

{cms_module_hint module=News detailtemplate=08_jobsdetail}
It rendered the correct template, but I still had the /d,08_jobsdetail at the end of the url when viewed.

I am specifying the detail page, because I have set the default to the News page, so this should render to the content tag on the same page as the news tag used for jobs.

Code: Select all

{news summarytemplate="08_jobssumm" category="Jobs" detailpage="careers"}
Am I missing something obvious?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: News showing template in url when using pretty urls

Post by velden »

Note it should be in the Smarty logic of the target page only (careers). There you want to tell the News module to use the specific template.
howey
Forum Members
Forum Members
Posts: 158
Joined: Fri Sep 14, 2007 1:05 pm

Re: News showing template in url when using pretty urls

Post by howey »

Hi

I'll double check, but I did just put it in the "page" smarty logic first. When that didn't work I tried it in the template.

I will try again as the only thing I didn't do is clear the cache inbetween times.
(M)
Forum Members
Forum Members
Posts: 118
Joined: Tue Mar 18, 2008 11:43 pm

Re: News showing template in url when using pretty urls

Post by (M) »

When I put cms_module_hint in "Smarty data or logic that is specific to this page:" a get the correct detailtemplate because I typed some quotes around the detailtemplate name:

Code: Select all

{cms_module_hint module=News detailtemplate='my_detail_template'}
With Pretty urls active.
Post Reply

Return to “CMSMS Core”