Wednesday, December 31, 2014

Some functions list

If you area PHP developer than the content for you.

This is the list of necessary functions ...

Status






is_admin()
is_home()
is_404()
is_cat()
is_single()
is_doc()
is_search()
is_profile()

is_mobile( )

 

General






get_the_option($field)
the_time($time , $formet)
update_option($field,$value,$createorupdate=true)
login_back_url()
borno_query($sql,$replace_prefix=true,$echo=false)//instead of mysqli_query()
search_form( )
theme_directory( )
is_signup( )
borno_die($msg="" ,$header="Error" )//instead of die()
previous_page_link()
next_page_link()
is_contact_enable()
_echo($string)//instead of echo

 

Shortcode






add_shortcode($shortcodename,$output)
add_freewayshortcode($shortcodename,$output)
add_comment_shortcode($shortcodename ,$output)

 

Widget and Sidebar






popularpost_list($total,$list_allowed,$visit_display_allowed)
add_sidebar('Left');
add_widget($title1,$function,$title2);
check_sidebar_widget($sidebarname)
display_sidebar( $sidebarname);

 

 

Admin






ucr_add_role($role_id , $role_name , $custom_role_array)
add_page($pagename,$title , $function_name,$role,$displaymenu=true,$type='custom')

Developer kids






add_header($data)
add_footer($data)
header_view()
footer_view()

Document






doc_link($id)
get_the_doc_page($doc_id,$data)
is_exists_doc($id)
get_the_doc($doc_id,$data)

Category






is_exists_cat($id)
the_post_cat($post_id)
add_cat($cat_name , $cat_des='')
update_cat($id,$new_name ,$new_des)
get_the_cat($cat_id,$datatype)

Notification






notify_user_count($notification_user)

Comment






add_comment($user_id,$post_id,$content,$approved)

User






user_logged_in()
user_profile_link($user_id,$html=true)
add_user_meta($name,$value,$user_id)
get_gravatar( $email, $size)
is_user_active_code_exists($active_code)
add_user($name ,$username , $email ,$password,$refer,$level,$account_active=1)
the_post_user($data)
the_user_by_username($username , $data)
the_user($user_id , $data)
the_user_by_email($email , $data)
user_exists($user_id)
username_exists($username)
validate_name($str)
validate_username($str)
update_user($user_id,$field,$data)
display_name($user_id)
social_profile($user_id,$type)
user_can($role)
loginuserinfo($datatype)

Content






get_the_post($post_id , $data)
is_exists_content($id)
previous_post_link($current_id)
next_post_link($current_id)
the_post_link($post_id,$html=true)
date_of_post($post_id,$formet)
the_excerpt($content,$num)
content_edit_link($id, $site_address,$current_user)
post_content($post_id)
if(have_post()):while($content = the_nav() ){ .... }

Search






search_result_count($search_keyword)

Basic concept of theme development

Theme Files






You can get theme menu from Admin > Theme

 

Theme Files:


A Theme of Borno minimum need below's five file. That's are :-

  • index.php (Main Page)

  • doc.php (Document Page)

  • single.php (Single Content Page)

  • 404.php (Error Page)

  • style.css (Style File , You can register and access your theme name from here)


Another's Are

  • category.php

  • profile.php

  • search.php

  • functions.php  (You can do all function job of a theme from here)

  • comment.php


You can also add

  • header.php

  • sidebar.php

  • footer.php


 

 

Header.php


You can use the following example code on header.php

 

How to display page title ?

You can display page title by the_title() function

Ex :

<title> <?php echo $title ; ?></title>

 

You must give this meta on header

<meta charset="UTF-8">

 

You can include your theme style.css by this way

Ex:

<link rel='stylesheet' href="<?php echo theme_directory() ;?>/style.css">

 

You must add   <?php header_view() ; ?> between <head> and </head>

 

 

Index.php







You can display the main page content by this way
                
                            
<?php if(have_post()):while($content = the_nav() ): ?>

<h2><?php echo the_post_link($content['id']);?></h2>

<?php echo $content['content']; //displaying the content from the database?>

<?php endwhile;else :?>

Not Found . Error Msg

<?php endif;?>
           
                <ul class="pager">
                    <li class="previous">
                        <?php  previous_page_link() ;?>
                    </li>
                    <li class="next">
                        <?php next_page_link();?>
                    </li>
                </ul>


You can also use this code on



  • category.php

  • profile.php

  • search.php


 

Footer.php







You can use the following example code on footer.php

 

 

 

You can include your theme javascript file by this way

Ex:

<script src="<?php echo theme_directory() ;?>/yourjsfilename.js"></script>

 

You must add   <?php footer_view() ; ?> before </body> tag

 

 

Single.php






 

A example single.php file

 
Note : $post_id is always generated automaticly 
<h2><?php echo the_post_link($post_id); //title ?></h2>

<?php
/*
*    Meta
*/
    echo ' Write by ';
    echo the_user_link(the_post_user('id'));
    echo ' , ';
    echo the_post_cat($post_id);
    echo date_of_post($post_id,'d-m-y');
    echo count_the_post_comment($post_id);
    echo post_visit_count($post_id);                
?>


                    
<?php

    echo post_content($post_id,) ;//post content
    echo '<br>';
    echo content_edit_link($post_id,get_the_option('site_address'),loginuserinfo('id'));
?>
    
    
<?php
    include('comments.php');
?>

 

 

 

Doc.php






 

A example doc.php

 
<a href="<?Php echo doc_link($_GET['doc']); ?>"><?php echo get_the_doc_page($_GET['doc'],'title'); ?></a>




<?php echo get_the_doc_page($_GET['doc'],'content'); ?>

 

 

 

sidebar.php







A sample sidebar.php

 
<?php 
if( check_sidebar_widget('Left') ){
display_sidebar('Left' ,'widget nav','current_page_item'    );                
}

?>

comment.php






A sample comment.php

 
<?php 



/*
*
*    li_comment($post_id);
*     You can get the all comment list of any post .
*    
*
*
*
*/
li_comment($post_id);

/*
*
*
*
$query = comment_query(3);
while($row = mysql_fetch_array($query)){
echo $row['id'].'<br>';
}
*
*
*/

/*
*
*
*
*
# add_comment(1,1,'test comment',1);
# add_comment($user_id,$post_id,$content,$approved)
# You can add comment by this function .
*
*
*
*
*/

/*
*
*
*
*    Check comment permission  of any post
*    check user login or not
*    check if user can add comment
*    display the comment form
*
*

/*
*
* comment_form();
*    comment form
*

if(get_the_post($_GET['p'],'comment_permission')=='true'){

    if(user_logged_in()){
        if(user_can('add_comment')){

            comment_form();
        }
        else{
            echo 'You cant not add comment';
        }
    }
    else{
        echo 'You must be logged in to add comment in this content';
    }    
}
else{
    echo 'You can not add comment in this post';
}
*
*
*
*
*
*
*
*/
if(get_the_post($_GET['p'],'comment_permission')=='true'){

    if(user_logged_in()){
        if(user_can('add_comment')){

            comment_form();
        }
        else{
            echo 'You cant not add comment';
        }
    }
    else{
        echo 'You must be logged in to add comment in this content';
    }    
}
else{
    echo 'You can not add comment in this post';
}

 

Style.css






You can register your theme name , detail and author name from style.css

 

A sample style.css file
/*

Theme Name : Test
Author : John Ex.
Detail : This is an paid theme
*/

/* custom style */
body{
background:red;
}

 

Functions.php


You can add custom functions, rules in you functions.php
<?php
add_sidebar("left")//the function add a left sidebar

 

Basic Rules of a plugin

You can access plugin menu from Admin > plugin option

You must be need manage_plugin capability

 

Plugin Folder :  portable/plugin/

Lets see a example plugin map

portable/plugin/example-folder/         (You must be set all file under a folder)

portable/plugin/example-folder/plug.php  (The cms load plug.php file , You need to create a plug.php file under the folder )

 

You can config plugin name , detail , author name from plug.php file

Sample plug.php

 
<?php
/*
Plugin Name : Test
Author : John Ex.
Detail : This is an example plugin
*/
//your php code here
?>

A sample database

This is the sample database.

Database  include : Some functions reference

S

Username:

Tuesday, December 30, 2014

Upgrade or downgrade your website manually

Download the source code of new version or old version of Borno CMS and replace it to your current source.

or

keep .htaccess, .config.php , portable , photos and move it to in your new source directory

Borno Documention

This is the of

Moving a site localhost to server

If you want to moving your site from localhost to live server than the content for you

  1. Backup your database (in localhost) by Backup plugin

  2. Upload the database in your server from phpmyadmin

  3. upload the cms files to your web server

  4. config your config.php and .htaccess php

  5. Yah Task Done ... Now run  your website fluently :)