1
rsalomone
Dynamic Meta Tags, Titles and Descriptions
  • 2007/7/9 3:48

  • rsalomone

  • Just popping in

  • Posts: 21

  • Since: 2005/6/21


I have tried using the excellent XBS_Tags module but it fails to work on 2.0.16 (for me). The developer tried to help me but could not duplicate the problem.

I also required a different way of attacking the problem of dynamic titles, meta tags and descriptions. I prefer to use wiwimod (wiki module) and it has parameters for the same page. XBS_Tags cannot distinguish between 2 URLs with the same page but unique parameters.

I was forced to abandon XBS Tags and use the following hack.

I put into footer.php and it works fairly well but I have to do it manually whenever I add a new page as follows:

where the URL would be something like:
http://www.callaccountingsoftware.com/wiwimod/index.php?page=About

$page = $_GET['page'];
$myts =& MyTextSanitizer::getInstance();
$page = $myts->undoHtmlSpecialChars($page);

switch ($page) {
case 'About':
$page = "About ABC Company Title";
$pagekey = "Key 1, Key 2, Key 3... Key n";
$pagedesc = "Description of ABC Company";
break;

case 'Products':
$page = "Products offered by ABC Company";
$pagekey = "Product 1, Product 2, Product 3...";
$pagedesc = "ABC Company Product Description";
break;

default:
$page = "Default Title for all other pages";
$pagekey = "Key 1, Key 2, Key 3...Key n";
$pagedesc = "General Description";
break;
}

$xoopsTpl->assign('xoops_pagetitle', strip_tags($page));

$xoopsTpl->_tpl_vars['xoTheme']->metas['meta']['description'] = strip_tags($pagedesc);
$xoopsTpl->assign('xoops_meta_description', strip_tags($pagedesc));

$xoopsTpl->_tpl_vars['xoTheme']->metas['meta']['keywords'] = $pagekey;
$xoopsTpl->assign('xoops_meta_keywords', $pagekey);

This all works with one small glitch. I have to remove the contents of the default metatags, description and title in the General Preferences area. Secondly, I get a "-" dash preceeding the title. Does anyone know how to get rid of it?

It works if I insert the above code right above:

$xoTheme->render();

of the footer.php page.

Login

Who's Online

330 user(s) are online (233 user(s) are browsing Support Forums)


Members: 0


Guests: 330


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits