2017 © Pedro Peláez
 

library common

Common Library for Cool projects

image

cool/common

Common Library for Cool projects

  • Thursday, May 17, 2018
  • by couth
  • Repository
  • 1 Watchers
  • 0 Stars
  • 22 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 47 % Grown

The README.md

cool-common

Common Library for Cool projects., (*1)

  • about Form\FormHelper, (*2)

    ``` // This class is compatible with these templates // 'text' => '', // 'select' => [''],, (*3)

/* * * return example Array ( [0] => Array ( [0] => text [1] => Array ( [0] => sitename [1] => hero ) ) [1] => Array ( [0] => select [1] => Array ( [0] => Array ( [0] => language ) [1] => Array ( [0] => Array ( [0] => selected="selected" [1] => zh_CN [2] => 简体中文 ) [1] => Array ( [0] => [1] => en_US [2] => 英语 ) ) [2] => Array ( ) ) ) ), (*4)

*/, (*5)



- about Form\FormCore

$cfg = [ 'formOpen' => ', (*6)

', 'text' => '', 'select' => [''], 'formEnd' => '

', ];, (*7)

$form = new FormCore($cfg); $form->addMultiData(['formOpen', ['', 'post']]); $form->addData(['text', ['fname', 'carl']]); $form->addData(['formEnd', []]); echo $form->render();, (*8)


- about Category\CategoryHelper

//====================Test code ================================, (*9)

header("content-type:text/html;charset=utf-8"); $categories = array( array('id'=>1,'name'=>'电脑','pid'=>0), array('id'=>2,'name'=>'手机','pid'=>0), array('id'=>3,'name'=>'笔记本','pid'=>1), array('id'=>4,'name'=>'台式机','pid'=>1), array('id'=>5,'name'=>'智能机','pid'=>2), array('id'=>6,'name'=>'功能机','pid'=>2), array('id'=>7,'name'=>'超级本','pid'=>3), array('id'=>8,'name'=>'游戏本','pid'=>3), );, (*10)

//$cate = new CategoryHelper(); $cate = CategoryHelper::render($categories); $cate = CategoryHelper::format($categories);, (*11)


- about Http\CurlHelper

//============ Test ================= //$curl = new curlHelper(); //$url = 'http://a.com/dfdsf/?dxid=dsl'; //$curl->curlGet($url,['name'=>'carl']);, (*12)


- about Pagination\Pagination

//============ Generate normal pagination ================= $p = new Pagination(); $page = isset($_GET['page']) ? intval($_GET['page']) : 8; $page = $page > 0 ? $page : 8; $p->init($page, 123); $p->setTotalNum(1230);, (*13)

// echo css echo ' ';, (*14)

echo $p->view();, (*15)


// Generate js pagination. (You can add js event to loop), (*16)

$p = new Pagination(); $page = isset($_GET['page']) ? intval($_GET['page']) : 7; $page = $page > 0 ? $page : 7; $p->init($page, 123);, (*17)

$template = [ 'pageWrapper' => ', (*18)

    %s

', 'firstPage' => [ ', (*19)

  • %s
  • ', '
  • %s
  • ', ], 'preGroupPage' => [ '
  • %s
  • ', '
  • %s
  • ', ], 'prePage' => [ '
  • %s
  • ', '
  • %s
  • ', ], 'pageItem' => '
  • %s
  • ', 'currentPage' => '
  • %s
  • ', 'nextPage' => [ '
  • %s
  • ', '
  • %s
  • ', ], 'nextGroupPage' => [ '
  • %s
  • ', '
  • %s
  • ', ], 'lastPage' => [ '
  • %s
  • ', '
  • %s
  • ', ], 'loopPage' => '
  • ', 'totalPage' => '
  • %s
  • ', 'totalNum' => '
  • %s
  • ', ];

    $p->setTemplate($template); $p->setTotalNum(12050); echo $p->view();, (*20)


    - about Helpers\CoolArray ```php $data = [ "dataShow" => [ "conf"=>[ "key"=>"type", "code"=>[ "order-data"=>"TA", "change-data"=>"DATA.CUSTOMER_CHANGE_DATA", "turn-data"=>"CUSTOMER.CRM_TURN_REGION", "leads-data"=>"TASK.CRM_LEADS_QUERY", "tag-data"=>"CONFIG.OS_CATEGORY", "user-data"=>"CONFIG.OS_CATEGORY", "see-phone"=>1, ] ], "requireParam"=>"type", "paramCont"=>["order-data", "tag-data", "user-data", 'see-phone'] ], ]; $structure = [ "dataShow" => [ "conf"=>[ "key"=>"type", "code"=>[ "order-data"=>"fdgfd", "change-data"=>"DATA.CUSTOMER_CHANGE_DATA", "turn-data"=>"CUSTOMER.CRM_TURN_REGION", "leads-data"=>"TASK.CRM_LEADS_QUERY", "tag-data"=>"CONFIG.OS_CATEGORY", "user-data"=>"CONFIG.OS_CATEGORY", "see-phone"=>"CONFIG.OS_CATEGORY", ] ], "requireParam"=>"type", "paramCont"=>["order-data", "change-data", "tag-data", "user-data", 'see-phone'] ], ]; $ret = CoolArray::checkStructure($data, $structure); var_dump($ret);

    The Versions

    17/05 2018

    dev-master

    9999999-dev

    Common Library for Cool projects

      Sources   Download

    The Requires

    • php >=7.0

     

    by Carl Liu

    17/05 2018

    v2.0.0

    2.0.0.0

    Common Library for Cool projects

      Sources   Download

    The Requires

    • php >=7.0

     

    by Carl Liu

    17/02 2017

    v1.0.0

    1.0.0.0

    Common Library for Cool projects

      Sources   Download

    MIT

    The Requires

    • php >=5.6.4

     

    by Carl Liu