Showing posts with label cakephp. Show all posts
Showing posts with label cakephp. Show all posts
Saturday, April 21, 2012
Day #10 of a #30 day startup
Latest addition to the site functionality has been to enter a "slug" when viewing a thread and associated comments. The "slug" is the title you see on a url eg www.mysite.com/view/2:this-thread-about-London where the slug is "this-thread-about-London". It makes it easier to see what a thread is about from its link, and aids also in SEO terms. For those cakephp programmers who'd like to know how to implement this, I took notes mainly from generate unique slugs and from routing in the cookbook
I'm constantly busy on the site at the moment. Some good news is that I have a domain name now
, and I hope to write more on this in the next blog article.
Friday, April 20, 2012
Day #9 of a #30 day startup
I've made further progress on the site, and have set up the code so that titles can be translated automatically into the respective language, so long as I've inserted those translations into the relevant .po files. The attached screenshot should give an idea of how it looks when viewing in another language. I think I may well get the site up and running early next week, and adapt the site according to feedback. I believe it will already be useful for my own surfing/commenting purposes. Later I hope to include embedded vids from sites like Vimeo or Youtube, but I'd like to get the conversation parts working first.
For those who are developing in Cakephp and want to implement a multi-language site here are two useful links : cakephp book and Localizing Japan.
Monday, April 16, 2012
Day #6 of a #30 day startup
Today I got into the essential nitty-gritty of writing a web application - allowing registration and log-ins of users, and putting in place authentification of data entry. Luckily I've done this before, and there is also a very helpful section on authorization in the cakephp documentation which makes a lot of the coding fairly straight forward, although the layouts and screen markups still need to be altered to fit screens. Initially I won't be putting restrictions on whoever can register onto the system - indeed there may not be many at all! However I am leaving status codes in the users table as there may well be hackers who create users merely to post spam - at which point I will also utilise the use of such services like Stop forum spam. As stated, to begin with I intend making registration (and consequent posting) as easy as possible. But there will be validation and sanitization of data entered - I'm not quite so reckless!
Friday, April 13, 2012
Day #5 of a #30 day startup
Lesson learnt today: Coding involves learning something new on a regular basis. Again this is something we constantly re-learn, it's what makes coding so fulfilling. The downside is spending hours finding out how to achieve something, that should really only take a few minutes to accomplish. At least the next time, the task is done quickly and effectively.
The functionality of the site is getting better - but there is a lot yet to be done. I won't be posting here over the weekend, but no doubt I'll be looking at the code at some point.
Cakephp finding: Here's something I didn't previously know and has re-kindled my love for the cakephp platform - the counterCache behaviour. In my case it automatically updates the comment_count field in the parent table with the aggregated sum of related comments in the child table. This will save a lot of database calls to bring back number of comments against a posting. And the only code to implement this goes in the Comment model - 'counterCache' => true . Fantastic! (it's described in the Cakephp cookbook )
Thursday, April 12, 2012
Day #4 of a #30 day startup
Lesson learnt today: I still hate css! :)
For those who code in cakephp, and want to highlight the current tab (yet are not extracting menu items from a db table) the following may be of interest.
In the controller function (remember this has to be done for each function that renders the layout and menu element)
if ($category_id==1) {
$this->set('activeTab','General');
} elseif ($category_id==2) {
$this->set('activeTab','Culture');
} elseif ($category_id==3) {
$this->set('activeTab','Tech');
This means that in the element I can set a class for the current tab, via php - unfortunately the sanitisation of code means I can't show it here. Basically the php will echo class="current" within the li> tag if activetab is set to the relevant value.
For those who code in cakephp, and want to highlight the current tab (yet are not extracting menu items from a db table) the following may be of interest.
In the controller function (remember this has to be done for each function that renders the layout and menu element)
if ($category_id==1) {
$this->set('activeTab','General');
} elseif ($category_id==2) {
$this->set('activeTab','Culture');
} elseif ($category_id==3) {
$this->set('activeTab','Tech');
This means that in the element I can set a class for the current tab, via php - unfortunately the sanitisation of code means I can't show it here. Basically the php will echo class="current" within the li> tag if activetab is set to the relevant value.
Tuesday, April 10, 2012
Day #2 of a #30 day startup
Lesson learnt today? - It's good to have a visual mock-up of what you are heading towards.
I'm writing this entry early today, not because I'd like the afternoon off (chance would be a fine thing) but because I've got an early representation of what a main screen may look like on the site. I already had sketches that I am working to, but a screen mock-up can show us all how the display can look. Already it has indicated to me certain validation restrictions that I will have to include in the coding of the site.
Now, although I'm happy to be described as a programmer or even a web developer, I am not a web designer. Yes, I can change layouts, introduce drop down menus or change the appearance of text. But to make a site overall look professional, it's essential to get layout from a good web designer included - something to consider if you want a website building.
However I stated in my initial post that I'm trying to run this as a lean startup ie not spending money where possible. So I have made use of a css free templates site and chosen this layout http://www.csstemplatesfree.org/preview/Nautica/ It's been written by Luka Cvrk, and if you like his designs (you can find them at Luka's site ) then please patronise his work - he has both free and decently-priced premium templates. I'm not going to stick to everything in that layout - much will have to change as my site develops. But it's good, I feel, to get a glimpse of how the site may look.
PS
CakePhp code tip: To specify which css file and layout to use for a screen, use this line in the function code (for example for index or view) in the controller
$this->layout='yournew_layout';You can then specify the css file you require from that layout file.
Monday, April 9, 2012
Day #1 of a #30 day startup
Well I decided to take the plunge, and monitor the progress of my latest project on this blog.
I've developed and coded websites previously, but this time I thought others thinking of persuing their web idea, may be able to learn from my experiences, if only in avoiding any silly mistakes I make! Of course, if I get knowledgeable folk leaving advice here via the comments facility they will be very welcome!
Where I can it's going to be my own work (no outsourcers employed), and I intend spending as little money as possible on developing and launching the site. Use of opensource software, free tools etc will be the ideal mode of working.
The idea behind the website is to set up a multi-lingual talk-board, initially with English, German and Spanish. I won't use automatic translations, as I'm still not happy with the translations that automatic software produces. However I hope to link (and translate directly) entries on threads in different languages - if we get any users of course!
I'm still unsure as to whether I commit the code to Github, so others can utilise or modify the code - I'll publish my decision here in a later entry.
Name of the website - I haven't chosen yet, nor have I yet obtained a domain. I will develop the site on my local machine, and so for the first week or two there will just be screenshots to observe here.
What have I done today? Set up cakephp 2 on my development machine, created the initial table structure, and used cakephp bake utilities to initialise some screen views - which will all need to change dramatically over the coming days. Hopefully more to come tomorrow.
Subscribe to:
Posts (Atom)