Setting the layout for a specific action is easy. However you need bake that cake a bit more if you need it to apply for the entire controller. This is how you set the layout for the entire controller.
public function beforeFilter() {
parent::beforeFilter();
$this->layout = 'layout_name';
}
The .htaccess (Hypertext Access) file is a web configuration file used by the web server Apache. It is used to change the behaviour of the web server within a local hierarchy, such as a folder and its subfolders. Here’s a little note on how to create the .htaccess file.
You usually find the .htaccess file in the servers root folder and it is named .htaccess. If it’s not there, you can simply create it and Apache will take it into account.
Creating the .htaccess file when using Windows sometimes proves problematic as the filename starts with a dot. If you’ve enabled file extensions in Windows, you will recieve an error message saying “You must type a file name.” If you haven’t, it will simply appennd the extension “.txt” automatically.
If you have a FTP program you could create the file on the server through it. However, a more convenient way is to create it through Notepad. That way, you can start editing the .htaccess file straight way.

Remember to save as type “All files (*.*)” or else Notepad will append “.txt” to the filename.
WordPress comes with a great set of standard smileys but however good they might be, there is always those times when you need to remove the smileys on certain posts. There is a general way to remove them by changing the settings. (Options->Writing->Formatting->Uncheck convert emoticons)
If you only need to remove the smileys on specific pages then you can inser ‌ after the first character of the smiley.
No more emoticon mayhem!
A recent experiment with PHPs imaging functions resulted in a little project I’d like to call Motivator. It’s a motivational poster generator licensed under GPL 3.
The script arranges an user supplied image along with some text, also supplied by the user, as a motivational poster. Here’s a preview if you’d like to try it. You’ll find the source code here.
Read more »
As the most popular social networking site, Facebook like all other communities is subject to its share of hacks. Methods on how to access peoples private photo albums have previously surfaced and I recently found out that it’s possible to find the facebook profile associated with a certain photo.
This is made possible because the photo url contains the profile id. Just paste this javascript function into the adress bar and run it and you’ll be redirected to the profile.
//Copy and paste this into the adress bar
javascript:(function(){var sp = location.href.split('/'); var f = sp[sp.length-1].split('_'); window.open("http://www.facebook.com/profile.php?id="+f[2],Math.random()); })();
So you’ve tried to center images in your wordpress posts but for some reason it wont work. You’re probably experiencing this problem because your .aligncenter class is improperly set up. Aligncenter is the class used when selecting the center option when inserting images.
![]()
To fix this problem – find your themes stylesheet file and scroll down to the aligncenter class. Then change it so it matches the following. Just create it if it doesn’t exist.
.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
}
No need to use <p style=”text-align:center”> or <center></center>.
Although other browsers renders it just fine, Internet explorer can’t remove iframe borders with the following css:
iframe {
border: 0px;
}
It will simply result in the same fugly border showing around the iframe-box as always. People have tried solving the issue with all kinds of css all of which I find too demanding if you only have one or two iframes. Here is the simple fix:
<iframe frameborder="0"/>
Thank you very much explorer.
I was writing a function to check if a Twitter username exist but when it was time to upload it I realized that my hosting provider did not allow me to use file_get_contents. However, I rewrote the script using cURL instead. Here’s the code:
Last night I started working on a script that needed to upload images without refreshing the page. As you may know this is not possible in AJAX. You’ll have to use an iframe and execute the code in it. However, I ran in to some trouble when I wanted to change an image in the parent window from a script in the iframe. The solution is obviously riddicously silly. I guess that happens when you never have time to write javascripts anymore. Damn you law school.
Here’s the code for the interested mind:
I’m currently working on a script that needs to resize transparent GIFs with GD. However, I didn’t get far until I realized that my GIFs transparent background went black when resized them. I found a bunch of suggestions on how to solve the problem on google but most of them didn’t work for me. Eventually I found out that allocating the background color in the destination image removed most of the black color. In addition I also had to switch imagecreatetruecolor for imagecreate to get rid of the problem completely. Here’s the code:
Read more »