Help needed please

Discussion in 'PHP' started by hallianonline, Feb 16, 2012.

  1. #1
    Hello i have a php page
    which contains html content (head and body) along with js files in head
    I want to make its external java page so that users can embed my whole page any where into their website or a page
    the code should be looks like this, i have tried my level best but I am fail into this issue please help me


    <script type="text/javascript" src="mypage.php"></script>
     
    hallianonline, Feb 16, 2012 IP
  2. Andre91

    Andre91 Peon

    Messages:
    197
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    0
    #2
    If users want to embed your whole page in their website, why don't they use the <iframe></iframe> tags?

    <html>
    	<head>
    	</head>
    	
    	<body>
    	<iframe src="http://www.YourPage.com"></iframe>
    	</body>
    </html>
    HTML:
     
    Andre91, Feb 16, 2012 IP
  3. mallorcahp

    mallorcahp Peon

    Messages:
    141
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Or you could user file_get_contents :

     
    mallorcahp, Feb 16, 2012 IP
  4. hallianonline

    hallianonline Active Member

    Messages:
    104
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #4
    I need a js script for embedding not iframe or php
     
    hallianonline, Feb 16, 2012 IP
  5. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #5
    The above should work, just make sure the following is true:

    1) The mypage.php file does not contain any <script></script> tags, just the raw Javascript code.
    2) It doesn't hurt to add to the top of your script the following headers:

    
    <?php
    header("Content-type: application/x-javascript");
    ?>
    alert('Testing JS Code');
    
    PHP:
     
    ThePHPMaster, Feb 16, 2012 IP
  6. hallianonline

    hallianonline Active Member

    Messages:
    104
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #6
    it contains <script></script> tags in header and also in body
     
    hallianonline, Feb 17, 2012 IP