Collections
OverviewObjectiveLearn how add and retrieve information from a collection.Requirements Basics of ProdigyViewEstimated Tim...
Follow Along With Code           Example1. Download a copy of the example code at  www.prodigyview.com/source.2. Install t...
What Are CollectionsIn programming a collection resembles a container. Acontainer can be described as a class or data stru...
Collections Visual                                         Steak                            Apples                        ...
Creating A Collection Let’s start out by simply creating a collection and adding some data too it. Using the add() functio...
Adding Name Data     That was very straight forward. Now we are going to add     more information in, except this time we ...
Recalling InformationIf you haven’t caught on yet, we’ve been adding a famous1970 pop single. Now in our last slide we add...
Recalled Info  www.prodigyview.com
The IteratorSo we’ve added all this data to the collection and we canpull it out using the name/key if we know it. What ab...
The Iterator Says…Looping through the iterator should give you this:
Iterate ManuallyNow on some occasions we might want to have control ofthe iterator. Not a problem, lets move it up, down, ...
Iterate Manually ResultsThe output from iterating manually.                     www.prodigyview.com
The Not So Obvious1. PVCollections can take any object, array, or singular   value and add it the collection.2. The iterat...
Summary1. Using the add() function to added an item to the   collection.2. Use the addWithName() to add an item by it’s na...
API ReferenceFor a better understanding of the Collections and theIterator, check out the api at the two links below.PVCol...
Upcoming SlideShare
Loading in …5
×

How To Create Collections in PHP - ProdigyView

5,532 views

Published on

Learn how to create collections and store data in those collections.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,532
On SlideShare
0
From Embeds
0
Number of Embeds
33
Actions
Shares
0
Downloads
15
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

How To Create Collections in PHP - ProdigyView

  1. 1. Collections
  2. 2. OverviewObjectiveLearn how add and retrieve information from a collection.Requirements Basics of ProdigyViewEstimated Time8 minutes www.prodigyview.com
  3. 3. Follow Along With Code Example1. Download a copy of the example code at www.prodigyview.com/source.2. Install the system in an environment you feel comfortable testing in.3. Proceed to examples/design/Collections.php
  4. 4. What Are CollectionsIn programming a collection resembles a container. Acontainer can be described as a class or data structurethat is composed of instances of other objects and/orvariables.In other words, it’s a class designed for holding data of aspecific type or any type. Some collections may hold onlystrings while other collections may hold strings, doubles,and integers. In ProdigyView, collections store any type ofdata and can be ran through an iterator when needed. www.prodigyview.com
  5. 5. Collections Visual Steak Apples LettuceMy collections canhold anything! My Collections Box
  6. 6. Creating A Collection Let’s start out by simply creating a collection and adding some data too it. Using the add() function will add a value to the collection.Instantiate the collections objectAdd Values to the Collection
  7. 7. Adding Name Data That was very straight forward. Now we are going to add more information in, except this time we are going to define a key so we easily find the data later.Set the key that will be used to access the collection Set the value to be stored in the collection associated with the key
  8. 8. Recalling InformationIf you haven’t caught on yet, we’ve been adding a famous1970 pop single. Now in our last slide we added data witha key. Let’s get that data back using the key. Retrieve the value stored in the collection based on the key
  9. 9. Recalled Info www.prodigyview.com
  10. 10. The IteratorSo we’ve added all this data to the collection and we canpull it out using the name/key if we know it. What aboutdata that was added without a key using the addmethod? At this point we need to iterate through our datausing the built in iterator. Get the collection’s iteratorIterate through the collection
  11. 11. The Iterator Says…Looping through the iterator should give you this:
  12. 12. Iterate ManuallyNow on some occasions we might want to have control ofthe iterator. Not a problem, lets move it up, down, left andright as we please.
  13. 13. Iterate Manually ResultsThe output from iterating manually. www.prodigyview.com
  14. 14. The Not So Obvious1. PVCollections can take any object, array, or singular value and add it the collection.2. The iterator is actually a class called PVIterator which can be called to work on its own when needed.3. Every object that extends PVObject and PVStaticObject has a PVCollection. Using the magic functions __set() and __get() will put and retrieve information into that collection. www.prodigyview.com
  15. 15. Summary1. Using the add() function to added an item to the collection.2. Use the addWithName() to add an item by it’s name. Item can be retrieved by it’s name also.3. Use the getIterator() to retrieve the iterator and iterate through the data in the collection. www.prodigyview.com
  16. 16. API ReferenceFor a better understanding of the Collections and theIterator, check out the api at the two links below.PVCollectionsPVIterator More TutorialsFor more tutorials, please visit:http://www.prodigyview.com/tutorials www.prodigyview.com

×