[solved] CGblog post title in page title

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
kalozura
Forum Members
Forum Members
Posts: 39
Joined: Sun Jan 27, 2008 12:03 am
Location: San Diego, California

[solved] CGblog post title in page title

Post by kalozura »

Hello

I am wondering if there is a way to to have the CGblog post title appear when in detail view only on the page title like so{$entry->title|escape}

I was wondering if there was a way to do it with and {if} statement some how:
{if some variable here}{$entry->title|escape}{else}{description}{/if}

That would be ideal. But if there is another way to do it that would be good too.
Last edited by kalozura on Sat May 01, 2010 9:44 pm, edited 1 time in total.
scotch33
Dev Team Member
Dev Team Member
Posts: 284
Joined: Tue Feb 14, 2006 9:56 pm

Re: CGblog post title in page title

Post by scotch33 »

can you give us an example of a variable you'd be wanting to use?
kalozura
Forum Members
Forum Members
Posts: 39
Joined: Sun Jan 27, 2008 12:03 am
Location: San Diego, California

Re: CGblog post title in page title

Post by kalozura »

can you give us an example of a variable you'd be wanting to use?
I want CGblog to display the post title on the page title as such {$entry->title|escape} only on detail view of the blog page and not the summary view. So I was wondering if there was a way to do it with an {if} statement in the . Im not sure what is possible but I was thinking something would identify that the page is now on detail view. This example wont obviously work but here is an idea of what I am hoping is possible.
{if $entry->detail}{$entry->title|escape}{else}{description}{/if}

so by  $entry->detail I mean something that identifies the detail apart from the summary view on the blog page so that it will show the post name in the title as oppose to the {description}. Hope that makes sense.  ???
scotch33
Dev Team Member
Dev Team Member
Posts: 284
Joined: Tue Feb 14, 2006 9:56 pm

Re: CGblog post title in page title

Post by scotch33 »

Are you not able to use the summary and details templates for this - just remove the title in the template where you don't want it to show.  Will that work for you or is there a reason you need to do it the way you say?
vilkis

Re: CGblog post title in page title

Post by vilkis »

in detail view template insert:

Code: Select all

{capture assign=custom_title}
{$entry->title|escape}
{/capture}
and in template of page insert

Code: Select all

{if !isset($custom_title)}
{capture assign=custom_title}{title}{/capture}{/if}

    <title>{$title}</title>
vilkis
kalozura
Forum Members
Forum Members
Posts: 39
Joined: Sun Jan 27, 2008 12:03 am
Location: San Diego, California

Re: CGblog post title in page title

Post by kalozura »

Thanks Vilkis

Altho what you gave me did not quite work for me, it did give me and idea that did work!
Here is what I did:

in the CGblog details template I added this code:

Code: Select all

{capture assign=blog_title}
{$entry->title|escape}
{/capture}
in the page template I added the following code the title tag:

Code: Select all

<title>{if isset($blog_title)}{$entry->title|escape}{else}{title}{/if} | {sitename}</title>
Works like a charm so far :) thanks to all for  your help!
Last edited by kalozura on Sat May 01, 2010 4:09 am, edited 1 time in total.
vilkis

Re: CGblog post title in page title

Post by vilkis »

Nice that you found the solution. I made mistake, the last code should be

Code: Select all

{if !isset($custom_title)}
{capture assign=custom_title}{title}{/capture}{/if}

    <title>{$custom_title}</title>
by the way: http://forum.cmsmadesimple.org/index.ph ... 304.0.html

vilkis
kalozura
Forum Members
Forum Members
Posts: 39
Joined: Sun Jan 27, 2008 12:03 am
Location: San Diego, California

Re: CGblog post title in page title

Post by kalozura »

Well it worked fine up until I added a list of recent blog post. I want to show a list view of the 5 recent posts...

Code: Select all

{CGBlog number="5" summarytemplate="list-template"}
then it no longer worked and just showed the title of the very first post on all the other posts in detail view. So if i went to view post number 3 the

Code: Select all

<title></title>
at the top of the page was that of post number one.

so not quite solved  ???

I'm assuming that having the summary template in there is making it go crazy, anyone have any  suggestions??

Thanks
vilkis

Re: CGblog post title in page title

Post by vilkis »

Do you use your or my code?
vilkis
kalozura
Forum Members
Forum Members
Posts: 39
Joined: Sun Jan 27, 2008 12:03 am
Location: San Diego, California

Re: CGblog post title in page title

Post by kalozura »

Do you use your or my code?

I did now. The last correction you made, made all the difference it works perfect now. Thanks gain Vilkis!!
inyerface
Forum Members
Forum Members
Posts: 191
Joined: Mon Nov 26, 2007 4:46 pm

[SOLVED] Re: [solved] CGblog post title in page title

Post by inyerface »

I tried your code vilkis but it is not working for me.  Any suggestions?

CMS Version
1.7.1

CGBlog
1.4
Last edited by inyerface on Thu Jul 08, 2010 4:37 am, edited 1 time in total.
vilkis

Re: [solved] CGblog post title in page title

Post by vilkis »

Hi,
if you enter

Code: Select all

A{$entry->title|escape}A
in detail view template what do you see?

vilkis
inyerface
Forum Members
Forum Members
Posts: 191
Joined: Mon Nov 26, 2007 4:46 pm

Re: [solved] CGblog post title in page title

Post by inyerface »

I see the title of my Blog post

I have in my Details Template in CGBlog:

Code: Select all

{capture assign=custom_title}
{$entry->title|escape}
{/capture}
And in my regular CMS template I have:

Code: Select all

{if !isset($custom_title)}
{capture assign=custom_title}{title}{/capture}{/if}

    <title>{$custom_title}</title>
panthus

Re: [solved] CGblog post title in page title

Post by panthus »

EDIT: forgot half of it...  ::)

Try this in your CGBlog Details Template

Code: Select all

{assign var='custom_title' value=$entry->title|escape}
And this in your CMS Template:

Code: Select all

<title>
{if isset($custom_title)}{$custom_title}
{else}{title}
{/if}
</title>
Last edited by panthus on Wed Jul 07, 2010 6:02 pm, edited 1 time in total.
vilkis

Re: [solved] CGblog post title in page title

Post by vilkis »

inyerface wrote: I see the title of my Blog post

I have in my Details Template in CGBlog:

Code: Select all

{capture assign=custom_title}
{$entry->title|escape}
{/capture}
And in my regular CMS template I have:

Code: Select all

{if !isset($custom_title)}
{capture assign=custom_title}{title}{/capture}{/if}

    <title>{$custom_title}</title>
Ok, what is value of variable $config['process_whole_template'] in config.php? By the way what is a version of CMSMS?

vilkis
Post Reply

Return to “Modules/Add-Ons”