|
javascript issue, blank content in frontend 2 Years, 6 Months ago
|
|
Hello, my first post here  ... I have read carefully through all the documentation and about various settings and use of sourcerer plugin. Still I can't get plugin to work.
I have J1.5.14, php 5.2.8, using latest JCE but I tested also with default joomla editor to see if it will work. I have plugin enabled and checked all the settings, have no idea what could be missed.
Here is what I am trying to include in article:
{source} [[style type="text/css"]]@import url(http://domain.com/path/some.css);[[/style]] [[script language="javascript" type="text/javascript" src="http://domain.com/path/some.js"]][[/script]] [[script language="javascript" type="text/javascript" src="http://domain.com/path/common.js"]][[/script]] [[script type="text/javascript"]] var bmi; window.onload=function() { bmi = new SOMECalculator(); bmi.setTargetDIV('newHolder'); bmi.buildCalculator(); bmi.initializeSOMECalculator(); } [[/script]] {/source}
Code works in regular HTML page, problem is including it in joomla article content so that it will work. I would like to avoud loading those .js files with template head, that's why I am placing my hopes on Sourcerer.
If there is any other info needed to better answer my issue just let me know.
Thank you in advance.
|
|
|
|
J1.7.1 / php 5.3.8 / mySQL 5.1.59
|
|
|
javascript issue, blank content in frontend 2 Years, 6 Months ago
|
|
So what is not working?
If you place this code, do you get it correctly in the html output of the site?
If you want to place the scripts in the head of the site, but only for the page you place them on, see here:
www.nonumber.nl/forum/index.php?action=v...orum=7&topic=211
|
|
|
|
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
|
|
|
javascript issue, blank content in frontend 2 Years, 6 Months ago
|
|
I will try to simplify things.
If I copy/paste original code in normal HTML file I can see my form (calculator).
If I copy/paste that exact same code in sourcerer in joomla editor, and convert it like I have stated in my post above, save&publish the article with just that code ... than I see blank page in content of that article in joomla frontend.
Problem is I should (or maybe I just want) to see see what I see if that same code is in regular html file (see image bellow).
|
|
|
|
J1.7.1 / php 5.3.8 / mySQL 5.1.59
|
|
|
javascript issue, blank content in frontend 2 Years, 6 Months ago
|
|
|
Do you have a link to the page where you have the problem?
And maybe also a link to a page where it is working?
|
|
|
|
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
|
|
|
javascript issue, blank content in frontend 2 Years, 6 Months ago
|
|
|
Thank you for your reply, I do have a link ... but that website is still under developement and htaccess protected, so I can't write it here. I have contacted you private but will continue t write here about any developement or possible resolution of my issue.
|
|
|
|
J1.7.1 / php 5.3.8 / mySQL 5.1.59
|
|
|
javascript issue, blank content in frontend 2 Years, 6 Months ago
|
|
|
I took a look and the calculator is working. It is all the way at the bottom of the page. This is because the javascript uses a document.write method, that will add the code to the website dynamically, but to the end.
You'll have to ask the creators of the script how to make it appear within a surrounding website. (You'll probably have to loose the "window.onload=function()" part)
|
|
|
|
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
|
|
|
javascript issue, blank content in frontend 2 Years, 6 Months ago
|
|
Thank you for your time and advice Peter, will try to make it work with this in mind and report back if I make it work.
So far I treid with this type of change:
function highlightXFNLinks() { // Does stuff... }
// // Adds event to window.onload without overwriting currently // assigned onload functions. function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } }
addLoadEvent(highlightXFNLinks);
I made html file work via this change but joomla article still has the same issue.
|
|
|
|
J1.7.1 / php 5.3.8 / mySQL 5.1.59
|
|
|
javascript issue, blank content in frontend 2 Years, 6 Months ago
|
|
You have to try and make it work without using the onload.
In your working HTML file, put this before the script:
<p>Before script</p>
And this after:
<p>After script</p>
You will probably see the same problem: calculator being placed after the "After script".
What happens if you just do this:
... <script type="text/javascript"> var bmi; function BMIcalc() { bmi = new BMICalculator(); bmi.setTargetDIV('newHolder'); bmi.buildCalculator(); bmi.initializeBMICalculator(); } BMIcalc(); </script>
|
|
|
|
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
|
|
|
javascript issue, blank content in frontend 2 Years, 6 Months ago
|
|
|
If I use <p> tags before and after in html and use the jave you suggested in html, then I get a blank page. The issue seems to be to use onload in some other way then in my original code.
|
|
|
|
J1.7.1 / php 5.3.8 / mySQL 5.1.59
|
|
|
javascript issue, blank content in frontend 2 Years, 6 Months ago
|
|
Well I tried this, also works in html, but it still doesn't work in article.
<div><script type="text/javascript"> var bmi; function bmi_onload() { bmi = new BMI(); bmi.setTargetDIV('newHolder'); bmi.buildCalculator(); bmi.initializeBMI(); // Insert your code here to initialize your program // Then, this little bit calls the old onload function if (bmi_old_onload != null) { bmi_old_onload(); } } bmi_old_onload = window.onload; window.onload = bmi_onload; </script></div>
Really am running out of ideas, did a lot of googling too, but I am no java expert:(
|
|
|
|
J1.7.1 / php 5.3.8 / mySQL 5.1.59
|
|
|
javascript issue, blank content in frontend 2 Years, 6 Months ago
|
|
Finally I managed to avoid window.onload function in javascript, it also works in html ... but still doesn't work with sourcerer.
<p><script type="text/javascript"> var bmi; function CALC_startup() { bmi = new BMICalc(); bmi.setTargetDIV('newHolder'); bmi.buildCalc(); bmi.initializeBMICalc(); }
// Set the startup function to run. window.setTimeout('CALC_startup()', 100);
</script></p>
|
|
|
|
J1.7.1 / php 5.3.8 / mySQL 5.1.59
|
|
|
javascript issue, blank content in frontend 2 Years, 6 Months ago
|
|
|
I discovered something interesting, if I copy the code with
{source} tags but with regular <script> tags not with replacement [[ that I should use then I can see my calculator at least but way down at the bootom of the page.
Maybe a plugin bug then?
|
|
|
|
J1.7.1 / php 5.3.8 / mySQL 5.1.59
|
|
|
javascript issue, blank content in frontend 2 Years, 6 Months ago
|
|
Just reporting that finally after really I managed to sort this out. The issue turned out to be not wondow.load ... but I had to add a new event with id in javascript that was being called to import and add a simple div statement with id before javascript. The whole procedure to make it work was more then delacate in this ... at least for me "very special" case.
The whole thing was harder to work as usuall because I use laterst RT templates that have a feature to load javascript in the bottom not in the head, so that search bot scans first actual content and don't pick up java.
Anyway ... it works now  ... I would still like to thank Peter for his help.
|
|
|
|
J1.7.1 / php 5.3.8 / mySQL 5.1.59
|
|
|
javascript issue, blank content in frontend 2 Years, 6 Months ago
|
|
 thanks
Great you have it sorted now.
|
|
|
|
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
|
|
|