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
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, 11 years ago)