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

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
nicmare
Power Poster
Power Poster
Posts: 1150
Joined: Sat Aug 25, 2007 9:55 am

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

Post 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
gianpiero
Forum Members
Forum Members
Posts: 221
Joined: Sun Jan 07, 2007 4:32 pm

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

Post by gianpiero »

thanks a lot for your feedback  8)
I'll engage my self with 1.4.1 "Spring Garden"

ciao
gp
viebig

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

Post by viebig »

yes, go gor it, msg me if you have problems
Daryn

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

Post by Daryn »

This is brilliant. Thanks, calguy.  8)
cb2004
Power Poster
Power Poster
Posts: 317
Joined: Wed Jul 04, 2007 3:39 pm

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

Post by cb2004 »

Whats the way to do this for 1.5.1?
Daryn

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

Post 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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

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

Post by calguy1000 »

Read my blog article here:
http://calguy1000.com/Blogs/4/60.html
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
mel
Forum Members
Forum Members
Posts: 147
Joined: Mon Dec 11, 2006 11:53 pm

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

Post 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
Version 1.6-MLE
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

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

Post 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}...
vedat
Forum Members
Forum Members
Posts: 25
Joined: Mon Aug 11, 2008 12:13 pm

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

Post by vedat »

It didnt work in 1.4.1 Spring garden  :(
vedat
Forum Members
Forum Members
Posts: 25
Joined: Mon Aug 11, 2008 12:13 pm

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

Post by vedat »

Hi again. Is there any way to work in 1.4.1???
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

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

Post 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...
cb2004
Power Poster
Power Poster
Posts: 317
Joined: Wed Jul 04, 2007 3:39 pm

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

Post by cb2004 »

Make sure process_whole_template is set to false in the config.php file.
Ziggywigged
Power Poster
Power Poster
Posts: 424
Joined: Sat Feb 02, 2008 12:42 am

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

Post 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}
Take a penny, leave a penny.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

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

Post 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...
Post Reply

Return to “Tips and Tricks”