<![CDATA[ Support/Comments for TemplateSwitcher plugin - My Forums]]> https://forums.modx.com/thread/?thread=38315 <![CDATA[Re: Support/Comments for TemplateSwitcher plugin]]> https://forums.modx.com/thread/38315/support-comments-for-templateswitcher-plugin#dis-post-217282
$sideIid is the id of the current document
$id is the id of the template

Please note, that all variables must be defined in both templates.

<?php

$id = $_REQUEST['id'];
$sideId = $_REQUEST['sideId'];

if (!isset($id) || empty($id))
{   echo 'Keine Auswahl getroffen';
    return;
}

$path = "../../";

include_once $path . "manager/includes/config.inc.php";
include_once $path . 'manager/includes/document.parser.class.inc.php';
include_once $path . "manager/processors/cache_sync.class.processor.php";

$modx = new DocumentParser();

$table = $modx->getFullTableName('site_content');
$temptable = $modx->getFullTableName('site_templates');

$sql = 'update modx_site_content set template=' . $id;
$modx->db->query($sql);

$sync = new synccache();
$sync->setCachepath($path . "assets/cache/");
$sync->setReport(false);
@$sync->emptyCache();

if (isset($sideId))
{   $modx->sendRedirect($path . "index.php?id=" . $sideId);
    return;
}

$displayName = $modx->db->getValue("select templatename from $temptable where id=$id");
echo "Menü auf <b>$displayName</b> geändert.<br>"
     . "<p>Bitte den Zurück-Button benutzen"
     . "<p><b> gegebenfalls Seite neu laden (Taste F5)</b>";

return;

?>
]]>
persepolis Aug 10, 2006, 01:16 AM https://forums.modx.com/thread/38315/support-comments-for-templateswitcher-plugin#dis-post-217282
<![CDATA[Re: Support/Comments for TemplateSwitcher plugin]]> https://forums.modx.com/thread/38315/support-comments-for-templateswitcher-plugin#dis-post-217281
Possible fix for this in the pipeline.]]>
scraf Aug 09, 2006, 06:51 AM https://forums.modx.com/thread/38315/support-comments-for-templateswitcher-plugin#dis-post-217281
<![CDATA[Re: Support/Comments for TemplateSwitcher plugin]]> https://forums.modx.com/thread/38315/support-comments-for-templateswitcher-plugin#dis-post-217280
http://www.scraf.nl ( http://www.scraf.nl/index.php?id=1&template=default )
http://www.scraf.nl/index.php?id=1&template=scraf01

???]]>
scraf Aug 09, 2006, 05:54 AM https://forums.modx.com/thread/38315/support-comments-for-templateswitcher-plugin#dis-post-217280
<![CDATA[Re: Support/Comments for TemplateSwitcher plugin]]> https://forums.modx.com/thread/38315/support-comments-for-templateswitcher-plugin#dis-post-217279 sottwell Aug 09, 2006, 05:46 AM https://forums.modx.com/thread/38315/support-comments-for-templateswitcher-plugin#dis-post-217279 <![CDATA[Support/Comments for TemplateSwitcher plugin]]> https://forums.modx.com/thread/38315/support-comments-for-templateswitcher-plugin#dis-post-217278
My goal is to for the user to be able to switch templates when viewing my site, similar to "zen garden", although not as pretty.

I have tried to implement sottwell’s TemplateSwitcher plug-in.


// add template=templatename to the URL

So I have added to the default index page.

<a href="[~1~]?template=default">default</a><br />
<a href="[~1~]?template=scraf01">text only</a>


scraf01 being the name of a template with no css file.

Clicking on "text only" gives http://www.scraf.nl/index.php?id=1&refurl=%2Findex.php%3Fid%3D1%3Ftemplate%3Dscraf01&err=1

If I turn on friendly url’s I get
http://www.scraf.nl/minimal-base.html?template=scraf01

huh]]>
scraf Aug 09, 2006, 05:39 AM https://forums.modx.com/thread/38315/support-comments-for-templateswitcher-plugin#dis-post-217278