phploc yiiframework 1.1.9

1. Januar 2012
C:\Users\mbi\Downloads\yii-1.1.9.r3527>phploc framework
phploc 1.6.1 by Sebastian Bergmann.
 
Directories:                                        163
Files:                                             1471
 
Lines of Code (LOC):                             596876
  Cyclomatic Complexity / Lines of Code:           0.02
Comment Lines of Code (CLOC):                     50628
Non-Comment Lines of Code (NCLOC):               546248
 
Namespaces:                                           0
Interfaces:                                          28
Classes:                                            629
  Abstract:                                          54 (8.59%)
  Concrete:                                         575 (91.41%)
  Average Class Length (NCLOC):                     122
Methods:                                           4407
  Scope:
    Non-Static:                                    4074 (92.44%)
    Static:                                         333 (7.56%)
  Visibility:
    Public:                                        3397 (77.08%)
    Non-Public:                                    1010 (22.92%)
  Average Method Length (NCLOC):                     17
  Cyclomatic Complexity / Number of Methods:       3.41
 
Anonymous Functions:                                  0
Functions:                                            0
 
Constants:                                          200
  Global constants:                                  46
  Class constants:                                  154
Author: Categories: Yii Tags:

Documentation Driven Development

14. Dezember 2011

Tools, die für DDD oder generell für Doku-Erstellung geeignet wären:

Author: Categories: Allgemein Tags:

Mögliche Ordnerstruktur für größere Sites

11. Dezember 2011

ist hier erklärt

bin ich drauf gestoßen, als ich mich fragte, ob es ein Backend-Modul geben sollte oder eine Backend-Application und finde den Ansatz ziemlich ok

Grundidee:

_mysite
    backend
        www (http://backend.mysite.vs)
            index.php
    common
        libraries
            yii
    console
    frontend
        www (http://www.mysite.vs)
            index.php
Author: Categories: Yii Tags:

xampp vhost

11. Dezember 2011
NameVirtualHost *:80
 
<VirtualHost 127.0.0.1>
    ServerName www.myhotwebsite.vs
    DocumentRoot "C:/xampp/htdocs/path/to/www"
    <Directory "C:/xampp/htdocs/path/to/www">
      Options Indexes FollowSymLinks
      Options +Includes
      AllowOverride FileInfo
      AllowOverride All
      Order allow,deny
      Allow from all
      DirectoryIndex index.html index.php
    </Directory>
</VirtualHost>
Author: Categories: Allgemein Tags:

Barchart mit css

4. Dezember 2011

hier gefunden

<?php Yii::app()->clientScript->registerCss('barchart', 
'dl.horizontal {font-size:12px; font-family:Arial; width:500px;}
 dl.horizontal dt {float:left; width:150px; clear:both; margin:0 0 5px 0; padding:3px;}
 dl.horizontal dd {float:left; width:300px; border:1px solid #aaaaaa; margin:0 0 5px 0; padding:2px; -moz-box-shadow: 1px  1px 3px #aaaaaa;}
 dl.horizontal dd span {background:#1770d3; display:block; color:#ffffff; text-indent:4px;}'); ?>
<h2>Wer wird Deutscher Meister 2011/2012?</h2>
 
<dl class="horizontal">
<dt>FC Bayern München</dt>
<dd><span style="width:85%;">85%</span></dd>
<dt>Borussia Dortmund</dt>
<dd><span style="width:25%;">25%</span></dd>
<dt>Hannover 96</dt>
<dd><span style="width:43%;">43%</span></dd>
</dl>

Wer wird Deutscher Meister 2011/2012?

FC Bayern München
85%
Borussia Dortmund
25%
Hannover 96
43%
Author: Categories: Allgemein, Yii Tags:

Schnell mal ein Blog programmieren

4. Dezember 2011
>yiic webapp ../blog
>cd ..
>cd blog
>cd protected
>yiic migrate create install
class m110406_192138_install extends CDbMigration
{
  public function safeUp()
  {
    $this->createTable('{{user}}', array(
      'id' => 'pk',
      'name' => 'string',
      'email' => 'string',
      'password' => 'string'
    ));
 
    $this->createTable('{{post}}', array(
      'id' => 'pk',
      'userId' => 'integer',
      'title' => 'string',
      'slug' => 'string',
      'content' => 'text',
      'created' => 'integer',
      'isActive' => 'boolean'
    ));
 
    $this->createTable('{{comment}}', array(
      'id' => 'pk',
      'postId' => 'integer',
      'created' => 'integer',
      'username' => 'string',
      'email' => 'string',
      'website' => 'string',
      'text' => 'text',
      'approved' => 'boolean'
    ));
  }
 
  public function safeDown()
  {
    $this->dropTable('{{user}}');
    $this->dropTable('{{post}}');
    $this->dropTable('{{comment}}');
  }
}
  //config/main.php, config/console.php
  'db' => array(
    'connectionString' => 'mysql:host=localhost;dbname=dbname',
    'username' => '',
    'password' => '',
    'charset' => 'utf8',
    'tablePrefix' => 'tbl_'
  )
>yiic migrate
>yiic shell ../index.php
>module admin
>model User
>model Post
>model Comment
>crud Post
>crud Comment
>crud Post admin/Post
>crud Comment admin/Comment
Author: Categories: Yii Tags:

Module aus der Datenbank laden

3. Dezember 2011
//index.php
 
$yii    = dirname(__FILE__) . '/protected/framework/yii.php';
$config = dirname(__FILE__) . '/protected/config/main.php';
 
require_once $yii;
$app = Yii::createWebApplication($config);
 
$app->setModules(
    $app->db->createCommand()->select('name')->from('{{module}}')->where('isActive = 1')->queryColumn()
);
$app->run();
Author: Categories: Yii Tags: