Tools ProdigyView

13
Tools

description

Learn how to use the miscellaneous tools in ProdigyView.

Transcript of Tools ProdigyView

Page 1: Tools ProdigyView

Tools

Page 2: Tools ProdigyView

OverivewObjective

Learn how to use the toolkit in ProdigyView.

Requirements

Installed version of ProdigyView

Estimated Time

5 minutes

http://www.prodigyview.com

Page 3: Tools ProdigyView

Follow Along With A Code Example

1. 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/util/Tools.php

http://www.prodigyview.com

Page 4: Tools ProdigyView

What Are Tools?PVTools consist of methods that serve a purpose but do not relate directly to one class. The tools we will be covering are:

Generating a random string

Truncating text

Forming a uri

Searching an array

Page 5: Tools ProdigyView

Random GeneratorThere have been numerous instances where a random string of characters is needed to be created. Examples range from unique ids to coupon redemption codes. PVTools::generateRandomString will set both the length of the random string and the characters that make up that string.

Length of string Characters in string

Random result

Page 6: Tools ProdigyView

Truncate TextTruncate was designed for blog sites to easy truncate their preview text and add trailing makers. The method will also strip html tags in the string.

1. String to truncate 2. Length of to truncate string to

3. Trailing text

4, Result

Page 7: Tools ProdigyView

Current URL

Retrieving the url is one of the request that is needed often. Using this method can retrieve the current url with all the necessary information such as the port number.

Example Result

http://www.example.com/a/path/to/follow

Page 8: Tools ProdigyView

Current Base URLCurrent base url will return the beginning part of the url that contains the protocol, subdomain and the domain.

Example Result

http://www.example.com

Page 9: Tools ProdigyView

Url with ParametersForming a perfect query string in a uri can be accomplished with formUriParameters. The result will be a query string of parameters that can be attached to any url.

1. Parameters to form the url

2. Pass the parameters from the method

Page 10: Tools ProdigyView

URL PathUsing the same variables, we can form a path that can be placed on the back of a url.

Page 11: Tools ProdigyView

Search Array RecursivelyThe last function in the tools class we are going to review is the array search. This function can find a value in an array at any depth in the array. The value(s) to find can either be passed in an array or string.

1. Values to find 2. Array to search

Page 12: Tools ProdigyView

Review1. PVTools::generateRandomString() creates a

random generic in which the length and characters can be specified.

2. PVTools::truncateText() can shorting a string of text, add trailing text, and remove html tags.

3. PVTools::getCurrentUrl() will retrieve the whole current url while PVTools::getCurrentBaseUrl() will only get the protocol, host name and server name.

4. PVTools::formUriParameters() and PVTools::formUriPath() are used for creating query strings.

5. PVTools::arraySearchRecursive() searches an array for a value.

Page 13: Tools ProdigyView

www.prodigyview.com

More Tutorials

For more tutorials, please visit:

http://www.prodigyview.com/tutorials