All posts tagged php

Custom Scaffolding Theme (Symfony)

Copy the default theme from

[sfPropelPlugin]data/generator/sfPropelCrud/default/theme

to

data/generator/sfPropelCrud/default/theme

Edit the files in data/generator/sfPropelCrud/default/theme/templates as you would with an admin template.

Generate like usual: ./symfony propel:generate-crud [app] [module] [base]

Derived from: http://www.playingwithwire.com/2007/02/review-of-the-definitive-guide-to-symfony/

PHP UUID generator function

Via: http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/

/**
  * Generates an UUID
  *
  * @author     Anis uddin Ahmad
  * @param      string  an optional prefix
  * @return     string  the formatted uuid
  */
  function uuid($prefix = ”)
  {
    $chars = md5(uniqid(rand()));
    $uuid  = substr($chars,0,8) . '-';
    $uuid .= substr($chars,8,4) . '-';
    $uuid .= substr($chars,12,4) . '-';
    $uuid .= substr($chars,16,4) . '-';
    $uuid .= substr($chars,20,12);

    return $prefix . $uuid;
  }