DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:tinyurl

Integrating TinyURL with DokuWiki

To automatically create a short URL for every page, just integrate the following snippet in your template (e.g. in lib/tpl/footer.html). This will query the TinyURL API and display a link in the footer of your wiki.

<?php
  $http = new DokuHTTPClient();
  $turl = $http->get('http://tinyurl.com/api-create.php?url='.rawurlencode(wl($ID,'',true)));
  echo '<p>TinyURL: <a href="'.$turl.'">'.$turl.'</a></p>';
?>

FIXME enhance this to add caching.

tips/tinyurl.txt · Last modified: 2009-03-31 18:44 by 70.103.232.219

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki