For the past week I have been working on a DataSource for the WeGame API. Everything was working fine until I added some logic to cache the results. From there I ran into a few problems, here is how I resolved it. Continue reading...
Compression v1.4
Compression is a light weight class that will load a CSS stylesheet, bind and translate given variables, compress and remove white space and cache the output for future use.
Blog entries with the tag "Data"
Jan
16
16
Retrieving tables within your Cake database
Topics: Tutorials, CakePHP // 2 comments, 653 views
I have been working lately on adding an installation process to my forum plugin. For this process I needed a way to retrieve a list of tables within a selected database, to make sure there are no table name conflicts. You simply use the ConnectionManager class. Continue reading...
It has been quite a while since I posted a real entry, I just haven't worked in CakePHP for the past few weeks. Hopefully these two new scripts and the new script versions will make up for it. Continue reading...
Aug
14
14
Custom method for grabbing a row based on its id
Topics: Tutorials, CakePHP // 1 comments, 586 views
More times then none when working with a database, you need a general purpose method for grabbing fields from a row that matches an id. Cake has built in magic methods based on the table column that do just that, for example findById() or findBySlug(), but sometimes it grabs associated data that you do not want. Below is a basic method that you can place in your AppModel to grab a row based on its id, with optional parameters for restricting what fields to grab or what associations to contain. Continue reading...
Jul
30
30
Databasic 2.1, now with more operator support!
Topics: Scripts, PHP & MySQL // 2 comments, 782 views
I got pretty bored the other day and also noticed this contest over at NetTuts, and thought to myself, "Why not enter Databasic into the contest?". Well that is my plan, but I also wanted to fix some problems and restraints in the current version. The new version supports AND/OR operators in the conditions, as well the column operators (!=, <=, etc) have been rebuilt. Continue reading...
Jul
20
20
Stripping HTML automatically from your data
Topics: Tutorials, CakePHP // 2 comments, 769 views
About a week ago I talked about automatically sanitizing your data before its saved. Now I want to talk about automatically stripping HTML from your data before its saved, which is good practice. Personally, I hate saving any type of HTML to a database, thats why I prefer a BB code type system for this website. Continue reading...
Jul
14
14
Automatically sanitizing data with beforeSave()
Topics: Tutorials, CakePHP // 2 comments, 981 views
So if you are like me and hate having to sanitize or clean your data manually within each action, and was hoping there was an easier way, there is. Simple combine the magic of the Models beforeSave() and the powerful strength of Sanitize::clean(). Continue reading...
I am proud to present the new Databasic, version 2.0! Since I added quite a few new methods and functionality, rewrote and optimized most of the code, I felt it would be good to deem this version 2.0 instead of 1.11. The biggest new features in this version are support for multiple databases, using the create() method to create a database table, and the addition of many MySQL statement methods. Continue reading...
When I first started using CakePHP, I couldn't find a way to pre-populate a form with data. Why would I need this you ask? Well its simple, it would be used to edit something already existent. So what I need to do is grab the data from the database, and then populate the form. Took me a few hours to figure out how to do it, the guide really didn't explain how it should be done (or I just overlooked it). To have the data populate, all you need to do is to set $this->data to the database result. Continue reading...
It seems the most recent version of my Databasic class had a few problems in it. I left some code in there (echos and comments) that was used while I was testing, and I forgot to revert it. I want to thank Tanax for sending me an email and pointing it out. To everyone else, please download the latest version (1.10.3) and be sure to email me if you find any problems. Continue reading...
Popular Entries
Topics
- CakePHP (42)
- Entertainment (2)
- Gaming (4)
- HTML & CSS (1)
- Javascript (6)
- jQuery (6)
- Other (8)
- Personal (12)
- PHP & MySQL (18)
- Plugins (3)
- Programming (8)
- Resources (13)
- Reviews (1)
- Scripts (14)
- Tutorials (41)