Ricks Custom Content plugin

Feed 6 posts, 2 voices

Aug 14, 2008 19:44
Avatar
351 posts

Here it is:

http://www.mediafire.com/?9cmlg9idjwy

It's very basic. To use it do something like this:

http://pastie.org/253325

Those are the only two methods supported: rccContent() and rccSort().

rccSort() can take either a string or one of the Frog date fields (created_on, etc.) so you can sort by date or field. If you created a Page Part called "Ingredients" for example, you can sort it by doing rccSort('Ingredients').

The method returns the sorted array (not pass by reference).

If you missed the other thread, this is for simulating different content types in Frog. You can do it by creating a Page Part to identify the content type. Create a part called "Recipes" for example, and then all pages with that part will be considered a Recipe content type and you can do:

$recipes = rccContent('Recipes');

and get an array of all the recipes in the database.

Beware of spaces in page Parts...

 
Aug 14, 2008 19:58
Avatar
351 posts

i created another method rccPrepare() which casts the arrays into objects and also adds a link attribute to make it easier to build urls.

so now you can do something like this: http://pastie.org/253335

 
Aug 14, 2008 20:04
Avatar
351 posts

The new version:

http://www.mediafire.com/?t9tmz1zrlh1

 
Aug 14, 2008 20:18
Avatar
351 posts

Okay i made another change. Now you can do this:

http://pastie.org/253348

And it will return an array of sorted objects. So to use it:

$shops = rccContent('shop','Name',$this);

Do something like that. The first argument is the name of the content type, the second is the name of the field to sort by and $this is used for creating the page link so that you can do $shop->link to get a url.

 
Aug 14, 2008 20:28
Avatar
351 posts

The link for the new version:

http://www.mediafire.com/?0lx2xgwjemy

 
Aug 15, 2008 16:02
Avatar
458 posts

question: why do you use page parts and not tags?

 
Aug 15, 2008 17:00
Avatar
351 posts

i used a page part to identify the content type because the part inherits. i'm not very familiar with tags in frog, but i think they don't inherit