Welcome Guest, Not a member yet? Register   Sign In
Screencast: The Advanced Form Handling Series
#31

[eluser]Sally D[/eluser]
nice work but I am having trouble watching the videos.

when I click the link it plays in the browser but there is no way to fast forward or pause

when I download it and try to play it with mplayer or vlc I get
home/user/My Documents/My Videos> mplayer afh_*.swf
MPlayer 1.0rc1-4.1.2-DFSG-free © 2000-2006 MPlayer Team
CPU: Intel® Atom™ CPU N270 @ 1.60GHz (Family: 6, Model: 28, Stepping: 2)
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing afh_ci_part_1.swf.
libavformat file format detected.
[swf @ 0x870a5e8]No media found in SWF
LAVF_header: av_open_input_stream() failed
libavformat file format detected.
[swf @ 0x870a5e8]No media found in SWF
LAVF_header: av_open_input_stream() failed


Exiting... (End of file)


please use OGM media wrapper instead of SWF cause OGG / OGM is more open and this is opensource sorftware after all so its only right to release your screencast with an opensource codec

great screencast though
#32

[eluser]@li[/eluser]
Nice screencast but your rule for the list price was saying 'require' instead of required upto the end lol :-P. But great screencast & very clean method. I was getting sick of all the $this->validation->{field} in my form's HTML.

Which IDE were you using? Eclipse? The formatting of the code looked fantastic.

I've also found that its cleaner to put the form display code in a seperate function, e.g:

Code:
<?php
Class Vehicle Extends Controller
{
    function index($form=false)
    {
        if (! $form)
            $form=$this->_vehicle_form();
        $form['values']=$_POST;
        $form['error']=$this->validation->error_string;
        
        $this->load->view('form',$form);
    }
    
    function save()
    {
        $this->load->library('validation');
        $form=$this->_vehicle_form();
        $this->validation->set_rules($form['rules']);
        $this->validation->set_fields($form['fields']);
        
        if (! $this->validation->run())
        {
            $this->index($form);
            return;
        }
        
        $this->vehicle->add($_POST);
        redirect('vehicles/browse');
    }
}

?>

Perhaps in your next screencast you can talk about how to use this method using checkboxes, dropdowns, etc.
#33

[eluser]Mirage[/eluser]
Colin -

Good stuff. Amazing how similar our approaches are... I feel vindicated... :-)

One thing I wanted to mention about where to put the form definition - I put them in a 'cfg_forms.php' config file. This helps me with reusability across sites and applications. The downside of course is that there is 'one more thing' to load to get at the data.

Keep it comin!

Cheers
-m
#34

[eluser]ray73864[/eluser]
[quote author="Sally D" date="1223755330"]nice work but I am having trouble watching the videos.

when I click the link it plays in the browser but there is no way to fast forward or pause

when I download it and try to play it with mplayer or vlc I get
home/user/My Documents/My Videos> mplayer afh_*.swf
MPlayer 1.0rc1-4.1.2-DFSG-free © 2000-2006 MPlayer Team
CPU: Intel® Atom™ CPU N270 @ 1.60GHz (Family: 6, Model: 28, Stepping: 2)
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing afh_ci_part_1.swf.
libavformat file format detected.
[swf @ 0x870a5e8]No media found in SWF
LAVF_header: av_open_input_stream() failed
libavformat file format detected.
[swf @ 0x870a5e8]No media found in SWF
LAVF_header: av_open_input_stream() failed


Exiting... (End of file)


please use OGM media wrapper instead of SWF cause OGG / OGM is more open and this is opensource sorftware after all so its only right to release your screencast with an opensource codec

great screencast though[/quote]

it rather depends on what file formats the screencast program that Colin is using supports, also, the swf file is not a media file per se in this context, the screencast application uses swf as a container for the media program which then links to a video clip stored somewhere else
#35

[eluser]Pascal Kriete[/eluser]
Safari plays it just fine, but an easy fix is to embed the swf. Example:
Code:
<html>
<head>
    <title>Flash Embed Example</title>
</head>
<body>    
    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
    WIDTH="550" HEIGHT="400" id="afh_ci_part_1"><PARAM NAME=movie VALUE="afh_ci_part_1.swf"><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="./afh_ci_part_1.swf" quality=high bgcolor=#FFFFFF WIDTH="100%" HEIGHT="100%"
    NAME="afh_ci_part_1" ALIGN="" TYPE="application/x-shockwave-flash"
    PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>
</body>

</html>

Very nice work here, Colin.
#36

[eluser]@li[/eluser]
To the person who posted this, do you mind sharing what syntax highlighting formatting are you using with your text editor? I'm really frustrated with what I have.
#37

[eluser]Colin Williams[/eluser]
Quote:Nice screencast but your rule for the list price was saying ‘require’ instead of required upto the end lol

Yeah, there were several blunders Smile

Quote:Which IDE were you using? Eclipse? The formatting of the code looked fantastic.

Yep. Just a no-frills install of Eclipse with the PHPclipse and Web development plugins.

Quote:I’ve also found that its cleaner to put the form display code in a seperate function

I don't immediately see any problems with that. Might be useful to abstract when we come to the editing part anyway.

Quote:One thing I wanted to mention about where to put the form definition - I put them in a ‘cfg_forms.php’ config file. This helps me with reusability across sites and applications. The downside of course is that there is ‘one more thing’ to load to get at the data.

I did this on an earlier project and found myself frustrated with having to go and sniff through a big config file just to update the form rules, fields etc. I always had to have this config file open in tandem with the controller and model, and it ultimately didn't serve the application to be abstracted like this. Form_validation library in CI 1.7 takes this approach, but given prior experience, I'm going to stick with defining forms in either the controller or model.

Quote:nice work but I am having trouble watching the videos.

when I click the link it plays in the browser but there is no way to fast forward or pause

My apologies for your frustration. I used a free screencasting product called Jing and it was just easier to upload and link off to the SWF files than have a page to embed each. I'm working on a dedicated site for my screencasts and purchased proper software for capturing the screen, so, just bear with me for now..

Quote:Perhaps in your next screencast you can talk about how to use this method using checkboxes, dropdowns, etc.

It wouldn't be Advanced Form Handling if we didn't cover all types of form fields, now would it? Smile Coming soon...

@everyone Thanks for the kind words. I'll have the code released soon and plan on finishing off this series. Then I think I'm going to put together a series called "Model Behavior" that will provide tips for writing lean and flexible models.
#38

[eluser]geshan[/eluser]
Very good tutorial.
#39

[eluser]TheoR74[/eluser]
what screencasting software are you planning on using?
#40

[eluser]Jesse Schutt[/eluser]
Terrific! Please keep this coming!




Theme © iAndrew 2016 - Forum software by © MyBB