Meta Tags

From PhpCOIN Documentation

Jump to: navigation, search

Contents

Title, Keywords, Description

Every page that phpCOIN displays may have its own unique title, description and keywords META tags.

The title displayed by the web-browser will be the Admin -> Components -> xxxxx -> Page Title for the specified page. The title may contain spaces if you wish.

The Keywords and Description tags are array elements in /coin_lang/lang_english/lang_base.php (near the bottom). If you are not using English, then the lang_base.php file you need to edit will be in the folder of your chosen language. The array elements are:

 $_LANG['META_DESCRIPTION'][PAGE_TITLE]
 $_LANG['META_KEYWORDS'][PAGE_TITLE]

where PAGE_TITLE is an exact match for the Admin -> Components -> xxxxx-> Page Title, except that spaces in the array element PAGE_TITLE must be replaced with underscores.

For example, the "index" page in a new install of phpCOIN has an Admin -> Components -> index -> Page Title of "Home Page" and array elements:

$_LANG['META_DESCRIPTION']['Home_Page']  = 'Welcome to phpCOIN';
$_LANG['META_KEYWORDS']['Home_Page']     = 'phpcoin';

If the Admin -> Components -> index -> Page Title is changed from "Home Page" to "Welcome To phpCOIN Hosting", then the array elements must be renamed from 'Home_Page' to 'Welcome_To_phpCOIN_Hosting' as follows.

$_LANG['META_DESCRIPTION']['Welcome_To_phpCOIN_Hosting']  = 'Welcome to phpCOIN';
$_LANG['META_KEYWORDS']['Welcome_To_phpCOIN_Hosting']     = 'phpcoin';

You can add as many $_LANG['META_DESCRIPTION'] and $_LANG['META_KEYWORDS'] as you need to the language files, in order to make META tags for specific pages, as detailed in the sections below.


SiteInfo, Pages, FAQ, etc.

You can add meta tags to individual SiteInfo pages (and Pages, and ....) IF:

1: You have an Admin -> Component AND the "mod" value matches the Record ID of the page.

Type: module
Name: siteinfo (or pages, as appropriate)
Mod: must be the record id
Description: (whatever)
Page Title: PAGE NAME

2: You have added the $_LANG array elements in /coin_lang/lang_xxxxx/lang_base.php For example

$_LANG['META_DESCRIPTION']['PAGE_NAME'] = 'A SiteInfo Page Description';
$_LANG['META_KEYWORDS']['PAGE_NAME']    = 'A SiteInfo Page Keywords'; 

Naturally, replace PAGE_NAME with whatever you need. The Admin -> Components -> xxxxx-> Page Title may have spaces in the name, but the $_LANG array element must have spaces replaced by underscores.


Admin Control Panels

You can add meta tags to individual Admin Menu pages IF:

1: You have an Admin -> Component AND the "name" value matches the "cp" of the page.

Type: admin
Name: cp_xxxxx (replace xxxxx with index, banip, mail_contacts, whatever)
Mod:
Description: (whatever)
Page Title: PAGE NAME

2: You have added the array elements in /coin_lang/lang_xxxxx/lang_base.php For example

$_LANG['META_DESCRIPTION']['PAGE_NAME'] = 'An Admin Menu Item Description';
$_LANG['META_KEYWORDS']['PAGE_NAME']    = 'An Admin Menu Item Keywords'; 

Naturally, replace PAGE_NAME with whatever you need. The Admin -> Components -> Page Title may have spaces in the name, but the array element must have spaces replaced by underscores.


Third Party Themes

If you are using a theme that is not built-in to phpCOIN, in /coin_themes/xxxxx/core.php the first part of function do_page_header() must look like this:

function do_page_header($acomp_ptitle='phpCOIN', $aret_flag=0) {
	global $_CCFG, $_TCFG, $_DBCFG, $_UVAR, $_LANG, $_PACKAGE, $_GPV, $_nl, $_sp;
	$newTitle = str_replace(' ', '_', $acomp_ptitle);
	$newTitle = str_replace(strtolower('phpcoin:_'), , $newTitle);

	$_out  = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	          "http://www.w3.org/TR/html4/loose.dtd">';
	$_out .= '<html>'.$_nl;
	$_out .= '<head>'.$_nl;
	$_out .= $_CCFG[_PKG_DOC_META_TAG].$_nl;
	IF ($_LANG['META_DESCRIPTION'][$newTitle]) {
		$_out .= '<meta name="description" content="'
		         .$_LANG['META_DESCRIPTION'][$newTitle].'">'.$_nl;
	}
	IF ($_LANG['META_KEYWORDS'][$newTitle]) {
		$_out .= '<meta name="keywords" content="'
		         .$_LANG['META_KEYWORDS'][$newTitle].'">'.$_nl;
	}
	$_out .= '<meta name="MSSmartTagsPreventParsing" content="TRUE">'.$_nl;
	$_out .= '<meta name="generator" content="phpcoin">'.$_nl;
	$_out .= '<title>'.$acomp_ptitle.'</title>'.$_nl;
	IF ($_CCFG['_IS_PRINT'] != 1) {

The four lines that you may need to add to /coin_themes/xxxxx/core.php are displayed in bold.


Final Notes

In upcoming v2.0 all the page info will be in the database, editable as an Admin -> Component to make things easier.

Don't forget to put any custom meta tags in lang_base_override.php so that new versions of phpCOIN do not over-write your custom tags.

Personal tools

Inscrita el Registro Mercantil de Mallorca Tomo 2140, Hoja No. PM-51034, Folio 135
This website owned and operated by: Technology Services RPVW S.L. CIF# B57345084
Avda Constitucion 48 Bajos Alaro 07340 Baleares SPAIN
Tel:+34 971518362    Fax: +34 971518368    eMail: support@phpcoin.com