Page 1 of 2

[solved] CGblog post title in page title

Posted: Thu Apr 29, 2010 9:58 pm
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.

Re: CGblog post title in page title

Posted: Fri Apr 30, 2010 8:13 am
by scotch33
can you give us an example of a variable you'd be wanting to use?

Re: CGblog post title in page title

Posted: Fri Apr 30, 2010 9:04 am
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.  ???

Re: CGblog post title in page title

Posted: Fri Apr 30, 2010 11:04 am
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?

Re: CGblog post title in page title

Posted: Fri Apr 30, 2010 11:15 am
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

Re: CGblog post title in page title

Posted: Fri Apr 30, 2010 10:25 pm
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!

Re: CGblog post title in page title

Posted: Sat May 01, 2010 5:38 am
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

Re: CGblog post title in page title

Posted: Sat May 01, 2010 11:11 am
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

Re: CGblog post title in page title

Posted: Sat May 01, 2010 11:25 am
by vilkis
Do you use your or my code?
vilkis

Re: CGblog post title in page title

Posted: Sat May 01, 2010 9:43 pm
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!!

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

Posted: Tue Jul 06, 2010 10:36 pm
by inyerface
I tried your code vilkis but it is not working for me.  Any suggestions?

CMS Version
1.7.1

CGBlog
1.4

Re: [solved] CGblog post title in page title

Posted: Tue Jul 06, 2010 10:46 pm
by vilkis
Hi,
if you enter

Code: Select all

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

vilkis

Re: [solved] CGblog post title in page title

Posted: Wed Jul 07, 2010 5:18 pm
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>

Re: [solved] CGblog post title in page title

Posted: Wed Jul 07, 2010 5:54 pm
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>

Re: [solved] CGblog post title in page title

Posted: Wed Jul 07, 2010 8:40 pm
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