January 9, 2009
· Filed under php · Tagged framework, php, symfony, tutorial
Modifying the Model
So far, there hasn’t been much PHP code in this tutorial. That’s one of the strengths of symfony: it doesn’t force you to write code that symfony can generate itself based on simple data. However, you will need to write a few lines of PHP for the tags in the model. First, let’s explore the model’s structure.
Read the rest of this entry »
January 9, 2009
· Filed under php · Tagged framework, php, symfoni, tutorial
Generating a Site Administration Panel
We’ll use a great feature of the symfony framework called the administration generator to create a site administration panel. The administration generator uses the relational schema as a guideline to create a data manipulation interface. Our site administrator will need to edit data from the Photo class, so let’s generate an admin panel for this class:
$ php symfony propel-init-admin frontend photo Photo
Read the rest of this entry »
January 9, 2009
· Filed under php · Tagged framework, php, symfony
With the release of symfony 1.0, it’s time for those who haven’t tried it yet to see what’s inside this beautiful framework. Stable, fully documented, and released under the open-source MIT license, symfony is used by hundreds of web sites, including some very large ones (Yahoo! Bookmarks, with its 20 million-strong user base, is built with symfony). If you haven’t taken the time to look at the introductory screencasts on the symfony project website, this simple tutorial will lead you through the basics.
Read the rest of this entry »
July 9, 2008
· Filed under php · Tagged gd, image manipulation, php, web
Introduction
Have you ever been to a website that has some sort of gallery set up which seems to take forever to load? Maybe the server is just slow, or maybe the hapless web designer just used browser tags to resize the image rather than actually sending a smaller image. This is, of course, very stupid, and I will show you how to avoid this stupidity through the power of php.
php (which Word keeps wanting to auto capitalize) is a language designed around what its developer, Rasmus Lerdorf, calls ‘the web problem’. Although it can be run as an interpreted script like other scripting languages, it is designed first and foremost around dynamically generating HTML pages. Combined with a robust set of libraries and one of the best, most comprehensive programming manuals on the web, you can do some totally sweet stuff with it. Read the rest of this entry »
July 9, 2008
· Filed under Javascript · Tagged ajax, javascript, php
Your last task is to use the OnClick() event in the Albums list to return a list of Tracks on an Album.
Remeber this is a 2 part process.
Part 1: Define a a PHP function that search for an Array of Tracks using the Album Name.
Part 2: On the client side:
A: define a JS function that invokes the agent.call function and passes it the Album Name.
B: Define an Callback function that handles the response from the server-side PHP function and then binds it to an html control.
It’s very easy to do so you should give it a shot before peaking at the source code.
July 9, 2008
· Filed under Javascript · Tagged ajax, javascript, php
This next part is some very cool stuff. What we are going to do is select an item from the SelectBox which will return a list of Albums by the selected Artist. Since the list of Albums is being held in a server-side PHP Array getting the data back requires a round-trip to the server. In any normal case this is done in a Form Post which casues a page refresh but we are going to use Ajax to fire-off the server-side request for the data and avoid refreshing the page all together. The Get Albums task is made up of 2 parts: a server-side PHP function that searchs for the Albums and a client-side Ajax function that invokes the server-side function and hadles the response.The PHP function GetAlbumByArtist works like the GetArtist PHP function but instead of a regex we’ll just use a string comparison usiug the Artist Name. Read the rest of this entry »
July 9, 2008
· Filed under Javascript · Tagged ajax, php
Start by creating a new PHP page and placing the agent.php (Ajax Agent) file in the same directory. Open your new PHP page in an editor and start hacking away.
First create the HTML Form controls we will be using:
- txtArtists = TextBox to type the ArtistName in.
- matches = A SelectBox with an onclick event which will be used to send the ArtistName to the AlbumSearch method we will be creating.
- txtArtistID = Hidden to hold the selected ArtistName (js cannot see the select box because it is hidden?)
- htmlOutput = An empty DIV when we will be creating a list of Albums
- htmlOutputTracks = An empty DIV when we will be creating a list of Tracks
Read the rest of this entry »
July 1, 2008
· Filed under Javascript, Website · Tagged javascript, combo box
This is a 2-level combo box, both expanding the capacity of the combo and allowing you to organize the links into various categories. Awesome!
Insert the below into the <body> section of your page:
Read the rest of this entry »
July 1, 2008
· Filed under Javascript, Website
This simple script randomizes ths background color of your page each time it’s loaded. Specify any number of colors for the script to choose from
Read the rest of this entry »