Page 2 of 3

Re: Showing the News Article Title in the title when using the detailpage parameter.

Posted: Mon Nov 24, 2008 11:34 am
by nicmare
calguy1000 wrote: Actually, this is a variation on another example I wrote on how to display the article template, but it's very useful to know that you can change the title area of a detail page, when using the 'detailpage=' parameter of the news or any other module.   Here it is in just a few simple steps:

1) Modify your news detail templates and add this line:

Code: Select all

{assign var='detail_title'  value=$entry->title}
2) Capture your page content in a variable
     a) Add this code into the section of your page template:

Code: Select all

{capture assign='captured_content'}{content}{/capture}
     b) Replace the {content} tag lower in your template with {$captured_content}

3) Replace the title section of your page template to look something like this:

Code: Select all

{if isset($detail_title)}
    <title>{sitename} - {$detail_title}</title>
{else}
    <title>{sitename} - {title}</title>
{/if}
that works fine in Jamaica. thank you guy

Re: Showing the News Article Title in the title when using the detailpage parameter.

Posted: Mon Nov 24, 2008 7:34 pm
by gianpiero
thanks a lot for your feedback  8)
I'll engage my self with 1.4.1 "Spring Garden"

ciao
gp

Re: Showing the News Article Title in the title when using the detailpage parame

Posted: Tue Nov 25, 2008 4:40 pm
by viebig
yes, go gor it, msg me if you have problems

Re: Showing the News Article Title in the title when using the detailpage parameter.

Posted: Wed Dec 10, 2008 11:12 pm
by Daryn
This is brilliant. Thanks, calguy.  8)

Re: Showing the News Article Title in the title when using the detailpage parameter.

Posted: Thu Dec 11, 2008 9:57 am
by cb2004
Whats the way to do this for 1.5.1?

Re: Showing the News Article Title in the title when using the detailpage parameter.

Posted: Thu Dec 11, 2008 2:40 pm
by Daryn
cb2004 wrote: Whats the way to do this for 1.5.1?
That is what I'm trying to figure out now. I tried calguy's method but to no avail. I like alby's method but it seems like there should be less to it. I don't understand why you can't just assign a var to it and then refer to it in the title if it's set. If I figure out an alternative method, I will post it up.

Re: Showing the News Article Title in the title when using the detailpage parameter.

Posted: Thu Dec 11, 2008 2:46 pm
by calguy1000
Read my blog article here:
http://calguy1000.com/Blogs/4/60.html

Re: Showing the News Article Title in the title when using the detailpage parameter.

Posted: Tue Dec 30, 2008 12:30 am
by mel
Hi,
I tried Calguy's method taken from his website.
But when I add this in my head section:

Code: Select all

{if isset($pagetitle)}
<title>{$pagetitle} | {sitename}</title>
{else}
<title>{title} | {sitename}</title>
{else}

I get this error (with debug: true):
string(109) "Smarty error: [in tpl_head:22 line 11]: syntax error: unexpected {else} (Smarty_Compiler.class.php, line 478)" string(129) "Smarty error: [in tpl_head:22 line 18]: syntax error: unclosed tag \{else} (opened line 9). (Smarty_Compiler.class.php, line 317)"
Notice: Undefined property: CMS_Compiler::$_plugins_code in C:\internet\wamp\www\labneuro\lib\smarty\Smarty.class.php on line 1495

Do I have something not install correctly? I'm using 1.5.1-mle.
Thanks
Mel

Re: Showing the News Article Title in the title when using the detailpage parame

Posted: Tue Dec 30, 2008 12:49 am
by Dr.CSS
If what you pasted is exactly what is in your template you are missing somethings...

Too many {else} w/o another statement after last one, no {/if}...

Re: Showing the News Article Title in the title when using the detailpage parameter.

Posted: Thu Jan 08, 2009 11:29 am
by vedat
It didnt work in 1.4.1 Spring garden  :(

Re: Showing the News Article Title in the title when using the detailpage parameter.

Posted: Tue Jan 13, 2009 10:04 pm
by vedat
Hi again. Is there any way to work in 1.4.1???

Re: Showing the News Article Title in the title when using the detailpage parame

Posted: Tue Jan 13, 2009 10:27 pm
by Dr.CSS
Yes it works as it supposed to in 1.4.1, you just have to make sure you have it coded correctly...

Re: Showing the News Article Title in the title when using the detailpage parameter.

Posted: Tue Jan 27, 2009 1:48 pm
by cb2004
Make sure process_whole_template is set to false in the config.php file.

Re: Showing the News Article Title in the title when using the detailpage parameter.

Posted: Tue Jan 27, 2009 1:58 pm
by Ziggywigged
For this to work for me, I had to change:

{if isset($pagetitle)}
{$pagetitle} | {sitename}
{else}
{title} | {sitename}
{else}

to:

{if isset($pagetitle)}
{$pagetitle} | {sitename}
{else}
{title} | {sitename}
{/if}

Re: Showing the News Article Title in the title when using the detailpage parame

Posted: Wed Jan 28, 2009 1:29 am
by Dr.CSS
Ziggywigged

Where did you get first code that had to be changed, and yes you can't leave the {/if} out or have an {else} w/o something for it...