title: encode url using silverstripe - urlencode
body: <h2>  Magazine.ss</h2>
  
  <pre><code>  &lt;% with $Magazine %&gt;
      &lt;h1&gt;$Title&lt;/h1&gt;
      &lt;iframe src="http://docs.google.com/viewer?url={$Document.AbsoluteURL}&amp;embedded=true" width="100%" height="842"&gt;&lt;/iframe&gt;
    &lt;% end_with %&gt;
  </code></pre>
  
  <p>if you check the above code, it print url as  '<a href="http://masapulari.com/assets/Uploads/dummy.pdf" rel="nofollow">http://masapulari.com/assets/Uploads/dummy.pdf</a> .
  Magazine is a DataObject class and Document is File Type, as you see below.
  Is there a way to print urlencode of $Document.AbsoluteURL?</p>
  
  <p>class Magazine extends DataObject {</p>
  
  <pre><code>private static $db = array(
    'Title'=&gt;'VarChar',
    'Date' =&gt; 'Date',
  );
  
  private static $has_one = array(
    'Photo' =&gt; 'Image',
    'Document' =&gt; 'File'
  );
  </code></pre>
  
  <p>}</p>
  
  <p>class Magazine_Controller extends Page_Controller {</p>
  
  <pre><code>private static $allowed_actions = array (
      'index','view'
        );
  
  public function init() {
      parent::init();
  
      // Note: you should use SS template require tags inside your templates 
      // instead of putting Requirements calls here.  However these are 
      // included so that our older themes still work
      Requirements::themedCSS('reset');
      Requirements::themedCSS('layout'); 
      Requirements::themedCSS('typography'); 
      Requirements::themedCSS('form'); 
  }   
  
  public function view(){
    $params = $this-&gt;getURLParams();
    $id = (int)$params['ID'];
  
    $data = $this-&gt;Magazine($id);   
  
      return $this-&gt;customise(array(
          'Magazine'=&gt;$data
      ))-&gt;renderWith(array( 'Magazine', 'Page'));       
  }
  
  public function Magazine($id){
    $data = DataObject::get_by_id('Magazine',$id);            
      return $data;      
  }
  </code></pre>
  
  <p>}</p>