Tag Archives: How to

Creating Plugins

23666Open up your command prompt in your app/bin folder;

enter the command;

Baking the  controller for your plugin;

Baking the Model View and Controller:

Read more here:
http://book.cakephp.org/3.0/en/plugins.html#creating-your-own-plugins

Cakephp3 How to pass a variable to an element

cake-logoSometimes its very handy to pass a variable to an Element in Cakephp3.

This allows you to customize the element if needed;
To do so simply;

in your view file;

What does it do?
This will load the element called “helpbox” and pass the value “Oh, this text is very helpful.” to the variable called “helptext” in the element.

CakePHP3 Book:
http://book.cakephp.org/3.0/en/views.html#passing-variables-into-an-element 

Cakephp 2.0 Tip# 14 File Uploads

cake-logo

Firstly you need to install the Plugin;
https://github.com/josegonzalez/cakephp-upload

In the Model of the object you want to allow uploads to(eg User,Product) add;

Model

View:

In the View Form of this action add;

CakePhp tip #5: Joining two fields to create one

Joining two fields to create one (eg to get somebodys name by combining firstname and surname)

cake-logo

You need to create a “VirtualField” in the model;

Then in your controller, to get a drop downlist;

Credit to:
http://stackoverflow.com/questions/11822942/cakephp-display-multiple-fields-in-a-single-drop-down

Notepad++ Enable CakePhp .ctp Files

If you are writing code in Notepad++ and using Cakephp youll notice it doesnt highlight .ctp files (CakePhp View Files).

You can fix this quite easily by;

Opening;

C:\Users\[YOURNAME]\AppData\Roaming\Notepad++\

Open teh file called; langs.xml

Scroll down till you see;

¬† <Language name=”html” ext=”html htm shtml shtm xhtml hta”

Add ctp to the end of it;

<Language name=”html” ext=”html htm shtml shtm xhtml hta ctp”

Save it and reopn Notepad++ your .ctp files should now render correctly.

How to get the BBC IPlayer to work if your not in the uk

Channel 4’s superb 4OD allows us irish folks to watch all programs on the site while for other reasons the BBC wont allow anyone outside the uk too.

After a bit of research and googling i found and tried a way that does work at least if your in Ireland. Full credit goes to a boards.ie member but heres how to;

Originally Posted by joeyamg View Post
Looked at various ways of doing this, best free way I’ve found for getting iplayer to work:

Step 1: Download and install the latest stable release of Tor using the default options. Run setup and make sure you’re connected to the network. Green onion will appear in system tray if it is working ok.

Step 2: Download and install mgeni, it’s a browser that uses the Tor network to allow you to choose what country you want to route through.

Little bit slow loading webpages (maybe turn off image loading) but video feed is perfect (I’ve only got a 7mb connection). Much easier than messing with foxy proxy or whatever else.

*Doesn’t work for hulu unfortunately

After you get the above software to work wich is easy enough you should be able to watch programs from the BBC site.

How to: Create a batch file to open websites

tech-tip-iconWhile at college or work its a real pain when you login to have to open up 3 different websites and maybe 2 more applications.

Well with a simple “batch” file you can do it all. Simply open notepad and paste the following code into it and save it as “.bat” file then double click it to run it and hey presto no more annoying websites to have to type in, feel free to change the website address to what ever you want.

start http://www.gmail.com
start http://www.google.ie
start http://www.irishbloke.net