Strict Standards: Declaration of action_plugin_dlcount::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/dlcount/action.php on line 14

Strict Standards: Declaration of action_plugin_indexmenu::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/indexmenu/action.php on line 169

Strict Standards: Declaration of action_plugin_ipban::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/ipban/action.php on line 67

Strict Standards: Declaration of action_plugin_loglog::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/loglog/action.php on line 82

Strict Standards: Declaration of action_plugin_navi::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/navi/action.php on line 46

Strict Standards: Declaration of action_plugin_uparrow::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/uparrow/action.php on line 69

Strict Standards: Declaration of action_plugin_userspagecreate::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/userspagecreate/action.php on line 97

Strict Standards: Declaration of cache_instructions::retrieveCache() should be compatible with cache::retrieveCache($clean = true) in /home/www/wiki/inc/cache.php on line 289

Warning: Cannot modify header information - headers already sent by (output started at /home/www/wiki/lib/plugins/dlcount/action.php:14) in /home/www/wiki/inc/auth.php on line 312

Strict Standards: Only variables should be passed by reference in /home/www/wiki/doku.php on line 71

Warning: Cannot modify header information - headers already sent by (output started at /home/www/wiki/lib/plugins/dlcount/action.php:14) in /home/www/wiki/inc/actions.php on line 154
Meta-Tag per frontend_render [phpwcms-HowTo:wiki]

Strict Standards: Declaration of syntax_plugin_code::render() should be compatible with DokuWiki_Syntax_Plugin::render($format, &$renderer, $data) in /home/www/wiki/lib/plugins/code/syntax.php on line 41

Strict Standards: Declaration of syntax_plugin_tip::render() should be compatible with DokuWiki_Syntax_Plugin::render($format, &$renderer, $data) in /home/www/wiki/lib/plugins/tip/syntax.php on line 38

Meta-Tag per frontend_render

Meta Tags können auch zur Laufzeit per PHP-Anweisung im …./frontend_render/ Ordner gesetzt werden.

Die Funktion set_meta($name=, $content=, $http_equiv=FALSE) macht es möglich.

Verfügbar seit V1.4.x r314
Google code: Render <meta> description and <meta> keyword

New function to set <meta> tags set_meta($name, $content[, bool $http_equiv=FALSE]) 
- if $http_equiv=FALSE then <meta name="$name".../>, $http_equiv=TRUE then <meta http-equiv="$name".../>
New frontend_render sample scripts to generate or enhance meta tags and script to render custom menu 
(link sitemap block as often used in footer of pages)


Beispiel 1:

Forum: http://forum.phpwcms.org/viewtopic.php?p=119381#p119381 [DE]

// set_meta($name='', $content='', $http_equiv=FALSE)
 
set_meta('copyright', '2009 OG');     //<meta name="copyright" content="2009 OG" />
set_meta('imagetoolbar', 'no', true); //<meta http-equiv="imagetoolbar" content="no" />
set_meta('description', 'This is my description for just a test');
set_meta('robots', 'index,follow');
set_meta('Content-Language', 'en', TRUE);

Bitte auch die Datei template/inc_script/frontend_render/disabled/keywords.php beachten.


Beispiel 2:

Forum: http://forum.phpwcms.org/viewtopic.php?p=138902#p138902 [DE]

set_meta('date', date('Y-m-d'));
// Types:
// - name (default)
// - prop/property
// - itemprop
// - http-equiv
// - or whatever you like as $type
set_meta('refresh', '30', 'http-equiv');


Sind die Meta-Tags schon vorhanden, werden diese mit set_meta(… ein zweites mal eingetragen. Ist das nicht erwünscht, kann eine dieser Methoden verwendet werden → Title und meta-Tags.


Ersetzer Beispiel:

  • Ordner: template/inc_script/frontend_render/*
  • Datei: rt_set_meta.php

rt_set_meta.php

<?php
/*
 **************************************************************************
 * Meta TAGs set into <head> Text </head> of the site
 *
 * File: template/inc_script/frontend_render/rt_set_meta.php
 *
 * 31.11.2012 KH: heermann@planmatrix.de
 * ************************************************************************/
 
// ------------------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
   die("You Cannot Access This Script Directly, Have a Nice Day."); }
// ------------------------------------------------------------------------
 
 
// {SET_META_} replacement
// =======================================================
if( ! (strpos($content["all"],'{SET_META_')===false)) {
 
    // {SET_META_COPYRIGHT}
    // -----------------------------------------------------
    if( ! (strpos($content["all"],'{SET_META_COPYRIGHT}')===false)) {
        set_meta('copyright', date('Y').' My Name');                                // Set META-Data
//        $content['all'] = str_replace('{SET_META_COPYRIGHT}', '', $content['all']);    // Delete TAG
    }
    // {SET_META_REVISIT-AFTER}
    // -----------------------------------------------------
    if( ! (strpos($content["all"],'{SET_META_REVISIT-AFTER}')===false)) {
        set_meta('revisit-after', '2 days');                                // Set META-Data
//        $content['all'] = str_replace('{SET_META_REVISIT-AFTER}', '', $content['all']);    // Delete TAG
    }
    // And so on ......
    // -----------------------------------------------------
 
 
 
    // Delete all TAGs
    // -----------------------------------------------------
    $content["all"] = preg_replace('/{SET_META_(.*?)}/s', '', $content["all"]);
 
}
 
?>


Siehe auch: Title und meta-Tags


deutsch/ersetzer_rts/integrierte-tags/meta-tag.txt · Last modified: 2013/01/30 11:59 by Knut Heermann (flip-flop)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0

Strict Standards: Only variables should be passed by reference in /home/www/wiki/doku.php on line 79