Custom File Type creation


(Rhulse) #21

[quote]This URL should be recommended again. There is a tutorial there for building your own asset type which introduces you to the concept of assets, screens and installation. I highly recommend going through that tutorial before trying to build your own assets. All our developers start with it.
[right][post=“15548”]<{POST_SNAPBACK}>[/post][/right][/quote]

I though the tutorial was good.



I also found the Matrix at a glance and the Matrix at a glance helpful.



Can I suggest that someone do a diagram of the all the bits that can make up an asset to show their relationship with each other and the system?


(Andrei Railean) #22

Just a quickie: If you don't see the changes to your asset after running step3/compile_locale you should bump the version in the asset.xml


If it's 0.2 make it 0.3 and so on.



This could help in some cases, not all.


(Rayn Ong) #23

Can I ask how do you do that?

(Nic Hubbard) #24

I agree with Richard, this would be an excellent idea, and would help getting our minds around how assets work.

[quote][quote]I have been making changes in the command line to the asset[/quote]

Can I ask how do you do that?[/quote]

I was just using the command line, and editing the files in vi. It is just easier for me that way. Is there some other way that is better?

(Nic Hubbard) #25

Anyone find it odd that when I run step_03 it looks like this where my video_file asset is:

    52 => inbox 
    53 => user 
    54 => backend_user 
    55 => file 
    56 => video_file 
    
    
    
    57 => text_file 
    58 => pdf_file 
    59 => word_doc 
    60 => image


Strange that there is a giant space below it, does not do that for other assets...maybe that is normal.

(Greg Sherwood) #26

That is strange.


Maybe you have whitespace before the open PHP tag or after the closing tag in one or more of your files. When they are included, that whitespace turns to output, which could cause those newline characters to be printed.


(Avi Miller) #27

[quote]I was just using the command line, and editing the files in vi.  It is just easier for me that way.  Is there some other way that is better?
[right][post=“15562”]<{POST_SNAPBACK}>[/post][/right][/quote]



I think it was just confusion on how your statement was worded. It sounded like you were making changes to the command line that calls your asset, not editing the code of your asset from the command line. :slight_smile:



And as Greg says, whitespace can be a killer – make sure there is no whitespace before your first <?php tag and after your last ?> tag.


(Nic Hubbard) #28

Ha, well I gave up for now. Squiz is creating some custom assets for me.


(Rhulse) #29

[quote]Ha, well I gave up for now.  Squiz is creating some custom assets for me.
[right][post=“15589”]<{POST_SNAPBACK}>[/post][/right][/quote]



Rats! I have just about got my Video asset working…


(Rhulse) #30

[quote]Ha, well I gave up for now.  Squiz is creating some custom assets for me.
[right][post=“15589”]<{POST_SNAPBACK}>[/post][/right][/quote]

And it occurred to me yesterday that all you needed to do was extend the (say) news item (use the tutorial) as that has an option to link to another asset. Upload the video as a file, link it to the new video asset (which is really just a shell on top of the news asset) and viola!



We have a couple of assets that are ‘shells’ - used to differentiate between them and other assets - which is just what you want to do.



cheers,

Richard


(Avi Miller) #31

[quote]And it occurred to me yesterday that all you needed to do was extend the (say) news item (use the tutorial) as that has an option to link to another asset. Upload the video as a file, link it to the new video asset (which is really just a shell on top of the news asset) and viola!
[right][post=“15591”]<{POST_SNAPBACK}>[/post][/right][/quote]



I don’t think this is easier/simpler than just extending File to create Video_File. You’re creating a two asset nest, which means that listing Videos becomes more difficult, because you’re actually listing one asset that links to another. You’re also creating two assets when only one is required.



Creating a Video_File asset that extends File is very simple, because it doesn’t need to do anything. It would be cooler if the Video asset could embed a YouTube-style player so that you could just nest it into content. That would take longer, I suspect. :slight_smile:


(Rhulse) #32

[quote]I don’t think this is easier/simpler than just extending File to create Video_File. You’re creating a two asset nest, which means that listing Videos becomes more difficult, because you’re actually listing one asset that links to another. You’re also creating two assets when only one is required.


Creating a Video_File asset that extends File is very simple, because it doesn’t need to do anything. It would be cooler if the Video asset could embed a YouTube-style player so that you could just nest it into content. That would take longer, I suspect. :slight_smile:

[right][post=“15592”]<{POST_SNAPBACK}>[/post][/right][/quote]



Quite true, now that I think about it, and quite simple to implement. :smiley: