BrightStarCMS - [CakePHP, Bootstrap 3]

Results 1 to 2 of 2
  1. #1
    Apprentice TimeFlies is offline
    MemberRank
    May 2016 Join Date
    10Posts

    happy BrightStarCMS - [CakePHP, Bootstrap 3]

    Hello everyone.




    Today i present a brand new habbo retro CMS named BrightStarCMS, currently it is in the
    development. And will be made in CakePHP (framework).


    - The features








    More info later.


    Also i have a snippet for you!


    PHP Code:
            $commentRegistry TableRegistry::get('News_comments')->find('all')->contain(['Creators']);        $this->set('comments'$commentRegistry->find('all')->limit(4)->where(['News_comments.news_id' => $news->id])->order(['News_comments.id' => 'DESC']));        $commentRegistry->isEmpty();        $results $commentRegistry->all();        $results->isEmpty();        //post een bericht        $commentAdd = $this->NewsComments->newEntity();        if($this->request->is(['post', 'put', 'patch']))        {            $patchComment = $this->NewsComments->patchEntity($commentAdd, [                'author_id' => $this->Auth->user('id'),                'user_id' => $this->Auth->user('id'),                'date' => Time::now(),                'news_id' => $news->id,                'author' => ['empty'],                'comment' => $this->request->data(['comment'])            ]);            if ($this->NewsComments->save($patchComment)) {                $this->redirect(['controller' => 'News', 'action' => 'view', $id]);                $this->Flash->success('Je bericht is geplaatst.', ['class' => 'alert alert-info']);            } else            {                $this->Flash->error('Fout...', ['class' => 'alert alert-info']);            }        } 

    - Screenshots:

    1. https://gyazo.com/24582bbdadada2baccfe500fc792f4b8
    2. https://gyazo.com/34fa57518082f8f8e8ae8dfebe96b992
    3. https://gyazo.com/0fb417a67e69dd8b397b1b0ff0f7270b
    4. https://gyazo.com/1fc029e252046e1d12f0f509f3b87f91



    This is it for now! Later


  2. #2
    Apprentice Process is offline
    MemberRank
    Mar 2012 Join Date
    8Posts

    Re: BrightStarCMS - [CakePHP, Bootstrap 3]

    First your snippet is awful... Let's try screenshot next time :D

    Here are some tips about CakePHP:
    - use associations, they enable you to get associated data in a simply way (Associations - Linking Tables Together — CakePHP Cookbook 3.x documentation)
    - use naming conventions when possible, a lot of the CakePHP "magic" is based on it (CakePHP Conventions — CakePHP Cookbook 3.x documentation)
    - use the doc ! CakePHP has one of the best docs I've ever seen, simply type something you want to achieves and you will find what you need (and it's translated in few languages) Welcome — CakePHP Cookbook 3.x documentation

    Below a cleaner example that should do the same job

    Oops... The $id should be $this->request->data('news_id')



Advertisement