View Full Version : Tabs Content script - JS and PHP

07-18-2007, 06:52 AM


I like to add a PHP script to one tab.
Because of the PHP script includes some javascript code I save the javascript part to an other document.
It works fine but there's one problem I can't solve:
In the javascript I get one variable by PHP
eg. for(i=0;i<<?php echo $maxvalue?>;i++)

As long as the javascript code was included in the PHP site it was no problem - but now it do not work anymore for sure.

Any idea how to make it work? Is there a way for?



07-18-2007, 07:41 AM
Are you saying you have a JavaScript "for" loop code within the PHP page that works on its own, but doesn't when the PHP page is fetched via Ajax Tab Content script?? This is to be expected, as when the page is fetched via Ajax, basically its contents is included into the container DIV similar to a string being pasted onto the page. Certain JavaScript code within the string will not be executed.

What you can do is create a blank HTML page with an iframe in it (ie: mypage.htm), something like:

<iframe src="dynamic.php"></iframe>

And inside Ajax Tab Content script, embed that HTML page instead (mypage.htm). The actual php page is included inside this iframe.

07-18-2007, 11:51 AM
Thanks - I found now a other solution so that no PHP is needed in the javascipt anymore.

Is there also a way to change a tab content itself?
I mean at startup I choose <a href="calc.php?employes=5" ...>
At runtime I like to change it to something like calc.php?employes=50 ...

I know that it's easy to change the selected tab - but can I also change the content of the actual tab?

07-19-2007, 06:23 AM
One more question - else I can't use this great script :(
Is there a way for more than one tab line?

I mean
tab1, tab2, tab3
tab4, tab5