Results 1 to 4 of 4

Thread: Tabs Content script - JS and PHP

  1. #1
    Join Date
    Jul 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Tabs Content script - JS and PHP

    http://www.dynamicdrive.com/dynamici...axtabscontent/

    Hi,

    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?

    Thanks,

    Andre

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:

    Code:
    <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.

  3. #3
    Join Date
    Jul 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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?
    Last edited by it-bergmann; 07-18-2007 at 03:18 PM.

  4. #4
    Join Date
    Jul 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

    Thanks,

    Andre

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •