File Content Management


Published on

Learn how to manipulate file content of ProdigyView’s built-in content management system. Also learn how to upload a file directly into the cms.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

File Content Management

  1. 1. File Content Management
  2. 2. OverviewObjectiveLearn how to manipulate file content of ProdigyView’s built-incontent management system. Also learn how to upload a filedirectly into the cms.Requirements Installed version of ProdigyView with a database Understanding of base content Understanding of the DEFINES in ProdigyViewEstimated Time12 minutes
  3. 3. Follow Along With Code Example1. Download a copy of the example code at Install the system in an environment you feel comfortable testing in.3. Proceed to examples/content/FileContentWithFileExample.php
  4. 4. What Is File Content?File content is a generic way of storing information relatedto a file. Unlike video, audio and image content, file contentallows any kind of file to be specified.  Document System  Generic Uploaded Files  Versioning  Attachment Management  File Management  Etc
  5. 5. Extends Base ContentLike the other content types, file content extends basecontent. This means it has all the fields that base contenthas in addition to the fields that describes a file. File Content Fields Base Content Fields
  6. 6. Create File Content File content is relatively easy to create. In an array, passed defined fields into PVContent::createFileContent method. 1. Define the content that will be stored as file content3. Return content id 2. Pass the array to PVContent::createFileContent
  7. 7. Database ViewRemember that the files content utilizes both the basecontent and file content fields. This is accomplished byjoining two tables. Your two tables in the database shouldlook something like below. Base Content Database View File Content Database View
  8. 8. File Content FieldsThe previous slide only showed afew fields that can be set whendefining file content. Here is acomplete list of fields that apply onlyto the file content.
  9. 9. Creating A File with FileSimilar to creating normal file content, creating file content witha file is accomplished through setting arguments correctly. In theexample below, we are using a file from our file system. But itcan be set the same way using PHP’s $_FILES global. 1. Name of the file 2. The location the file currently resides 3. The size of the file 4. The type of file
  10. 10. Create File Content With a FileNow pass those arguments to thePVContent::createFileWithFile() method. The content id will bereturn and the image placed in your PV_FILE define folder.
  11. 11. Database ViewThe file will be uploaded will be placed in the PV_FILE folder anda reference link will be placed in the database. Your databaseshould look something like this: 1. Mime type 2. File size 3. Auto generated random file name for to reference
  12. 12. Search for File Content Using the syntax from the PV Standard Search Query, we can search for content related to files on fields for both base content and file content. 1. Search based on the passed arguments 2. Pass args into getFileContentList() method3. Returns an array of arrays thatcontains the list of file content
  13. 13. Iterate Through The ListNext we can iterate through the list of file content to seethe data we just added.1. Iterate through the fields base content 2. With the automatic joining of the tables, file content fields are also returned
  14. 14. Retrieving File ContentFile content can also be retrieved directly using thecontent id. The data associated with that content id willbe returned in array. 1. Pass in the content id2. Content is returned in an array3. Get the values of the array by specifyingthe associated index
  15. 15. Updating File ContentThat array contains the information for updating the file content.Simply change a value at an index in the array and pass it toPVContent::updateFileContent() method. Remember thecontent_id variable is required. 1. Update the data determining if the file is downloadable and the max downloads 2. Pass the array back to update
  16. 16. Deleting File ContentThe last action to take place is deleting the file content. Todelete content, we pass the content id intoPVContent::deleteContent method.All the content types(audio, video, event, etc) use thePVContent::deleteContent method. Associated fileswill be deleted also.
  17. 17. Review1. Create file content by passing an array of arguments into PVContent::createFileContent()2. PVContent::createFileContent() will return the id of the newly generated file content3. Search for file content by using the syntax from PV Standard Search Query and passing those arguments into PVContent::getFileContentList()4. Update content by passing an array of accepted fields in PVContent::updateFileContent(). The content_id must be present for this method to work.5. Delete file content by passing the content_id into PVContent::deleteContent().
  18. 18. API ReferenceFor a better understanding of file content, visit the api byclicking on the link below.PVContent More TutorialsFor more tutorials, please visit: