• amirs

    (@amirs)


    Hi. I’m using the c2c_get_custom plugin, and I’m trying to use it to display all my custom field key/valueu pairs in a pop-up window…using the following brief javascript pop-up window function:

    ‘<script language=”javascript”>
    function openPage() {
    OpenWindow=window.open(“”, “newwin”, “height=250, width=250,toolbar=no,scrollbars=”+scroll+”,menubar=no”);
    OpenWindow.document.write(“<h1><?php echo c2c_get_custom(‘myKey’); ?></h1>”)
    OpenWindow.document.close()
    self.name=”main”
    }
    </script>

    Unfortunately it doesn’t work…the php echo doesn’t return anything, and I just end up with a pop-up window that is empty: <h1></h1>

    Is there a reason the c2c functions don’t work? Is it because it’s in a <script> or a function?

    Any help will be appreciated.

    Thanks,
    Amir

Viewing 1 replies (of 1 total)
  • Kafkaesqui

    (@kafkaesqui)

    Mixing PHP with Javascript is a tricky business. Instead of trying to pump it through to the popup (which is next to impossible), assign the c2c_get_custom() output to a Javascript variable, and display that:

    <script language="javascript">
    function openPage() {
    var get_custom = "<?php echo c2c_get_custom('myKey'); ?>";
    OpenWindow=window.open("", "newwin", "height=250, width=250,toolbar=no,scrollbars="+scroll+",menubar=no");
    OpenWindow.document.write("<h1>" + get_custom + "</h1>");
    OpenWindow.document.close();
    self.name="main";
    }
    </script>

Viewing 1 replies (of 1 total)
  • The topic ‘c2c in javascript pop-up script?’ is closed to new replies.