Forums / Cotonti / Support / Co-template Question / bug ???

GHengeveld
#34229 2012-05-07 07:36

Several things are wrong with this code (pagetextbyidn.code.php). Try this code:

PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
if (!defined('SED_CODE')){die('Wrong URL.'); }
 
$currenttpl = file_get_contents($mskin);
if (mb_strpos($currenttpl, "{PAGE_TEXT_ID_") !== false)// if tag exist on page
{
    $matches = array();
    preg_match_all("#{(?P<tag>PAGE_TEXT_ID_(?P<id>[0-9]+))}#", $currenttpl, $matches, PREG_SET_ORDER);
    foreach ($matches as $match){
        $p_tag = $match['tag'];
        $p_id = $match['id'];
 
etc...

Update: fixed the regex

This post was edited by GHengeveld (2012-05-07 22:21, 13 years ago)