title: Including php file as JS
body: <p>I am trying to change the image_list_url of tiny_mce to php file. </p>
  
  <p>I changed the url to image_list.php file. It generated the exact output text same as the js file. </p>
  
  <p>But even after giving same output it doesn't show's the image list.</p>
  
  <p>I am wondering if the content-type is affecting it or not?</p>
  
  <p>my JS file content:</p>
  
  <pre><code>// This list may be created by a server logic page PHP/ASP/ASPX/JSP in some backend system.
  // There images will be displayed as a dropdown in all image dialogs if the "external_link_image_url"
  // option is defined in TinyMCE init.
  
  var tinyMCEImageList = new Array(
      // Name, URL
      ["Logo 1", "media/logo.jpg"],
      ["Logo 2 Over", "media/logo_over.jpg"]
  );
  </code></pre>
  
  <p>my PHP COde:</p>
  
  <pre><code>&lt;?php
      require('../../../system/config.php');
      $strPath = APP_ROOT.DS.'sys_uploads/images/';
      $objFileList = dir( $strPath );
      $arrFileList = array();
      while (false !== ($entry = $objFileList-&gt;read())) {
          if( is_file( $strPath.$entry) )
              $arrFileList[] = array($entry, ABS_URL.'/sys_uploads/images/'.$entry);
      }
      $objFileList-&gt;close();
  
      header('Content-type: application/x-javascript');
      //header('Content-type: text');
  ?&gt;
  // This list may be created by a server logic page PHP/ASP/ASPX/JSP in some backend system.
  // There images will be displayed as a dropdown in all image dialogs if the "external_link_image_url"
  // option is defined in TinyMCE init.
  
  var tinyMCEImageList = new Array(
      // Name, URL
   &lt;?php
      if( count( $arrFileList )&gt;0 )
          foreach( $arrFileList as $dataRow ):
   ?&gt;
      ["&lt;?php echo $dataRow[0];?&gt;", "&lt;?php echo $dataRow[1];?&gt;"],
   &lt;?php endforeach; ?&gt;
  );
  </code></pre>
  
  <p>my PHP Output:</p>
  
  <pre><code>// This list may be created by a server logic page PHP/ASP/ASPX/JSP in some backend system.
  // There images will be displayed as a dropdown in all image dialogs if the "external_link_image_url"
  // option is defined in TinyMCE init.
  
  alert('test working or not');
  
  var tinyMCEImageList = new Array(
      // Name, URL
      ["Logo 1", "media/logo.jpg"],
      ["Logo 2 Over", "media/logo_over.jpg"]
  );
  </code></pre>
  
  <p>Edit:</p>
  
  <p>As per suggestion i even added a popup message too which even didn't show up.</p>
  
  <p>Solution:</p>
  
  <p>dun know what was error on my code but found good solution from link suggested:</p>
  
  <p><a href="http://tinymce.moxiecode.com/wiki.php/Configuration%3aexternal_image_list_url" rel="nofollow">http://tinymce.moxiecode.com/wiki.php/Configuration%3aexternal_image_list_url</a></p>