• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [SOLVED] Adding to/setting page title from within a module
PostPosted: Wed Sep 21, 2011 9:26 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Mon Sep 28, 2009 5:25 pm
Posts: 54
Is it possible? I've tried
Code:
$contentobj = $gCms->variables['content_obj'];
$contentobj->mName = "Lorem ipsum | {$contentobj->mName}";

but by the time this code runs the page title has already been set. I could've sworn that I've come across this before and found a solution for it, but I think that was well over a year ago and I can't even remember what project that was for nevermind being able to find it in the forums.


Last edited by kidcardboard on Wed Sep 21, 2011 9:45 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Adding to/setting page title from within a module
PostPosted: Wed Sep 21, 2011 9:45 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Mon Sep 28, 2009 5:25 pm
Posts: 54
Right after I posted this I had a hunch where I did it and was right. For anyone else who is curious how to do this it is as follows.

In your page template remove
Code:
{process_pagedata}
and replace it with
Code:
{content assign="capturedcontent"}

Then change your title tag to
Code:
<title>{if isset($pagetitle)}{$pagetitle}{else}{title}{/if}</title>
or structure it however you want. Then from within your module you can set {$pagetitle} to whatever you want.
Then replace
Code:
{content}
with
Code:
{$capturedcontent}


Top
 Profile  
 
 Post subject: Re: [SOLVED] Adding to/setting page title from within a modu
PostPosted: Wed Sep 21, 2011 10:14 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 6609
Location: Fernie British Columbia, Canada
Your instructions are just... well wrong... I blogged and wrote an article about this YEARS ago.

Step 1:
ensure $config['process_whole_template'] = false; in the config.php

Step 2:
In your module template code (usually a detail template) do something like:
{assign var='title' value=$entry->title}

Step 3:
In your page template:
<title>{if isset($title)}{$title}{else}{title}{/if}</title>

_________________
Follow me on twitter
--
if you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
----------------
Don't make me angry..... you won't like me when I'm angry....


Top
 Profile  
 
 Post subject: Re: [SOLVED] Adding to/setting page title from within a modu
PostPosted: Mon Sep 26, 2011 3:26 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Mon Sep 28, 2009 5:25 pm
Posts: 54
That's much easier. Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Arvixe - A CMSMS Partner