web developing
9 Jun
Actually I couldn’t mange to make it work with a non-javascript approach, but however with the .js help it works. I’ll paste here this code, hopefully this will help.
Note that you’ve to change plugins/javascripts/videos/captions path!
<html> <body> <div id="player" style="width:480px;height:360px"></div> <script src="Flowplayer.Captions/flowplayer-3.2.2.min.js"></script> <script> $f("player", "Flowplayer.Captions/flowplayer-3.1.5.swf", { clip : { url : "Flowplayer.Captions/bach.flv", captionUrl : 'Flowplayer.Captions/bachen.srt' }, plugins: { captions: { url: 'Flowplayer.Captions/flowplayer.captions-3.2.1.swf', captionTarget: 'content' }, content: { url : 'Flowplayer.Captions/flowplayer.content-3.2.0.swf', bottom: 5, height: 50, backgroundColor: 'transparent', backgroundGradient: 'none', border: 0, textDecoration: 'outline', style: { body: { fontSize: 15, fontFamily: 'Arial', textAlign: 'center', color: '#ffffff' } } }, controls: { url : 'Flowplayer.Captions/flowplayer.controls-3.1.5.swf' } } }); setTimeout(function() { $f('player').getPlugin('captions').loadCaptions(0, 'Flowplayer.Captions/bachbg.srt'); }, 3000); </script> </body> </html>
6 Jun
It seems there is a strange problem with Zend_Feed and an entry pubDate property?!
I’ve added the very minimum of properties for a feed entry – title, pubDate, link and description, but the resulting date is … the current date instead of the date specified in the pubDate property? Is there any way to fix it?
4 Jun
I’ve the impression that even it’s a simple technique it remains quite misunderstood!
You’ve a simple HTML form with several groups of form elements. Imagine the situation with title and link groups. You can have 1, 2 or more title/link pairs which you’d like to save in a database table, where perhaps there are only three columns – id, title, link.
In fact the task can be done by many ways, but there’s one really elegant solution. As it appears in many occasions PHP and HTML are born to work together!
Create your web form by simply modifying a bit the element names. Usually when you have an input you simply name it after the database column or something similar.
<form method="POST"> <input type="text" name="db_column_name" /> </form>
In reality PHP and HTML allows the name to be an array element, just like so:
<form method="POST"> <input type="text" name="link[0][title]" /> <input type="text" name="link[0][url]" /> <input type="text" name="link[1][title]" /> <input type="text" name="link[1][url]" /> </form>
Than all this comes in the _POST array in PHP, but formatted in an array manner, so you can simply foreach it!
<?php foreach ($_POST['link'] as $link) { insert_into_db($link['title'], $link['url']); } ?>
That is simply enough!
24 May
Continuing from my post about PHP arrays coding style and following the comments of that post, I’d like to write a bit about JavaScript objects’ coding style.
You perhaps know that the term object is quite undefined or under estimated in the JavaScript world, but I’d speak about the key/value pairs in JS commonly formatted like that:
var obj = { key : 'value' }
Here you can add more and more key/value pairs, but what’s different from the PHP associative arrays and what’s the same and should be cosidered.
I wrote about the alignment in PHP and hashes. Than I showed how I align them:
$arr = array( 'short' => 'val', 'longkey' => 'val' );
In JavaScript you should use the same technique of alignment:
var obj = { 'short' : 'val', 'longkey' : 'val' };
Yes, there are more differences, which is normal. First of all you don’t have the => notation in JavaScript and a : is used. Second and most important you cannot add a trailing comma after the last key/value pair. Note that in PHP that’s fine!
// that will throw an error in MSIE var obj = { 'short' : 'val', 'longkey' : 'val', };
while this is OK in PHP and it’s encouraged:
$arr = array( 'short' => 'val', 'longkey' => 'val', );
23 May
There are so many posts about that topic out there, but I’d like to be rather breve! The delegate() method comes with the last major version of the jQuery – 1.4 and it gives a context to the event. So please use delegate() instead of live(), just because not everything’s attached to the document element, but to the selected object.