Get News Article Title Displayed in Page Title
Posted: Sat Feb 10, 2007 1:17 am
To get News Article Title in Page Title like I just got working on this page: http://www.elijahlofgren.com/news/241/56/
Update: The instructions below are now outdated. No source modification is necessary. See this post: http://forum.cmsmadesimple.org/index.ph ... l#msg58559
1. Open modules/News/action.detail.php
2.Find this line:
3.After that line add this code on a new line:
4.Log into your CMSMS Admin Panel
5.Go to "Extensions » User Defined Tags"
6.Click the "Add User Defined Tag" link.
7.In the "*Name:" field paste this name (can really be anything as long as no spaces or special chars):
8.In the "*Code" field paste this:
9.Click the "Submit" button
10.Now go to "Extensions » Events"
11.Click on the "ContentPostRender" link (Description is "Sent before the combined html is sent to the browser") URL will be like: /admin/editevent.php?action=edit&module=Core&event=ContentPostRender
12.From the dropdown select "add_news_title_to_page_title"
13.Click the "Add" submit button.
Whew, now when a news article is viewed, the page title should have the article title in it.
Hope this helps someone,
Elijah
Update: The instructions below are now outdated. No source modification is necessary. See this post: http://forum.cmsmadesimple.org/index.ph ... l#msg58559
1. Open modules/News/action.detail.php
2.Find this line:
Code: Select all
$onerow->title = $row['news_title'];
Code: Select all
$this->news_title = $row['news_title'];
5.Go to "Extensions » User Defined Tags"
6.Click the "Add User Defined Tag" link.
7.In the "*Name:" field paste this name (can really be anything as long as no spaces or special chars):
Code: Select all
add_news_title_to_page_title
Code: Select all
global $gCms;
$module =& $gCms->modules['News']['object'];
if (isset($module->news_title))
{
$text = $module->news_title;
if (function_exists('str_ireplace'))
{
$params['content'] = str_ireplace('<title>', '<title>'.$text. ' - ', $params['content']);
}
else
{
$params['content'] = eregi_replace('<title>', '<title>'.$text. ' - ', $params['content'] );
}
}
10.Now go to "Extensions » Events"
11.Click on the "ContentPostRender" link (Description is "Sent before the combined html is sent to the browser") URL will be like: /admin/editevent.php?action=edit&module=Core&event=ContentPostRender
12.From the dropdown select "add_news_title_to_page_title"
13.Click the "Add" submit button.
Whew, now when a news article is viewed, the page title should have the article title in it.
Hope this helps someone,
Elijah