this thread should actually go to "Open Development", but I'm not sure, if all of you have an eye on that forum. So I post it here.
This is about problems caused by templates that use their own version of jQuery in the template the following way:
Code: Select all
<head>
<?php echo head() ?>
<script type="text/javascript" src=".../jquery.js"></script>
</head>
That is because jQuery plugins hook directly to the jQuery "namespace". If another jQuery library is included later, all those definitions will be lost. So what to do? The most simple solution might be to change the order: include the own jQuery first, and then echo head(). But this won't work, if the template uses a jQuery plugin (e.g. suckerfish), and the <meta http-equiv="content-type" content="text/html;charset=utf-8"> might be written to the output too late (IIRC there's even a limit, that it should be sent in the first X bytes).
So you should consider to change those templates to use jQuery4CMSimple instead of using your "own" version. jQuery4CMSimple is bundled with CMSimple_XH since 1.4.1 and can be downloaded separately and installed for other versions (should work fine with CMSimple 3.x and CMSimple LE 3.4.x). The following code skeleton shows how to use it:
Code: Select all
<?php
// if jQuery4CMSimple is installed, include its jQuery library
if (is_readable($pth['folder']['plugins'].'jquery/jquery.inc.php')) {
include_once $pth['folder']['plugins'].'jquery/jquery.inc.php';
include_jQuery();
}
?>
<head>
<?php echo head();?>
<!-- additional template specific stuff, e.g. further stylesheets, JS etc. -->
<!-- to include jQuery plugins (e.g. superfish), you can use the following (note that you have to deliver superfish.js with your template: -->
<?php include_jQueryPlugin('superfish', $pth['folder']['template'].'superfish.js') ?>
</head>
<body id="body" <?php echo onload();?>>
<?php if (!is_readable($pth['folder']['plugins'].'jquery/jquery.inc.php')) { // jQuery4CMSimple is not installed! Emit a warning ?>
<div class="cmsimplecore_warning">This template requires <a href="http://cmsimple.holgerirmler.de/en/?Plugins:jQuery">jQuery4CMSimple</a>. Please <a href="http://cmsimple.holgerirmler.de/ccount/click.php?id=10">download</a> and install it first.</div>
<?php } ?>
Christoph
PS: The code posted above was buggy (I forgot a pair of quotes)! I've corrected it now.
PPS: I've changed the link to jQuery4CMSimple to point to the website (might be better, if the direct download link might change in the future). And consider changing the class of the surrounding <div>. I've set it to .cmsimplecore_warning as this will give an emphasized message, but it's only defined in CMSimple_XH.