Advertisement
botdotdot

Untitled

Aug 15th, 2012
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. // Builds a URL based on whether it's running on IIS (dev, which is funny with URL rewrites) or Apache (production, which has different DB
  2. // settings, etc)
  3.  
  4. function b_url($topic = null, $ctype = null, $cid = null) {
  5.     if (DEV) {
  6.         $base = '?';
  7.         if ($topic) {
  8.             return $base . "topic=$topic";
  9.         }
  10.         if ($topic && $ctype) {
  11.             return $base . "topic=$topic&ctype=$ctype";
  12.         }
  13.         if ($topic && $ctype && $cid) {
  14.             return $base . "topic=$topic&ctype=$ctype&cid=$cid";
  15.         }
  16.         return $base;
  17.     } else {
  18.         $base = '/';
  19.         if ($topic) {
  20.             return $base . "$topic";
  21.         }
  22.         if ($topic && $ctype) {
  23.             return $base . "$topic/$ctype";
  24.         }
  25.         if ($topic && $ctype && $cid) {
  26.             return $base . "$topic/$ctype/$cid";
  27.         }
  28.         return $base;
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement