Well, I'm still a noob when it comes to PHP (or anything), so I'll just give an example. If you go here: http://www.gmodules.com/ig/ifr?synd=googlemodules&w=500&h=350&mid=0&url=http://hosting.gmodules.com/ig/gadgets/file/102166312438248764726/calendar-personalized.xml you'll see the XML gadget displaying nicely in the browser window. Of course, if you load only the gadget in the browser (http://hosting.gmodules.com/ig/gadgets/file/102166312438248764726/calendar-personalized.xml) the page will display only as text.
What I want is the PHP code that does this trick. In this example is http://www.gmodules.com/ig/ifr and I suspect that it might be PHP, but I don't mind a javascript code that can 'read' and display xml gadget.
Thanks!

It is just an XML CDATA block. Load this file into SimpleXML/DOMDocument, and you can do with it what you want.

Search this forum, examples are here.

Well, at least you didn't say something stupid like "Google is your friend".
Anyway, here's a possible hybrid sollution i found (php and jquery):

<?PHP
$xml = $_GET['xml'];
echo "<script src='http://code.jquery.com/jquery.min.js' type='text/javascript'></script>
        <script type='text/javascript'>
        $(document).ready(function(){
    function loadfail(){
        alert('Error: Failed to read the file!');
    }
    function parse(document){
        $(document).find('Module').each(function(){
           $('.combo1').append( 
            '' + $(this).find('Content').text() +
            ''
           );
        });
    }
    $.ajax({
        url: '$xml',
        dataType: 'xml',
        success: parse,
        error: loadfail
    });
});
</script><span class='combo1'></span>This text doesn't appear either.";
?>This text doesn't appear on page.

The problem is that anything else other then the module's content is hidden or doesn't load.
Any ideas, please?

Where's the rest of the HTML file? No html, head, body tag... Trying to append to a class named 'combo1' in an invalid HTML file will probably fail.

<span class='combo1'></span>

It works, just like I said before. The page loads only the combo1 span, bot nothing else. Everything I write before or after the combo1 doesn't show when the page load.
Anyway, I think now is a javascript problem.; probably someone should move the topic to another forum.

I still think it is because you have an invalid HTML file.

M8, I might be wrong, but it doesn't need to start with <html> and end with </html> to act like a HTML. Anyway, what is your solution? Do you have any suggestions?! And BTW, it is a PHP file, not a HTML; or, it's a PHP file that renders a HTML code.
Thx!

That is true for plain HTML, but most browsers won't run Js correctly if it is invalid (because the DOM parser will fail).

what is your solution?

what is your solution?

<!DOCTYPE html>
<html>
<head>
  <script src='http://code.jquery.com/jquery.min.js' type='text/javascript'></script>
  <script type='text/javascript'>
    $(document).ready(function(){
      $.ajax({
        url: '<?php echo $xml; ?>',
        dataType: 'xml',
        success: function(document){
          $(document).find('Module').each(function(){
            $('.combo1').append($(this).find('Content').text());
          });
        },
        error: function(){
          alert('Error: Failed to read the file!');
        }
      });
    });
</script>
</head>
<body>
<span class='combo1'></span>
</body>
</html>

If you still have problems, please show any javascript errors you get, and the xml url you are trying to load.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.