-
- 898 Posts
doze,
Thanks for the notes.
Could I use TV’s to set the:
- sIFR.replaceElement(".yourclass1, .yourclass2, .contentheading, .componentheading", named(
- {sFlashSrc: "YourSWFdirectory Here\tradegothic.swf",
- sColor: "#c64934"
Would it be best to set the TV’s default to @inherit then?
Or do you believe there would be a better way of modifying these values (without editing the template or plugin)
Thanks,
Chuck
-
- 4,213 Posts
TVs with inherit sounds good to me.. Don’t know if anyone else has better ideas...?
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
-
- 898 Posts
Alright,
I am having a little trouble with this (I am more of a php hacker than coder). I looked at some other plugins and the documentation. I have setup the following code but get no output. I’m probably missing something easy. Could someone help me where I am going wrong?
$e = & $modx->Event;
switch ($e->name) {
case "regClientScript":
$html = '<script type='text/javascript'>
if(typeof sIFR == "function"){
sIFR.replaceElement("h1, h3", named({sFlashSrc: "assets/sifr/tradegothic.swf", sColor: "#c64934", sWmode: "transparent"}));
</script>';
break;
default:
return;
break;
$modx->documentOutput($html);
$e->output($html);
}
I have checked "OnDocFormPrerender" in System Events. I just want to get this first part to output before I move on. Thanks for any help.
Chuck
-
- 4,213 Posts
The case clause should have the event name on it when you want that specific code to run. I think it should be something like (not tested):
OnWebPagePrerender system event...
$e = &$modx->Event;
switch ($e->name) {
case "OnWebPagePrerender":
$script = '
<script type="text/javascript">
if(typeof sIFR == "function"){
sIFR.replaceElement("h1, h3", named({sFlashSrc: "assets/sifr/tradegothic.swf", sColor: "#c64934", sWmode: "transparent"}));
}
</script>';
$modx->regClientStartupScript($script);
break;
default :
return;
break;
}
Your $html variable has unescaped ’ chars too (needs to change to " or escape \’) and it seems that the javascript function did not have ending bracket.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
-
- 898 Posts
Thanks doze,
I am off to get this thing working now.
Chuck
-
- 256 Posts
Quote from: ProWebscape at Jul 12, 2006, 09:21 PM
I guess this could be a good time for me to learn plugins.
We would just need to:
1. load these files at each page: sifr.js, sIFR-screen.css
2. Add the following text into the bottom of the page (right before </body></html>
<script type="text/javascript">
if(typeof sIFR == "function"){
sIFR.replaceElement(".yourclass1, .yourclass2, .contentheading, .componentheading", named({sFlashSrc: "YourSWFdirectory Here\tradegothic.swf", sColor: "#c64934", sWmode: "transparent"}));
}
</script>
I have included the example siFR-screen.css from the Joomla mambot as an example.
Chuck
I did this, as well as prep the SWF file, but when I tested it on my site, is completey blanked out the text.
Here is what I used:
This I inserted above the </header> tag:
<script src="assets/js/sifr.js" type="text/javascript"></script>
And this I inserted at the bottom of my template above the </body> tag:
<script type="text/javascript">
if(typeof sIFR == "function"){
sIFR.replaceElement(".h1", named({sFlashSrc: "http://throughmylensphotography.com/assets/flash/rageitalic.swf", sColor: "#FFF"}));
}
</script>
PM me to find out how you can get a FREE ipad 2!
-
- 898 Posts
Ok. I must be an idiot. I just can’t get this plugin to work. I have created the example plugins, and they worked. But I couldn’t get anything to work with "OnWebPagePrerender". Below is the code I came up with. I have tried these seperately and all as one. Nothing seems to be working for me (I guess I’m a slow learner). Any help would be greatly appreciated.
$e = &$modx->Event;
switch ($e->name) {
case "OnWebPagePrerender":
$script = '<script type="text/javascript">
if(typeof sIFR == "function"){
sIFR.replaceElement("h1", named({sFlashSrc: "YourSWFdirectory Here\tradegothic.swf", sColor: "#c64934", sWmode: "transparent"}));
}
</script>';
$modx->regClientScript($script);
break;
case "OnWebPagePrerender":
$src = "assets/js/sifr.js";
$modx->regClientStartupScript($src);
break;
case "OnWebPagePrerender":
//Use MODx to import the CSS
$link = '<link rel="stylesheet" type="text/css" href="sifr.css" />';
$modx->regClientCSS($link);
break;
default :
return;
break;
}
Well that is it. Some of it is taken directly from the MODx documentation and modified more this use (ex. sifr.css call). Thanks again for any help.
Chuck
-
- 4,213 Posts
Hi Chuck,
Try to run it in OnWebPageInit event, and no need to do own cases for the script includes.. try this:
$e = &$modx->event;
switch ($e->name) {
case "OnWebPageInit":
$script = '<script type="text/javascript">
if(typeof sIFR == "function"){
sIFR.replaceElement("h1", named({sFlashSrc: "YourSWFdirectory Here\tradegothic.swf", sColor: "#c64934", sWmode: "transparent"}));
}
</script>';
$src = "[(site_url)]assets/js/sifr.js";
//Use MODx to import the CSS
$link = '<link rel="stylesheet" type="text/css" href="sifr.css" />';
$modx->regClientCSS($link);
$modx->regClientScript($script);
$modx->regClientStartupScript($src);
break;
default :
return;
}
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
-
- 898 Posts
Doze,
Thanks for that. I was racking my brain the last few days over that. Now I can try to create some settings for it.
Chuck