I have installed the very latest version of Yii 2.0.4, and while using the Advanced Template with RBAC i got the below issue while running the command yii rbac/init
Exception 'yii\base\UnknownClassException' with message
'Unable to find 'console\controllers\RbacController'
in file: /var/www/yii/console/controllers/RbacController.php. Namespace missing?'
To overcome this simply edit the "namespace console\commands;" as "namespace console\controllers;" in RbacController.php
RbacController - will be inside the console/controllers folder.
Once we set all correctly run yii rbac/init then we will get the values automatically in our migrated tables auth_item and auth_item_child
Web, Apps and Latest Technology
Monday 29 June 2015
Wednesday 4 March 2015
Wordpress Year Pagination.
We have used Page No pagination in WordPress like
[15] [14] [13] ... [1]
Likewise we can create the Year pagination for our archive post. OK use the below code to simply past in your archive list area under the pagination part.
<?php
$current_year= date('Y'); // this will the current year
$archive_year = get_the_time('Y'); // this will get the year of the archive list
$starting_year= "2006"; // this will be our starting year
?>
<ul class="SOME CLASS">
<?php if($archive_year < $current_year ) { ?>
<li><a href="<?php echo get_year_link( $archive_year+1 ); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
<?php if($archive_year == $current_year ) { ?>
<li><a href="<?php echo get_year_link( $archive_year ); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
<li class="SOME CLASS FOR DIVIDER"></li>
<?php
for($i=date('Y'); $i>2005; $i--) {
$diff= $i-$archive_year;
if($diff>2&&$diff<4)
{
echo '<li><a href='.get_year_link( $current_year ).'>'.$current_year.'</a></li>';
echo '<li><a class="SOME CLASS">…</a></li>';
}
if($diff>-3&&$diff<3)
{
if ($i == $archive_year) {
echo '<li class="active"><a href='.get_year_link( $i ).'>'.$archive_year.'</a></li>';
}
else {
echo '<li><a href='.get_year_link( $i ).'>'.$i.'</a></li>';
}
}
if($diff>-4&&$diff<-2)
{
echo '<li><a class="SOME CLASS">…</a></li>';
echo '<li><a href='.get_year_link( $starting_year ).'>'.$starting_year.'</a></li>';
}
}
?>
<li class="SOME CLASS FOR DIVIDER"></li>
<?php if($archive_year <= $current_year && $archive_year > '2006') { ?>
<li><a href="<?php echo get_year_link( $archive_year-1 ); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
<?php if($archive_year == $current_year && $archive_year == '2006') { ?>
<li><a href="<?php echo get_year_link( $archive_year); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
<?php if($archive_year != $current_year && $archive_year == '2006') { ?>
<li><a href="<?php echo get_year_link( $archive_year); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
</ul>
[15] [14] [13] ... [1]
Likewise we can create the Year pagination for our archive post. OK use the below code to simply past in your archive list area under the pagination part.
<?php
$current_year= date('Y'); // this will the current year
$archive_year = get_the_time('Y'); // this will get the year of the archive list
$starting_year= "2006"; // this will be our starting year
?>
<ul class="SOME CLASS">
<?php if($archive_year < $current_year ) { ?>
<li><a href="<?php echo get_year_link( $archive_year+1 ); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
<?php if($archive_year == $current_year ) { ?>
<li><a href="<?php echo get_year_link( $archive_year ); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
<li class="SOME CLASS FOR DIVIDER"></li>
<?php
for($i=date('Y'); $i>2005; $i--) {
$diff= $i-$archive_year;
if($diff>2&&$diff<4)
{
echo '<li><a href='.get_year_link( $current_year ).'>'.$current_year.'</a></li>';
echo '<li><a class="SOME CLASS">…</a></li>';
}
if($diff>-3&&$diff<3)
{
if ($i == $archive_year) {
echo '<li class="active"><a href='.get_year_link( $i ).'>'.$archive_year.'</a></li>';
}
else {
echo '<li><a href='.get_year_link( $i ).'>'.$i.'</a></li>';
}
}
if($diff>-4&&$diff<-2)
{
echo '<li><a class="SOME CLASS">…</a></li>';
echo '<li><a href='.get_year_link( $starting_year ).'>'.$starting_year.'</a></li>';
}
}
?>
<li class="SOME CLASS FOR DIVIDER"></li>
<?php if($archive_year <= $current_year && $archive_year > '2006') { ?>
<li><a href="<?php echo get_year_link( $archive_year-1 ); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
<?php if($archive_year == $current_year && $archive_year == '2006') { ?>
<li><a href="<?php echo get_year_link( $archive_year); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
<?php if($archive_year != $current_year && $archive_year == '2006') { ?>
<li><a href="<?php echo get_year_link( $archive_year); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
</ul>
So the above will output like below
Thursday 5 February 2015
Simple Mobile number subscription plugin Wordpress, Wordpress Mobile number subscription plugin
Simple Mobile number subscription plugin
== Description ==
This plugin will be handy for your users to add their numbers in your site, and you can use this plugin for your whatsapp subscription list
A few notes about the sections above:
* Shortcode for widget
* Admin can able to add, edit, delete the mobile number
* "Tested up to" is the highest version that you've *successfully used to test the plugin*. Note that it might work on
higher versions... this is just the highest one you've verified.
== Installation ==
1. Upload `whatsapp-subscription` to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
This is the shortcode that we need to use [ADD-SUBSCRIPTION-WHATSAPP]
Use this Wordpress Simple plugin: https://wordpress.org/plugins/whatsapp-subscription/
== Description ==
This plugin will be handy for your users to add their numbers in your site, and you can use this plugin for your whatsapp subscription list
A few notes about the sections above:
* Shortcode for widget
* Admin can able to add, edit, delete the mobile number
* "Tested up to" is the highest version that you've *successfully used to test the plugin*. Note that it might work on
higher versions... this is just the highest one you've verified.
== Installation ==
1. Upload `whatsapp-subscription` to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
This is the shortcode that we need to use [ADD-SUBSCRIPTION-WHATSAPP]
Use this Wordpress Simple plugin: https://wordpress.org/plugins/whatsapp-subscription/
Tuesday 3 February 2015
Avoid Custom Codes in WordPress Core files
WordPress is the best blogger CMS open source, as well as hack-able one. So we need to keep updating everything regularly.
Themes
Plugins
WordPress version
WordPress version update comes with Manual update as well as One click update from the dashboard. But if you made any custom codes inside wp-admin/ or wp-includes folders, then it will be replaced and we will lose our files, functions etc.
So Always don't edit any core files of WordPress
as well as don't update any raw files inside wp-content/themes or wp-cotent/plugins, if you edit any WordPress themes then it will be big head ache as well as we need to be stay in the old version if we need our site in the same format, if you did any edits in the theme files and updating the version then we will entirely loose the site design, functions etc.
So always create a Child theme and put your edited files there
If we are following this formats, then by a single click we can update our versions, and our site will be get secured.
Sunday 1 February 2015
Whatsapp for sharing your Posts, Whatsapp PHP API for Wordpress, Whatsapp for Wordpress
We can see many sharing services like Addthis, Sharethis have already integrated the Whatsapp sharing services in their stream.
But it wont work in the Desktop version, as Whatsapp will work in latest Iphone and Chrome version. May be in the future days they will set the API for web sharing, but for now there is no such options in Whatsapp as well as in other Social Sharing Sites.
Ok, but we can do the sharing. Please refer this https://github.com/venomous0x/WhatsAPI, they are having the API to send the Whatsapp message from a mobile to other mobile.
Ok, here is the steps to set your API:
Please set the credentials inside the exampleFunctional.php file, and set the [$target] target mobile number to which you want to send your blog titles/ URLs.
The target numbers will get the Whatsapp Message from our WART registered Mobile number.
This Github URL is providing all the variables set for Whatsapp API from venomous0x
https://github.com/shirioko/WhatsAPI/wiki/WhatsApi-events
We can use this API and integrate with our Blogger or Wordpress sites, we can set some AUTO system and send the messages to the Subscribed mobile numbers once we post a new articles in our site.
YES WHATSAPP IS WORKING.
Happy coding...
But it wont work in the Desktop version, as Whatsapp will work in latest Iphone and Chrome version. May be in the future days they will set the API for web sharing, but for now there is no such options in Whatsapp as well as in other Social Sharing Sites.
Ok, but we can do the sharing. Please refer this https://github.com/venomous0x/WhatsAPI, they are having the API to send the Whatsapp message from a mobile to other mobile.
Ok, here is the steps to set your API:
- First we need to register our Mobile number with WART (https://github.com/shirioko/WhatsAPI/wiki/WhatsApp-Registration-Flow), check this site.
- Once you register you will get a SMS code confirmation
- We need to set the Code confirmation again in the same registration form and once set we will get the below
and this is what we need for the API
- Username
- Password
- Identity
Please set the credentials inside the exampleFunctional.php file, and set the [$target] target mobile number to which you want to send your blog titles/ URLs.
The target numbers will get the Whatsapp Message from our WART registered Mobile number.
This Github URL is providing all the variables set for Whatsapp API from venomous0x
https://github.com/shirioko/WhatsAPI/wiki/WhatsApi-events
--------------------------------------------------------------------------------------------------------------------
We can use this API and integrate with our Blogger or Wordpress sites, we can set some AUTO system and send the messages to the Subscribed mobile numbers once we post a new articles in our site.
YES WHATSAPP IS WORKING.
--------------------------------------------------------------------------------------------------------------------
Why Whatsapp is not working in my ADDTHIS share code?
That is because it will be get worked inside the mobile device only with latest OS and CHROME versions. Also while referred to different forums, it is detailed that it will get worked in the latest Iphone devices.
If we run the Addthis - Whatsapp share inside the desktop version we will get the below link and it wont get worked
http://whatsapp//send?text=***************************************
Happy coding...
Tuesday 9 December 2014
Play with CSS - CSS BOX SHADOW
CSS comes with a good box pattern called "Box Shadow" of your tag. For more details on Box shadow tutorials refer here http://css-tricks.com/snippets/css/css-box-shadow/
We can set the floating of our tags (DIV, P etc) by setting the Box shadow style.
The box-shadow property sets one or more drop-shadows to the tags.
Sometime you need this http://www.w3schools.com/cssref/playit.asp?filename=playcss_box-shadow&preval=50px%2050px%205px%20black
Through this box shadow pattern i did some CSS image styling, please refer my below screenshot
At some point we can avoid using the image and we can reduce the load time of the site. I didt diked any online tutorials, but this is what i got while working practically
1em 0 0 0 red (Creates a box to the right of your tag (for me it is a div tag)
so what if 2em 0 0 0 red (Creates a box to the right of your tag with space like below (for me it is a div tag)
We can set the floating of our tags (DIV, P etc) by setting the Box shadow style.
The box-shadow property sets one or more drop-shadows to the tags.
Sometime you need this http://www.w3schools.com/cssref/playit.asp?filename=playcss_box-shadow&preval=50px%2050px%205px%20black
Through this box shadow pattern i did some CSS image styling, please refer my below screenshot
.myclass{
box-shadow: 1em 0 0 0 red,
0 1em 0 0 red,
-1em 0 0 0 red,
0 -1em 0 0 red,
-1em -2em 0 0 red,
1em -2em 0 0 red,
-1em 2em 0 0 red,
1em 2em 0 0 red,
2em 1em 0 0 red,
2em -1em 0 0 red,
-2em 1em 0 0 red,
-2em -1em 0 0 red,
3em 0 0 0 red,
-3em 0 0 0 red,
0 3em 0 0 red,
0 -3em 0 0 red;
background: black;
width: 1em;
height: 1em;
overflow: hidden;
margin: 50px 0 70px 65px;
}
At some point we can avoid using the image and we can reduce the load time of the site. I didt diked any online tutorials, but this is what i got while working practically
1em 0 0 0 red (Creates a box to the right of your tag (for me it is a div tag)
so what if 2em 0 0 0 red (Creates a box to the right of your tag with space like below (for me it is a div tag)
Friday 7 November 2014
Why my wordpress site is slow and how to avoid it
I have been working in a WordPress project for a while and it is having too many data and comments from users. May be some 4000 posts and 30000 comments, day by day the site became shaky and it took lot of time to get loaded.
But there is something that makes the site to get loaded very slow. Actually i am just loading 10 posts in the home page and every other pages of the site is loading only 10 posts per page.
Mine is a WINDOWS / MYSQL server and it is easy for me to check any TEMP and CACHE values. While looked into my windows temp folder it loading with many 100+ PHP-CGI.exe files created for every minute, so i used a good cache plugin to cache the files and reduced the EXE file generation.
But this does not actually reduced my page load problem and some time i got MYSQL server is overloaded something, and again i checked my TEMP folder and it showed it is stored some SESSION values for 1KB, the reason is i am using plugins (SI Captcha, Ninja Forms and YII poll)
Inside these plugins there are code lines to generate Session values and we know all the session values will be get stored in our server, for every second the TEMP session files are getting generating. For a second i got some 5 files got generated, so i deleted these plugins and i got the site came in normal. So the problem is too many session files and php exe files.
My Wordpress site is very big so i did all, if you are not having that much traffic then no problem.
But i used the clean WordPress formats and codes, so i don't need to bother about any custom code issues.
Note: PLEASE DO NOT CUSTOM CODE anything in the WordPress default file or write any unwanted SQL queries. Unwanted files and SQL queries will took time for the site to get loaded.
But there is something that makes the site to get loaded very slow. Actually i am just loading 10 posts in the home page and every other pages of the site is loading only 10 posts per page.
Mine is a WINDOWS / MYSQL server and it is easy for me to check any TEMP and CACHE values. While looked into my windows temp folder it loading with many 100+ PHP-CGI.exe files created for every minute, so i used a good cache plugin to cache the files and reduced the EXE file generation.
Note by default the Cache files will be get deleted on some time period (2 HRS, 4 HRS) and mine is 2 hrs.
But this does not actually reduced my page load problem and some time i got MYSQL server is overloaded something, and again i checked my TEMP folder and it showed it is stored some SESSION values for 1KB, the reason is i am using plugins (SI Captcha, Ninja Forms and YII poll)
Inside these plugins there are code lines to generate Session values and we know all the session values will be get stored in our server, for every second the TEMP session files are getting generating. For a second i got some 5 files got generated, so i deleted these plugins and i got the site came in normal. So the problem is too many session files and php exe files.
Note: While creating any WordPress project DON'T CREATE TOO MANY SESSION values, as all will get stored in your server. And while using any plugin please check whether this is creating any session values.
My Wordpress site is very big so i did all, if you are not having that much traffic then no problem.
Subscribe to:
Posts (Atom)