Creating a routing-based menu in symfony 1.2, part 4: the full package

April 6th, 2009

During the last 3 articles I showed you how to define the menu structure, generate sfMenuItem objects and create a builder that does all this for you. Today I want to present you the full package of my sfMenuBuilder and describe all the additional options I included.
Owing to a comment by Hugo HAMON, I decided to remove all external dependencies, so now the routing and i18n have to be injected, making i18n optional.

Read the rest of this entry »

Creating a routing-based menu in symfony 1.2, part 3: the builder

April 3rd, 2009

After defining a menu structure and describing the sfMenuItem object it’s time to show you how to pack the whole menu thing up to generate the menu with a few lines of code.

Up until now we have defined a tree structure in yaml and created a PHP class to generate menu items recursively as well as render their content. We are able to load the object assigned to an sfObjectRoute and even find related objects and create route links for those through the sfObjectResolver class.
Read the rest of this entry »

Creating a routing-based menu in symfony 1.2, part 2: the MenuItem object

April 3rd, 2009

During my last article I described how the structure of my routing-based menu is defined. This time I want to show you how to create menu item objects using this structure as the source. You will also learn how the items interact with the symfony environment.
Read the rest of this entry »

Creating a routing-based menu in symfony 1.2, part 1: the structure

March 31st, 2009

The new symfony routing system with object routes and other niceties is so useful that you might consider basing your application navigation upon it. In my following articles I want to show you how to get a fully configurable multi-level menu system based on a minimalistic yaml syntax (and you could replace the yaml definition with anything else you like, be it XML, a database or whatever you want!). Sounds interesting? Read on!
Read the rest of this entry »

Managing “soft” relations between PHP objects

March 28th, 2009

Sometimes you may stumble upon the problem that you have to find related objects to other objects without actually knowing anything about the objects but their class names. In this case the best approach is to have a universal object resolver based on the fact that the objects themselves usually know best what relations they have. I want to show you a quite simple approach that I use myself in a symfony project.
Read the rest of this entry »

Stackoverflow.com – a great database for developers

September 26th, 2008

Joel Spolsky, a co-founder of http://stackoverflow.com recently announced the launch of this great Q&A tool from programmers for programmers. I’ve taken a look at it yesterday and liked it immediately.

Even if you don’t have any particular question, just browsing it for fun or broadening your mind is great and leads to some nice insights.

Styling an input type=”file” using jQuery

August 21st, 2008

During the last days I had to work on some forms that are using file upload inputs. I wondered how to make the file input fields look nicer (they are not affected very much by css) and found this appealing solution. Since the application needs JavaScript anyway, there was nothing wrong with the approach and it worked fine. However, I didn’t like the look of the (working!) JavaScript code and wanted to do it more niftily using jQuery.

Read the rest of this entry »

Fighting spam

July 18th, 2008

OMG, those registration spam bots are such an annoyance!

For this reason I combined my upgrade to wordpress 2.6 with the installation of the Register-Plus plugin to add a captcha to the registration. Unfortunately the simple captcha does not seem to work, it always tells me that my captcha code is wrong (I also tried adding session_start() to wp_login.php as suggested by the plugin, but it didn’t help), so I switched to the reCAPTCHA service. reCAPTCHA works and should be good against bots, so let’s hope for the best!

Status update

June 11th, 2008

I haven’t had the time and also not many ideas what to write during the last few weeks, but creativity is flowing back in (despite the sticky weather here in Vienna) and I think there will be some new articles soon. There might be something more to write about Joomla! and about other software I had to do with during the last months. I don’t think I’ll write about the UEFA EURO 2008 which is kind of hard to miss at the moment – but in roughly 3 weeks it will be over and life in Vienna (and the rest of Austria) will switch back to its usual sleepy July-August look and feel.

How to backup web hosts has been downloaded 46 times so far which is not very much but ok for me – if I was able to help 5 or 10 people until now, that’s far better than helping no one, isn’t it? At least the search terms incorporated with the visits suggest that some people were actually looking for something like this.
Akismet has caught 80 spam comments until now (no, I just don’t want to see nude baby sitters!) and not let a single spam comment through. There hasn’t been a useful comment until now, but perhaps this will change some day. Actually it doesn’t matter that much.

How to backup web hosts

April 7th, 2008

Do you backup your personal data regularly? I hope so. If you don’t, stop reading here and go backup your data.

If you are still reading this, you are really doing backups of your personal data. But do you have regular backups of your web host data (e.g. blog, forum, online shop) including files AND databases? Perhaps you are using stuff like phpMyAdmin to backup your databases from time to time.
And if you DO have backups of your web host (and I’m sure that there are not many people out there doing this, especially for their private hosts), do you have an archive of previous versions? Yes? You’re great, welcome on board, skip this blog posting (or don’t if you want to learn how I do it).

Everyone else who wants to know how to perform fully automated incremental backups of your web host including files and mysql databases and an archive of previous backups and do all this on Windows (of course I know that the Linux guys have advantages in that area) go and read on…

Read the rest of this entry »