Show content title (not page title) in template. - Joomla! Forum - community, help and support


for aesthetic reasons, need display article title outside article component area.

solutions have tried far are:
a) echo $mainframe->getpagetitle() in template.php
b) create module echo jfactory::getdocument()->title;

however, both of these suffer 2 separate problems

1. if using title plugin append site name title (e.g. "page title - site name"), site name appears title displayed. in reality want site name within html <title> tag.

2. text displayed not article title, page title. i.e. if article title 'x' menu item points article given title of 'y' (in parameters system section) title displayed y, not x.

point 2 important useful seo point of view able set <title> content different <h1> content. in previous joomla site able override title tag specific pages setting different title on menu item.

sorry if sounds complicted. basically, problem how hold of article title either within module or within template. appreciated..

i'm used using code more in api, use following article title:

code: select all

$doc = jfactory::getdocument();
$title = $doc->gettitle();

a little different code, may still return site name title. use simple php replace rid of site name?

code: select all

$conf =& jfactory::getconfig();
$sitename = $conf->getvalue('config.sitename');
$title = str_replace(' - ' . $sitename, '', $title);
echo $title;





Comments

Popular posts from this blog

How to decompile jsxbin to jsx

Gavik Photoslide GK2: Not able to upload photos - Joomla! Forum - community, help and support

Phoca Guestbook logger registret bruger af - Joomla! Forum - community, help and support