Yii2: Export GridView

Export is not available from the built-in GridView widget.

However there’s an enhanced GridView widget that include this functionality, along with many other features missing from the built in widget.

Here’s an example of exporting data in the grid to CSV or Excel format. In view file:
Continue »

Yii2: SQL of an Active Query

There are 2 ways to see actual SQL query.

Method 1: via Debug Module

If debug is enabled, you can find SQL query along with many other useful debug information.

Method 2: via Code

Say you have Record model:

$query = Record::find();
echo $query->createCommand()->rawSql;

Migrating from b2evolution to WordPress

Update: There’s updated post addressing issues with the script.

This site was recently migrated from b2evolution to WordPress. I’ve been wanting to do this for a while. There’s nothing wrong with b2evolution. It’s a very powerful CMS / blogging engine, and in my opinion, it’s more powerful than WordPress. When I started this site I had grand plan such as starting a community to share codes and it was the perfect product. However I just ended up not doing it. Nowadays I just need a blog and it seems too much for a blog.

Most migration tools I found were either for older versions of b2evolution, or there were complaints not fully functional or various other issues. Or they’re NOT free!

Continue »

WordPress: Expose username fix and hide author page

It’s inevitable that hackers want to break into your site. With some of the WordPress-based sites I managed, I’m surprised to find that no matter what username changed to, even if the name is very cryptic, there are hacking attempts with those usernames! I looked everywhere to ensure username is not exposed yet they could still find it!

Are hackers really that smart?

Continue »

CSS: Responsive Video

The CSS Framework i worked on is able to handle all types of responsiveness, but not video. So I did a bit of research and found a piece of code that does the trick.

Wrap the embedded video in a container as follows:

Continue »