Welcome Guest, Not a member yet? Register   Sign In
Tendoo CMS: New upcoming "Post Type"
#1

(This post was last modified: 08-03-2015, 09:55 AM by Blair2004.)

Hi, after many working hard hours, Post Type migration has been partially done (around 80%), and i'm testing the way it's working on Tendoo CMS 1.5 branch.
It seems working pretty well, and since this branch is two time faster than 1.4, this Post Type work faster too.

What is Post Type and why this feature ?

As WordPress developper, Post Type is a essential feature, since it help developper to  easilly interact with database without any SQL request, with so handy API. Using this feature help creating frequently used UI for creating content like "post", "pages", "porfolio", "staff", "books", "product", etc.

It has been introduced to Tendoo CMS to provide such ease while creating module, but users are free to keep using database ressource to interact with the their database.

Some example of live usage

This code is runned within "load_post_types" hook, special "Post Type" module hook, this hook can also work inside "after_app_init".

PHP Code:
<?php

class blog extends CI_model
{
    function 
__construct()
    {
        
parent::__construct();
        
$this->events->add_action'after_app_init' , array( $this 'loader' ) );
    }
    
 
    
function loader()
    {
        if( 
Modules::is_active'post_type' ) )
        {
            
$this->events->add_action'load_post_types' , array( $this 'blog_post_type' ) );
        }
        else 
// do you remember how to require a module to be active ?
        
{
            
$this->events->add_filter'ui_notices' , function( $notices ){
                
$notices[]    =    array(
                    
'msg'    =>    __'Post Type module is not enabled...' ),
                    
'icon'    => 'times',
                    
'type'    =>    'warning'
                
);
                return 
$notices;
            });
        }
    }
    function 
blog_post_type()
    {
        
// Blog
        
$this->load->library'posttype' , array(
            
'namespace'                =>    'blog',
            
'label'                    =>    __'Blog Post' ),
            
'menu-icon'                =>    'fa fa-newspaper-o',
            
'is-hierarchical'               =>    false
        
) , 'blog' );
        
        
$this->blog->define_taxonomy(    'category' __'Category' ) , array() );
        
        
$this->blog->define_taxonomy(    'tag' __'Tags' ) , array() );
    
        
        
$this->blog->run();
        
        
// Page
        
$this->load->library'posttype' , array(
            
'namespace'        =>    'page',
            
'label'            =>    __'Pages' ),
            
'menu-icon'        =>    'fa fa-file',
            
'is-hierarchical'    =>    true
        
) , 'page' );
        
        
$this->page->run();
    }


This actually create two menu for both post type like this : 

[Image: creating-blog-post-tendoo.png]

Every post is listed also

[Image: page-list.png]

Now it's maybe time for creating a "front-end" module which can use Post Type Api...

Note : Tendoo Has been updated, you must refresh it. AutoUpdate is not yet ready, but still in the way.

Thanks for readding this  Cool
NexoPOS 2.6.2 available on CodeCanyon.
Reply
#2

(This post was last modified: 08-04-2015, 07:38 AM by zeos.)

hi "Blair2004" your cms is good and your work is admirable!
but codeigniter is very old for use it now (I hope it will better in next), if you want to develop a new cmf or cms with modern php standards (like psr standards) plz email me to work in that together and use it for our works Smile
i wrote a cms like your cms in past year but after a year i understand it is not up to date, my old cms have all of these feature like
install theme,
post types,
taxonomies (custom tags and categories),
stock images,
media manager
hooks
and etc...
but now i am work in newer cmf for use it in my works, i hope development with that will be very faster and newer, I will so happy if you help me...
i am waiting for your email my friend
---
sry if my english is very poor Sad
Reply
#3

(This post was last modified: 08-03-2015, 01:32 PM by Blair2004.)

After advanced review, using "load_post_types" within "after_app_init" hook no work properly.
i'm working on hook priority to fix it. Unless that, "load_post_types" hook must be called out any other hook, like this :

PHP Code:
<?php

class blog extends CI_model
{
 
   function __construct()
 
   {
 
       parent::__construct();
 
       $this->events->add_action'after_app_init' , array( $this 'loader' ) );
        
$this->events->add_action'load_post_types' , array( $this 'blog_post_type' ) ); // loaded out any hooks
 
   }
 
    
    function loader
()
 
   {
 
       if( ! Modules::is_active'post_type' ) ) // if module is not active add a notice...
 
       {
 
           $this->events->add_filter'ui_notices' , function( $notices ){
 
               $notices[]       array(
 
                   'msg'    =>    __'Post Type module is not enabled...' ),
 
                   'icon'    => 'times',
 
                   'type'    =>    'warning'
 
               );
 
               return $notices;
 
           });
 
       }
 
   }
 
   function blog_post_type()
 
   {
 
       // Blog
 
       $this->load->library'PostType' , array(
 
           'namespace'                =>    'blog',
 
           'label'                    =>    __'Blog Post' ),
 
           'menu-icon'                =>    'fa fa-newspaper-o',
 
           'is-hierarchical'               =>    false
        
) , 'blog' );
 
       
        $this
->blog->define_taxonomy   'category' __'Category' ) , array() );
 
       
        $this
->blog->define_taxonomy   'tag' __'Tags' ) , array() );    
        
        $this
->blog->run();
 
       
        
// Page
 
       $this->load->library'PostType' , array(
 
           'namespace'        =>    'page',
 
           'label'            =>    __'Pages' ),
 
           'menu-icon'        =>    'fa fa-file',
 
           'is-hierarchical'    =>    true
        
) , 'page' );
 
       
        $this
->page->run();
 
   }

NexoPOS 2.6.2 available on CodeCanyon.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB