• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

BrightStarCMS - [CakePHP, Bootstrap 3]

Status
Not open for further replies.
Newbie Spellweaver
Joined
May 7, 2016
Messages
10
Reaction score
2
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



  • Login and register
  • User settings
  • CMS news
  • Comments (news)
  • Comments edit
  • Emojione support ( )
  • Shop




More info later.


Also i have a snippet for you!


PHP:
        $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:



This is it for now! Later :laugh:
 
Newbie Spellweaver
Joined
Mar 14, 2012
Messages
8
Reaction score
2
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 ( )
- use naming conventions when possible, a lot of the CakePHP "magic" is based on it ( )
- 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)

Below a cleaner example that should do the same job
IAohl6P - BrightStarCMS - [CakePHP, Bootstrap 3] - RaGEZONE Forums

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

Attachments

You must be registered for see attachments list
Status
Not open for further replies.
Back
Top