News title on the title of the page for cmsms 1.5.2+

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Wishbone
Power Poster
Power Poster
Posts: 1369
Joined: Tue Dec 23, 2008 8:39 pm

Re: News title on the title of the page for cmsms 1.5.2+

Post by Wishbone »

wishbone wrote: nevermind... I thought I was onto something special... but after I re-read the first post, it ended up that I basically did the same thing and I wasn't really as original as I thought. :)
OK.. I got my story straight now.

Regarding 'process_whole_template', I'm a bit confused about what the first post in this thread says to do, what the config.php says and what I see.

config.php

Code: Select all

# In versions of CMS Made Simple prior to version 1.4, the page template was processed
# in it's entirety.  This behaviour was later changed to process the head portion of the
# page template after the body.  If you are working with a highly configured site that
# relies significantly on the old order of smarty processing, you may want to try
# setting this parameter to false.
$config['process_whole_template'] = false;
According to this, if you want to use the old way, set it to false. However that is not what I see. When it is set to false (default, BTW), it processes the body before the head. I tested this by making sure that 'process_whole_template' is false, setting a variable in the and displaying it in the

Once I understood how this worked, I did the following, which seems even simpler than what this thread suggests.

Step one: Make sure that $config['process_whole_template'] is false

Step two: insert the following in your news detail template:

Code: Select all

{assign var='news_title' value=$entry->title}
I tried skipping this step and using $entry->title directly later, but it didn't seem to work.

Step three: Replace your line in your site's template with:

Code: Select all

{if isset($news_title)}
<title>{sitename} - {$news_title}</title>
{else}
<title>{sitename} - {title}</title>
{/if}
That's it! I didn't need to do any {capture}s of {content}, nor did I need to place the {content} in the head and use the {capture}d variable later...

Wasn't the 'process body before head' mode designed for something like this in mind? If so, why does all the threads that I find suggest capturing content in the head when I can do it my way instead? (capturing the title in the news template, and using this variable in the head).. Is there something fundamentally wrong with my method?

Sorry for the rant...... But I'm happy that I found a simple solution. and learned something in the process. :)

My hurts.  :-\
Last edited by Wishbone on Tue Dec 29, 2009 8:50 am, edited 1 time in total.
viebig

Re: News title on the title of the page for cmsms 1.5.2+

Post by viebig »

hey wishbone!

Thats correct! CMSMS chnaged a little bit ... yes,, you dont need to capture anything to display the news title on the part... but if you want to make variables avilable to the whole template you´ll need to capture the content.

Try to reus your variable in the content part, you´ll what I´m talking about!

Regards

G
Wishbone
Power Poster
Power Poster
Posts: 1369
Joined: Tue Dec 23, 2008 8:39 pm

Re: News title on the title of the page for cmsms 1.5.2+

Post by Wishbone »

viebig wrote:Thats correct! CMSMS chnaged a little bit ... yes,, you dont need to capture anything to display the news title on the part... but if you want to make variables avilable to the whole template you´ll need to capture the content.
I'm glad I understand this now.. My confusion was with the fact that this thread was started (advocating captures) long after this feature was put into place, and that the commentary in config.php that covers this feature seems backwards.
applejack
Power Poster
Power Poster
Posts: 1015
Joined: Fri Mar 30, 2007 2:28 am
Location: London

Re: News title on the title of the page for cmsms 1.5.2+

Post by applejack »

The solution by Wishbone won't work if you have the part of your template in a global content block. Whether Viebig's will I haven't tried.

Website Design & Production
http://www.applejack.co.uk
Wishbone
Power Poster
Power Poster
Posts: 1369
Joined: Tue Dec 23, 2008 8:39 pm

Re: News title on the title of the page for cmsms 1.5.2+

Post by Wishbone »

viebig's method should work in that case. The CMSms code dealing with this looks for in the template and processes it last. If it can't find it, like when in a GCB, it will process the template whole.

However if you put in the template outside of the rest of the GCB, the "process body before head" method should work.
Last edited by Wishbone on Fri Feb 05, 2010 5:06 am, edited 1 time in total.
applejack
Power Poster
Power Poster
Posts: 1015
Joined: Fri Mar 30, 2007 2:28 am
Location: London

Re: News title on the title of the page for cmsms 1.5.2+

Post by applejack »

So you are saying that you cannot split the head so that just the top part is in the template and below the title is in a global block as the process page part looks for the closing head tag?

Website Design & Production
http://www.applejack.co.uk
Wishbone
Power Poster
Power Poster
Posts: 1369
Joined: Tue Dec 23, 2008 8:39 pm

Re: News title on the title of the page for cmsms 1.5.2+

Post by Wishbone »

Not sure.. I'll have to take another look. You can't put after the GCB? Or does the GCB continue past the closing tag?
applejack
Power Poster
Power Poster
Posts: 1015
Joined: Fri Mar 30, 2007 2:28 am
Location: London

Re: News title on the title of the page for cmsms 1.5.2+

Post by applejack »

In this particular the site the global block contained the whole of the head section and some of the body but in this case it doesn't matter as I managed to do the whole site using a single template, it was more an academic point of interest.

P.S. Ted if you are listening, you should correct the statement about setting the $config['process_whole_template'] to false if you want the old order of smarty processing, as it should say true.
Last edited by applejack on Fri Feb 05, 2010 5:22 am, edited 1 time in total.

Website Design & Production
http://www.applejack.co.uk
applejack
Power Poster
Power Poster
Posts: 1015
Joined: Fri Mar 30, 2007 2:28 am
Location: London

Re: News title on the title of the page for cmsms 1.5.2+

Post by applejack »

You can do this though in your template

Code: Select all


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<__html xmlns="http://www.w3.org/1999/xhtml">
<head>

{global_content name='head'}

</head>


Website Design & Production
http://www.applejack.co.uk
zanga
Forum Members
Forum Members
Posts: 11
Joined: Sun Mar 21, 2010 6:32 pm

Re: News title on the title of the page for cmsms 1.5.2+

Post by zanga »

Hi,
How can I change the News block title in the front end?
I have changed the language for the front end but it doesn't change.

L.E. Done !I've changed it through the template.
Last edited by zanga on Tue Mar 30, 2010 2:10 pm, edited 1 time in total.
KoalaBlue
Forum Members
Forum Members
Posts: 39
Joined: Tue Sep 12, 2006 4:23 am

Re: News title on the title of the page for cmsms 1.5.2+

Post by KoalaBlue »

I had used this great solution of Viebig's several times with great results.

Today I tried to make these changes (by following the First page of this thread exactly) to a client site using CMSMS 1.6.7 but no luck :(

I wonder -- are the instructions different for later versions of CMSMS?
owr_bgld

Re: News title on the title of the page for cmsms 1.5.2+

Post by owr_bgld »

I tried it today first time - and with 1.6.7 - it works fine.

First I was testing if capture the content is necessary and left this part away. It doesn't work at the body (for title of content ex.) if you don't capture the content at the beginning of the template, so you have to capture it.


That's a top description - and let me think about many things, which are now possible for me very easy and I was searching for lots of hours in the forums  ;D *thumbsup*
samison

Thanks and advice pleeeease

Post by samison »

Hi Viebig,

I am currently helping out a friend sort out some seo issues with her site. My web experience is with Dreamweaver and wordpress so I really don't know CMS Made Simple at all and am finding it a steep learning curve. (I need a version called CMS Made Easier  ::)).

One thing that needed to be done was getting the news titles into the browser and I found your wonderful tutorial.

I followed the steps and was astonished to find that I had it working in minutes. :)

Unfortunately, I also have a downside.

Soon after making the change the site owner told me that some secondary news article links no longer worked. And then next I made a small change to the homepage (added an h3 header), saved and BAM! I lost some formatting - a white background behind a content section.

The site has a cavalcade of nested css and javascript and despite scouring over the homepage and internal pages all day, I really am no closer to finding where the problem is.

I am most certainly not complaining so please don't think that. I am just lost and don't know where else to look for an answer. Is it possible that making those changes to template as per your tutorial might have caused these issues?
Peciura

Re: News title on the title of the page for cmsms 1.5.2+

Post by Peciura »

Tutorial explains how to replace some text with another. You might have template variable conflict or some of them are not valid when they are used after you changed template processing order.
If would be useful if you posted link to page and tell exactly what links does not work.
Also post system info from "Site Admin » System Information"

For time being you might find this post very useful http://forum.cmsmadesimple.org/index.ph ... #msg203281
User avatar
drcreazy
Forum Members
Forum Members
Posts: 13
Joined: Tue Aug 31, 2010 11:50 am

Re: News title on the title of the page for cmsms 1.5.2+

Post by drcreazy »

viebig, great thanks for advice

I trying change h1 headers, but the assigned variable was empty in </__body> block (but for some reason works in <head>), before I set
{content assign="capturedcontent"}.

Now works fine!!!
Post Reply

Return to “Tips and Tricks”