CGBlog and geting title Topic is solved

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

CGBlog and geting title

Post by andrewvideouk »

Hi I am trying to get the title from a blog post into the main template. I am using the defut temples are in the CGBlog.

I found this page which might be out of date and for CMSMS version 1.12 and I have the lastest version.
https://www.sigmaweb.co.uk/2015/09/CGBl ... s-to-Posts.

Also the site http://www.i-do-this.com/ is download. :(

Can someone point me to a updated guide please or how to.

Thank you
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1619
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: CGBlog and geting title

Post by DIGI3 »

In the top of the blog detail template, you could set something like:

Code: Select all

{$blogtitle=$entry->title scope=global}
Then in your page template you should have access to $blogtitle, which you can use for conditionally changing $title or whatever else you like. I often do something like:

Code: Select all

{if $blogtitle}
  {$title=$blogtitle}
{else}
  {$title={title}}
{/if}
<title>{$title} - {sitename}</title>
Not getting the answer you need? CMSMS support options
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: CGBlog and geting title

Post by velden »

Personally I like this approach: https://cmscanbesimple.org/blog/base-cm ... d-metatags

Especially because it doesn't need the if-then-else construct.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: CGBlog and geting title

Post by Rolf »

velden wrote: Thu Nov 19, 2020 7:57 am Personally I like this approach: https://cmscanbesimple.org/blog/base-cm ... d-metatags

Especially because it doesn't need the if-then-else construct.
The method I describe here collects all possible (default) values and passes them to the template with general names, so you can use them for multiple purposes. Simple, but very powerful!
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

Re: CGBlog and geting title

Post by andrewvideouk »

I well have a read and add it to my template. That so much better to do that as my template is getting messy with if-then-else.

Thank you guys.
Post Reply

Return to “Modules/Add-Ons”