Редактор темы

Реклама
Реклама
Реклама
Реклама

[модуль] псевдо iframe страница с плеером от вашего сайта

Ок а как с переменной ?)
1. Открываем engine/modules/show.full.php находим
PHP:
else $tpl->load_template( 'fullstory.tpl' );
Выше вставляем
PHP:
elseif (isset($_GET['iframe']) && intval($_GET['iframe']) == 1) {
    $tpl->load_template('iframe.tpl');
    $xfieldsdata = xfieldsdataload($row['xfields']);
    if (count($xfieldsdata)) {
        foreach ($xfields as $value) {
            $preg_safe_name = preg_quote($value[0], "'");
            if ($value[6] && !empty($xfieldsdata[$value[0]])) {
                $temp_array = explode(',', $xfieldsdata[$value[0]]);
                $value3 = [];
                foreach ($temp_array as $value2) {
                    $value2 = trim($value2);
                    $value2 = str_replace("'", "'", $value2);
                    if ($config['allow_alt_url']) {
                        $value3[] = "<a href=\"" . $config['http_home_url'] . "xfsearch/" . urlencode($value2) . "/\">" . $value2 . "</a>";
                    } else {
                        $value3[] = "<a href=\"$PHP_SELF?do=xfsearch&amp;xf=" . urlencode($value2) . "\">" . $value2 . "</a>";
                    }
                }

                $xfieldsdata[$value[0]] = implode(', ', $value3);
                unset($temp_array);
                unset($value2);
                unset($value3);
            }

            if (empty($xfieldsdata[$value[0]])) {
                $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", '', $tpl->copy_template);
                $tpl->copy_template = str_replace("[xfnotgiven_{$value[0]}]", '', $tpl->copy_template);
                $tpl->copy_template = str_replace("[/xfnotgiven_{$value[0]}]", '', $tpl->copy_template);
            } else {
                $tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", '', $tpl->copy_template);
                $tpl->copy_template = str_replace("[xfgiven_{$value[0]}]", '', $tpl->copy_template);
                $tpl->copy_template = str_replace("[/xfgiven_{$value[0]}]", '', $tpl->copy_template);
            }

            $xfieldsdata[$value[0]] = stripslashes($xfieldsdata[$value[0]]);
            $tpl->copy_template = str_replace("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl->copy_template);
        }
    }
   
    if ($config['allow_alt_url']) {
        if ($config['seo_type'] == 1 || $config['seo_type'] == 2) {
            if ($category_id && $config['seo_type'] == 2) {
                $c_url = get_url($category_id);
                $full_link = $config['http_home_url'] . $c_url . '/' . $row['id'] . '-' . $row['alt_name'] . '.html';
            } else {
                $full_link = $config['http_home_url'] . $row['id'] . '-' . $row['alt_name'] . '.html';
            }
        } else {
            $full_link = $config['http_home_url'] . date('Y/m/d/', strtotime($row['date'])) . $row['alt_name'] . '.html';
        }
    } else {
        $full_link = $config['http_home_url'] . 'index.php?newsid=' . $row['id'];
    }
   
    $tpl->set('{full-link}', $full_link);
    $tpl->compile('main');
    $tpl->clear();
    echo $tpl->result['main'];
    die();
}
Далее находим
PHP:
$news_seiten = explode("{PAGEBREAK}", $row['full_story']);
Выше вставляем
PHP:
$tpl->set('{iframe_link}', $short_link . $news_name . '/iframe');

2. Открываем .htaccess находим
Код:
# Сам пост
Ниже вставляем
Код:
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)/iframe$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_name=$4&seourl=$4&iframe=1 [L]
RewriteRule ^([^.]+)/([0-9]+)-(.*)/iframe$ index.php?newsid=$2&seourl=$3&seocat=$1&iframe=1 [L]
RewriteRule ^([0-9]+)-(.*)/iframe$ index.php?newsid=$1&seourl=$2&iframe=1 [L]

3. Создаем iframe.tpl внутри своего шаблона в нем доступны дополнительные поля и {full-link} ссылка на основную статью.
Ссылка на iframe страницу доступна тегом {iframe-link} в fullstory.tpl
 
1. Открываем engine/modules/show.full.php находим
PHP:
else $tpl->load_template( 'fullstory.tpl' );
Выше вставляем
PHP:
elseif(isset($_GET["iframe"]) && intval($_GET["iframe"]) == 1)
{
    $tpl->load_template( 'iframe.tpl' );
    $xf_iframe = xfieldsdataload($row['xfields']);
    if(count($xf_iframe))
    {
        $xfieldsdata = $xf_iframe;
        foreach($xfields as $value)
        {
            $preg_safe_name = preg_quote($value[0], "'");
            if ($value[6] AND !empty($xfieldsdata[$value[0]]))
            {
                $temp_array = explode(",", $xfieldsdata[$value[0]]);
                $value3 = array();
                foreach($temp_array as $value2)
                {
                    $value2 = trim($value2);
                    $value2 = str_replace("&#039;", "'", $value2);
                    if ($config['allow_alt_url'])
                        $value3[] = "<a href=\"" . $config['http_home_url'] . "xfsearch/" . urlencode($value2) . "/\">" . $value2 . "</a>";
                    else
                        $value3[] = "<a href=\"$PHP_SELF?do=xfsearch&amp;xf=" . urlencode($value2) . "\">" . $value2 . "</a>";
                }

                $xfieldsdata[$value[0]] = implode(", ", $value3);
                unset($temp_array);
                unset($value2);
                unset($value3);
            }

            if (empty($xfieldsdata[$value[0]]))
            {
                $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template);
                $tpl->copy_template = str_replace("[xfnotgiven_{$value[0]}]", "", $tpl->copy_template);
                $tpl->copy_template = str_replace("[/xfnotgiven_{$value[0]}]", "", $tpl->copy_template);
            }
            else
            {
                $tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template);
                $tpl->copy_template = str_replace("[xfgiven_{$value[0]}]", "", $tpl->copy_template);
                $tpl->copy_template = str_replace("[/xfgiven_{$value[0]}]", "", $tpl->copy_template);
            }

            $xfieldsdata[$value[0]] = stripslashes($xfieldsdata[$value[0]]);
       
            $tpl->copy_template = str_replace("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl->copy_template);
        }
    }
    if( $config['allow_alt_url'] )
    {
        if( $config['seo_type'] == 1 OR $config['seo_type'] == 2 )
        {
            if( $category_id AND $config['seo_type'] == 2 )
            {
                $c_url = get_url( $category_id );
                $full_link = $config['http_home_url'] . $c_url . "/" . $row['id'] . "-" . $row['alt_name'] . ".html";
            }
            else
                $full_link = $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html";
        }
        else
            $full_link = $config['http_home_url'] . date( 'Y/m/d/', $row['date'] ) . $row['alt_name'] . ".html";
    }
    else
        $full_link = $config['http_home_url'] . "index.php?newsid=" . $row['id'];
    $tpl->set('{full-link}', $full_link);
    $tpl->compile('main');
    $tpl->clear();
    echo $tpl->result['main'];
    die();
}
Далее находим
PHP:
$news_seiten = explode( "{PAGEBREAK}", $row['full_story'] );
Выше вставляем
PHP:
$tpl->set('{iframe_link}', $short_link . $news_name . "/iframe.html");
2. Открываем .htaccess находим
Код:
# Сам пост
Ниже вставляем
Код:
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)/iframe.html$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_name=$4&seourl=$4&iframe=1 [L]
RewriteRule ^([^.]+)/([0-9]+)-(.*)/iframe.html$ index.php?newsid=$2&seourl=$3&seocat=$1&iframe=1 [L]
RewriteRule ^([0-9]+)-(.*)/iframe.html$ index.php?newsid=$1&seourl=$2&iframe=1 [L]
3. Создаем iframe.tpl внутри своего шаблона в нем доступны доп поля и {full-link} ссылка на основную статью.
Ссылка с iframe доступна тегом {iframe_link}

+ Сохраняем кэш

Вуаля. Никаких доп файлов и правок в других файлов.
А если у меня 2 плеера, как 2 сделать аналогично?
 
Сделать все тоже самое но везде возле iframe подставить 2 === iframe2 в итоге выйдет
Тут $tpl->load_template( 'iframe.tpl' ); нужно другой файл прописывать, напирмер $tpl->load_template( 'iframe2.tpl' ); ?
 
Сделать все тоже самое но везде возле iframe подставить 2 === iframe2 в итоге выйдет
Второй плеер не выводится а заменяется первым плеером, что не так:
Код:
elseif(isset($_GET["iframe2"]) && intval($_GET["iframe2"]) == 1)
{
    $tpl2->load_template( 'iframe2.tpl' );
    $xf_iframe2 = xfieldsdataload($row['xfields']);
    if(count($xf_iframe2))
    {
        $xfieldsdata = $xf_iframe2;
        foreach($xfields as $value)
        {
            $preg_safe_name = preg_quote($value[0], "'");
            if ($value[6] AND !empty($xfieldsdata[$value[0]]))
            {
                $temp_array = explode(",", $xfieldsdata[$value[0]]);
                $value3 = array();
                foreach($temp_array as $value2)
                {
                    $value2 = trim($value2);
                    $value2 = str_replace("&#039;", "'", $value2);
                    if ($config['allow_alt_url'])
                        $value3[] = "<a href=\"" . $config['http_home_url'] . "xfsearch/" . urlencode($value2) . "/\">" . $value2 . "</a>";
                    else
                        $value3[] = "<a href=\"$PHP_SELF?do=xfsearch&amp;xf=" . urlencode($value2) . "\">" . $value2 . "</a>";
                }

                $xfieldsdata[$value[0]] = implode(", ", $value3);
                unset($temp_array);
                unset($value2);
                unset($value3);
            }

            if (empty($xfieldsdata[$value[0]]))
            {
                $tpl2->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl2->copy_template);
                $tpl2->copy_template = str_replace("[xfnotgiven_{$value[0]}]", "", $tpl2->copy_template);
                $tpl2->copy_template = str_replace("[/xfnotgiven_{$value[0]}]", "", $tpl2->copy_template);
            }
            else
            {
                $tpl2->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl2->copy_template);
                $tpl2->copy_template = str_replace("[xfgiven_{$value[0]}]", "", $tpl2->copy_template);
                $tpl2->copy_template = str_replace("[/xfgiven_{$value[0]}]", "", $tpl2->copy_template);
            }

            $xfieldsdata[$value[0]] = stripslashes($xfieldsdata[$value[0]]);
       
            $tpl2->copy_template = str_replace("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl2->copy_template);
        }
    }
    if( $config['allow_alt_url'] )
    {
        if( $config['seo_type'] == 1 OR $config['seo_type'] == 2 )
        {
            if( $category_id AND $config['seo_type'] == 2 )
            {
                $c_url = get_url( $category_id );
                $full_link = $config['http_home_url'] . $c_url . "/" . $row['id'] . "-" . $row['alt_name'] . ".html";
            }
            else
                $full_link = $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html";
        }
        else
            $full_link = $config['http_home_url'] . date( 'Y/m/d/', $row['date'] ) . $row['alt_name'] . ".html";
    }
    else
        $full_link = $config['http_home_url'] . "index.php?newsid=" . $row['id'];
    $tpl2->set('{full-link}', $full_link);
    $tpl2->compile('main');
    $tpl2->clear();
    echo $tpl2->result['main'];
    die();
}
 
Roman.U
$value2
$tpl2 откуда это вообще взялось?)
 
Roman.U
так цифру 2 нужно в iframe проставлять, а не везде где плохо лежит)
 
Roman.U
так цифру 2 нужно в iframe проставлять, а не везде где плохо лежит)
Тут где цыфру 2 ставить?
Код:
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)/iframe.html$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_name=$4&seourl=$4&iframe=1 [L]
RewriteRule ^([^.]+)/([0-9]+)-(.*)/iframe.html$ index.php?newsid=$2&seourl=$3&seocat=$1&iframe=1 [L]
RewriteRule ^([0-9]+)-(.*)/iframe.html$ index.php?newsid=$1&seourl=$2&iframe=1 [L]
 
Roman.U
я не кодер, но мне кажется
/iframe2.html, а так-же в конце &iframe2=1
 
1. Открываем engine/modules/show.full.php находим
PHP:
else $tpl->load_template( 'fullstory.tpl' );
Выше вставляем
PHP:
elseif(isset($_GET["iframe"]) && intval($_GET["iframe"]) == 1)
{
    $tpl->load_template( 'iframe.tpl' );
    $xf_iframe = xfieldsdataload($row['xfields']);
    if(count($xf_iframe))
    {
        $xfieldsdata = $xf_iframe;
        foreach($xfields as $value)
        {
            $preg_safe_name = preg_quote($value[0], "'");
            if ($value[6] AND !empty($xfieldsdata[$value[0]]))
            {
                $temp_array = explode(",", $xfieldsdata[$value[0]]);
                $value3 = array();
                foreach($temp_array as $value2)
                {
                    $value2 = trim($value2);
                    $value2 = str_replace("&#039;", "'", $value2);
                    if ($config['allow_alt_url'])
                        $value3[] = "<a href=\"" . $config['http_home_url'] . "xfsearch/" . urlencode($value2) . "/\">" . $value2 . "</a>";
                    else
                        $value3[] = "<a href=\"$PHP_SELF?do=xfsearch&amp;xf=" . urlencode($value2) . "\">" . $value2 . "</a>";
                }

                $xfieldsdata[$value[0]] = implode(", ", $value3);
                unset($temp_array);
                unset($value2);
                unset($value3);
            }

            if (empty($xfieldsdata[$value[0]]))
            {
                $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template);
                $tpl->copy_template = str_replace("[xfnotgiven_{$value[0]}]", "", $tpl->copy_template);
                $tpl->copy_template = str_replace("[/xfnotgiven_{$value[0]}]", "", $tpl->copy_template);
            }
            else
            {
                $tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template);
                $tpl->copy_template = str_replace("[xfgiven_{$value[0]}]", "", $tpl->copy_template);
                $tpl->copy_template = str_replace("[/xfgiven_{$value[0]}]", "", $tpl->copy_template);
            }

            $xfieldsdata[$value[0]] = stripslashes($xfieldsdata[$value[0]]);
       
            $tpl->copy_template = str_replace("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl->copy_template);
        }
    }
    if( $config['allow_alt_url'] )
    {
        if( $config['seo_type'] == 1 OR $config['seo_type'] == 2 )
        {
            if( $category_id AND $config['seo_type'] == 2 )
            {
                $c_url = get_url( $category_id );
                $full_link = $config['http_home_url'] . $c_url . "/" . $row['id'] . "-" . $row['alt_name'] . ".html";
            }
            else
                $full_link = $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html";
        }
        else
            $full_link = $config['http_home_url'] . date( 'Y/m/d/', $row['date'] ) . $row['alt_name'] . ".html";
    }
    else
        $full_link = $config['http_home_url'] . "index.php?newsid=" . $row['id'];
    $tpl->set('{full-link}', $full_link);
    $tpl->compile('main');
    $tpl->clear();
    echo $tpl->result['main'];
    die();
}
Далее находим
PHP:
$news_seiten = explode( "{PAGEBREAK}", $row['full_story'] );
Выше вставляем
PHP:
$tpl->set('{iframe_link}', $short_link . $news_name . "/iframe.html");
2. Открываем .htaccess находим
Код:
# Сам пост
Ниже вставляем
Код:
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)/iframe.html$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_name=$4&seourl=$4&iframe=1 [L]
RewriteRule ^([^.]+)/([0-9]+)-(.*)/iframe.html$ index.php?newsid=$2&seourl=$3&seocat=$1&iframe=1 [L]
RewriteRule ^([0-9]+)-(.*)/iframe.html$ index.php?newsid=$1&seourl=$2&iframe=1 [L]
3. Создаем iframe.tpl внутри своего шаблона в нем доступны доп поля и {full-link} ссылка на основную статью.
Ссылка с iframe доступна тегом {iframe_link}

+ Сохраняем кэш

Вуаля. Никаких доп файлов и правок в других файлов.


Пытался сделать на два плеера, однако работает к примеру iframe1, а iframe2 просто при клике на ссылку кидает на новость с добавлением /iframe2.html
 
Пытался сделать на два плеера, однако работает к примеру iframe1, а iframe2 просто при клике на ссылку кидает на новость с добавлением /iframe2.html
Тоже уже фиг знает сколько вожусь с плеером, походу код гамера не подходит под 2 плеера.
 
Тоже уже фиг знает сколько вожусь с плеером, походу код гамера не подходит под 2 плеера.
1. Открываем engine/modules/show.full.php находим
PHP:
else $tpl->load_template( 'fullstory.tpl' );
Выше вставляем
PHP:
elseif (intval($_GET['iframe2']) == 1) {
    $tpl->load_template('iframe2.tpl');
    $xf_iframe = xfieldsdataload($row['xfields']);
    if (count($xf_iframe)) {
        $xfieldsdata = $xf_iframe;
        foreach ($xfields as $value) {
            $preg_safe_name = preg_quote($value[0], "'");
            if ($value[6] && !empty($xfieldsdata[$value[0]])) {
                $temp_array = explode(',', $xfieldsdata[$value[0]]);
                $value3 = [];
                foreach($temp_array as $value2) {
                    $value2 = trim($value2);
                    $value2 = str_replace("&#039;", "'", $value2);
                    if ($config['allow_alt_url']) {
                        $value3[] = "<a href=\"" . $config['http_home_url'] . "xfsearch/" . urlencode($value2) . "/\">" . $value2 . "</a>";
                    } else {
                        $value3[] = "<a href=\"$PHP_SELF?do=xfsearch&amp;xf=" . urlencode($value2) . "\">" . $value2 . "</a>";
                    }
                }

                $xfieldsdata[$value[0]] = implode(', ', $value3);
                unset($temp_array);
                unset($value2);
                unset($value3);
            }

            if (empty($xfieldsdata[$value[0]])) {
                $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", '', $tpl->copy_template);
                $tpl->copy_template = str_replace("[xfnotgiven_{$value[0]}]", "", $tpl->copy_template);
                $tpl->copy_template = str_replace("[/xfnotgiven_{$value[0]}]", "", $tpl->copy_template);
            } else {
                $tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", '' $tpl->copy_template);
                $tpl->copy_template = str_replace("[xfgiven_{$value[0]}]", "", $tpl->copy_template);
                $tpl->copy_template = str_replace("[/xfgiven_{$value[0]}]", "", $tpl->copy_template);
            }

            $xfieldsdata[$value[0]] = stripslashes($xfieldsdata[$value[0]]);
            $tpl->copy_template = str_replace("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl->copy_template);
        }
    }
   
    if ($config['allow_alt_url']) {
        if ($config['seo_type'] == 1 || $config['seo_type'] == 2) {
            if ($category_id && $config['seo_type'] == 2) {
                $c_url = get_url($category_id);
                $full_link = $config['http_home_url'] . $c_url . '/' . $row['id'] . '-' . $row['alt_name'] . '.html';
            } else {
                $full_link = $config['http_home_url'] . $row['id'] . '-' . $row['alt_name'] . '.html';
            }
        } else {
            $full_link = $config['http_home_url'] . date('Y/m/d/', $row['date']) . $row['alt_name'] . '.html';
        }
    } else {
        $full_link = $config['http_home_url'] . 'index.php?newsid=' . $row['id'];
    }
   
    $tpl->set('{full-link}', $full_link);
    $tpl->compile('main');
    $tpl->clear();
    echo $tpl->result['main'];
    die();
}

Далее находим
PHP:
$news_seiten = explode( "{PAGEBREAK}", $row['full_story'] );
Выше вставляем
PHP:
$tpl->set('{iframe_link_2}', $short_link . $news_name . '/iframe2.html');

2. Открываем .htaccess находим
Код:
# Сам пост
Ниже вставляем
Код:
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)/iframe2.html$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_name=$4&seourl=$4&iframe2=1 [L]
RewriteRule ^([^.]+)/([0-9]+)-(.*)/iframe2.html$ index.php?newsid=$2&seourl=$3&seocat=$1&iframe2=1 [L]
RewriteRule ^([0-9]+)-(.*)/iframe2.html$ index.php?newsid=$1&seourl=$2&iframe2=1 [L]

3. Создаем iframe2.tpl внутри своего шаблона в нем доступны доп поля и {full-link} ссылка на основную статью.
Ссылка с iframe доступна тегом {iframe_link_2}

View: https://www.youtube.com/watch?v=AwO7FpJZAfg


p.s не думай что я хочу посмеяться или тип того, но реально ведь все просто.
 
1. Открываем engine/modules/show.full.php находим
PHP:
else $tpl->load_template( 'fullstory.tpl' );
Выше вставляем
PHP:
elseif (intval($_GET['iframe2']) == 1) {
    $tpl->load_template('iframe2.tpl');
    $xf_iframe = xfieldsdataload($row['xfields']);
    if (count($xf_iframe)) {
        $xfieldsdata = $xf_iframe;
        foreach ($xfields as $value) {
            $preg_safe_name = preg_quote($value[0], "'");
            if ($value[6] && !empty($xfieldsdata[$value[0]])) {
                $temp_array = explode(',', $xfieldsdata[$value[0]]);
                $value3 = [];
                foreach($temp_array as $value2) {
                    $value2 = trim($value2);
                    $value2 = str_replace("&#039;", "'", $value2);
                    if ($config['allow_alt_url']) {
                        $value3[] = "<a href=\"" . $config['http_home_url'] . "xfsearch/" . urlencode($value2) . "/\">" . $value2 . "</a>";
                    } else {
                        $value3[] = "<a href=\"$PHP_SELF?do=xfsearch&amp;xf=" . urlencode($value2) . "\">" . $value2 . "</a>";
                    }
                }

                $xfieldsdata[$value[0]] = implode(', ', $value3);
                unset($temp_array);
                unset($value2);
                unset($value3);
            }

            if (empty($xfieldsdata[$value[0]])) {
                $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", '', $tpl->copy_template);
                $tpl->copy_template = str_replace("[xfnotgiven_{$value[0]}]", "", $tpl->copy_template);
                $tpl->copy_template = str_replace("[/xfnotgiven_{$value[0]}]", "", $tpl->copy_template);
            } else {
                $tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", '' $tpl->copy_template);
                $tpl->copy_template = str_replace("[xfgiven_{$value[0]}]", "", $tpl->copy_template);
                $tpl->copy_template = str_replace("[/xfgiven_{$value[0]}]", "", $tpl->copy_template);
            }

            $xfieldsdata[$value[0]] = stripslashes($xfieldsdata[$value[0]]);
            $tpl->copy_template = str_replace("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl->copy_template);
        }
    }
  
    if ($config['allow_alt_url']) {
        if ($config['seo_type'] == 1 || $config['seo_type'] == 2) {
            if ($category_id && $config['seo_type'] == 2) {
                $c_url = get_url($category_id);
                $full_link = $config['http_home_url'] . $c_url . '/' . $row['id'] . '-' . $row['alt_name'] . '.html';
            } else {
                $full_link = $config['http_home_url'] . $row['id'] . '-' . $row['alt_name'] . '.html';
            }
        } else {
            $full_link = $config['http_home_url'] . date('Y/m/d/', $row['date']) . $row['alt_name'] . '.html';
        }
    } else {
        $full_link = $config['http_home_url'] . 'index.php?newsid=' . $row['id'];
    }
  
    $tpl->set('{full-link}', $full_link);
    $tpl->compile('main');
    $tpl->clear();
    echo $tpl->result['main'];
    die();
}

Далее находим
PHP:
$news_seiten = explode( "{PAGEBREAK}", $row['full_story'] );
Выше вставляем
PHP:
$tpl->set('{iframe_link_2}', $short_link . $news_name . '/iframe2.html');

2. Открываем .htaccess находим
Код:
# Сам пост
Ниже вставляем
Код:
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)/iframe2.html$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_name=$4&seourl=$4&iframe2=1 [L]
RewriteRule ^([^.]+)/([0-9]+)-(.*)/iframe2.html$ index.php?newsid=$2&seourl=$3&seocat=$1&iframe2=1 [L]
RewriteRule ^([0-9]+)-(.*)/iframe2.html$ index.php?newsid=$1&seourl=$2&iframe2=1 [L]

3. Создаем iframe2.tpl внутри своего шаблона в нем доступны доп поля и {full-link} ссылка на основную статью.
Ссылка с iframe доступна тегом {iframe_link_2}

View: https://www.youtube.com/watch?v=AwO7FpJZAfg


p.s не думай что я хочу посмеяться или тип того, но реально ведь все просто.

Да нет, проблема, не в изменении кода, все делал так же, однако работает iframe1, а iframe2 просто при клике на ссылку кидает на новость с добавлением /iframe2.html
По отдельности все гуд
 
Да нет, проблема, не в изменении кода, все делал так же, однако работает iframe1, а iframe2 просто при клике на ссылку кидает на новость с добавлением /iframe2.html
По отдельности все гуд
Этого не должно быть, вся настройка идет в .htaccess, там мы и указываем что это новость и что это iframe2.tpl
Возможно, возможно, может быть потому что включено исправление неверных URL. Я не проверял с этой опцией. По-этому гарантировать что работать код будет не могу, но по логике все должно работать.

Я скинул там измененный код под iframe2.html вы его пробовали вставлять?
 
elseif (intval($_GET['iframe2']) == 1) {
$tpl->load_template('iframe2.tpl');
$xf_iframe = xfieldsdataload($row['xfields']);
if (
count($xf_iframe)) {
$xfieldsdata = $xf_iframe;
foreach (
$xfields as $value) {
$preg_safe_name = preg_quote($value[0], "'");
if (
$value[6] && !empty($xfieldsdata[$value[0]])) {
$temp_array = explode(',', $xfieldsdata[$value[0]]);
$value3 = [];
foreach(
$temp_array as $value2) {
$value2 = trim($value2);
$value2 = str_replace("&#039;", "'", $value2);
if (
$config['allow_alt_url']) {
$value3[] = "<a href=\"" . $config['http_home_url'] . "xfsearch/" . urlencode($value2) . "/\">" . $value2 . "</a>";
} else {
$value3[] = "<a href=\"$PHP_SELF?do=xfsearch&amp;xf=" . urlencode($value2) . "\">" . $value2 . "</a>";
}
}

$xfieldsdata[$value[0]] = implode(', ', $value3);
unset(
$temp_array);
unset(
$value2);
unset(
$value3);
}

if (empty(
$xfieldsdata[$value[0]])) {
$tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", '', $tpl->copy_template);
$tpl->copy_template = str_replace("[xfnotgiven_{$value[0]}]", "", $tpl->copy_template);
$tpl->copy_template = str_replace("[/xfnotgiven_{$value[0]}]", "", $tpl->copy_template);
} else {
$tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", '' $tpl->copy_template);
$tpl->copy_template = str_replace("[xfgiven_{$value[0]}]", "", $tpl->copy_template);
$tpl->copy_template = str_replace("[/xfgiven_{$value[0]}]", "", $tpl->copy_template);
}

$xfieldsdata[$value[0]] = stripslashes($xfieldsdata[$value[0]]);
$tpl->copy_template = str_replace("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl->copy_template);
}
}

if (
$config['allow_alt_url']) {
if (
$config['seo_type'] == 1 || $config['seo_type'] == 2) {
if (
$category_id && $config['seo_type'] == 2) {
$c_url = get_url($category_id);
$full_link = $config['http_home_url'] . $c_url . '/' . $row['id'] . '-' . $row['alt_name'] . '.html';
} else {
$full_link = $config['http_home_url'] . $row['id'] . '-' . $row['alt_name'] . '.html';
}
} else {
$full_link = $config['http_home_url'] . date('Y/m/d/', $row['date']) . $row['alt_name'] . '.html';
}
} else {
$full_link = $config['http_home_url'] . 'index.php?newsid=' . $row['id'];
}

$tpl->set('{full-link}', $full_link);
$tpl->compile('main');
$tpl->clear();
echo
$tpl->result['main'];
die();
}
При вставке этого кода: Parse error: syntax error, unexpected '$tpl' (T_VARIABLE), expecting ',' or ')' in ....................................../engine/modules/show.full.php on line 271 Сайт ваше перестает работать.
 
При вставке этого кода: Parse error: syntax error, unexpected '$tpl' (T_VARIABLE), expecting ',' or ')' in ....................................../engine/modules/show.full.php on line 271 Сайт ваше перестает работать.
PHP:
elseif (intval($_GET['iframe2']) == 1) {
    $tpl->load_template('iframe2.tpl');
    $xf_iframe = xfieldsdataload($row['xfields']);
    if (count($xf_iframe)) {
        $xfieldsdata = $xf_iframe;
        foreach ($xfields as $value) {
            $preg_safe_name = preg_quote($value[0], "'");
            if ($value[6] && !empty($xfieldsdata[$value[0]])) {
                $temp_array = explode(',', $xfieldsdata[$value[0]]);
                $value3 = [];
                foreach($temp_array as $value2) {
                    $value2 = trim($value2);
                    $value2 = str_replace("&#039;", "'", $value2);
                    if ($config['allow_alt_url']) {
                        $value3[] = "<a href=\"" . $config['http_home_url'] . "xfsearch/" . urlencode($value2) . "/\">" . $value2 . "</a>";
                    } else {
                        $value3[] = "<a href=\"$PHP_SELF?do=xfsearch&amp;xf=" . urlencode($value2) . "\">" . $value2 . "</a>";
                    }
                }

                $xfieldsdata[$value[0]] = implode(', ', $value3);
                unset($temp_array);
                unset($value2);
                unset($value3);
            }

            if (empty($xfieldsdata[$value[0]])) {
                $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", '', $tpl->copy_template);
                $tpl->copy_template = str_replace("[xfnotgiven_{$value[0]}]", '', $tpl->copy_template);
                $tpl->copy_template = str_replace("[/xfnotgiven_{$value[0]}]", '', $tpl->copy_template);
            } else {
                $tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", '', $tpl->copy_template);
                $tpl->copy_template = str_replace("[xfgiven_{$value[0]}]", '', $tpl->copy_template);
                $tpl->copy_template = str_replace("[/xfgiven_{$value[0]}]", '', $tpl->copy_template);
            }

            $xfieldsdata[$value[0]] = stripslashes($xfieldsdata[$value[0]]);
            $tpl->copy_template = str_replace("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl->copy_template);
        }
    }
  
    if ($config['allow_alt_url']) {
        if ($config['seo_type'] == 1 || $config['seo_type'] == 2) {
            if ($category_id && $config['seo_type'] == 2) {
                $c_url = get_url($category_id);
                $full_link = $config['http_home_url'] . $c_url . '/' . $row['id'] . '-' . $row['alt_name'] . '.html';
            } else {
                $full_link = $config['http_home_url'] . $row['id'] . '-' . $row['alt_name'] . '.html';
            }
        } else {
            $full_link = $config['http_home_url'] . date('Y/m/d/', $row['date']) . $row['alt_name'] . '.html';
        }
    } else {
        $full_link = $config['http_home_url'] . 'index.php?newsid=' . $row['id'];
    }
  
    $tpl->set('{full-link}', $full_link);
    $tpl->compile('main');
    $tpl->clear();
    echo $tpl->result['main'];
    die();
}
 
PHP:
elseif (intval($_GET['iframe2']) == 1) {
    $tpl->load_template('iframe2.tpl');
    $xf_iframe = xfieldsdataload($row['xfields']);
    if (count($xf_iframe)) {
        $xfieldsdata = $xf_iframe;
        foreach ($xfields as $value) {
            $preg_safe_name = preg_quote($value[0], "'");
            if ($value[6] && !empty($xfieldsdata[$value[0]])) {
                $temp_array = explode(',', $xfieldsdata[$value[0]]);
                $value3 = [];
                foreach($temp_array as $value2) {
                    $value2 = trim($value2);
                    $value2 = str_replace("&#039;", "'", $value2);
                    if ($config['allow_alt_url']) {
                        $value3[] = "<a href=\"" . $config['http_home_url'] . "xfsearch/" . urlencode($value2) . "/\">" . $value2 . "</a>";
                    } else {
                        $value3[] = "<a href=\"$PHP_SELF?do=xfsearch&amp;xf=" . urlencode($value2) . "\">" . $value2 . "</a>";
                    }
                }

                $xfieldsdata[$value[0]] = implode(', ', $value3);
                unset($temp_array);
                unset($value2);
                unset($value3);
            }

            if (empty($xfieldsdata[$value[0]])) {
                $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", '', $tpl->copy_template);
                $tpl->copy_template = str_replace("[xfnotgiven_{$value[0]}]", '', $tpl->copy_template);
                $tpl->copy_template = str_replace("[/xfnotgiven_{$value[0]}]", '', $tpl->copy_template);
            } else {
                $tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", '', $tpl->copy_template);
                $tpl->copy_template = str_replace("[xfgiven_{$value[0]}]", '', $tpl->copy_template);
                $tpl->copy_template = str_replace("[/xfgiven_{$value[0]}]", '', $tpl->copy_template);
            }

            $xfieldsdata[$value[0]] = stripslashes($xfieldsdata[$value[0]]);
            $tpl->copy_template = str_replace("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl->copy_template);
        }
    }
 
    if ($config['allow_alt_url']) {
        if ($config['seo_type'] == 1 || $config['seo_type'] == 2) {
            if ($category_id && $config['seo_type'] == 2) {
                $c_url = get_url($category_id);
                $full_link = $config['http_home_url'] . $c_url . '/' . $row['id'] . '-' . $row['alt_name'] . '.html';
            } else {
                $full_link = $config['http_home_url'] . $row['id'] . '-' . $row['alt_name'] . '.html';
            }
        } else {
            $full_link = $config['http_home_url'] . date('Y/m/d/', $row['date']) . $row['alt_name'] . '.html';
        }
    } else {
        $full_link = $config['http_home_url'] . 'index.php?newsid=' . $row['id'];
    }
 
    $tpl->set('{full-link}', $full_link);
    $tpl->compile('main');
    $tpl->clear();
    echo $tpl->result['main'];
    die();
}
Сяп, вроде работает.
 
Подскажите пожалуйста, как сделать, чтобы в iframe.tpl работали все теги как в main.tpl?
 
было бы круто делать mysite.com/embed/newsid
 

Похожие темы Последние темы Популярные темы

Назад
Сверху