The pages module includes the following functions. You can use these in templates as well as layouts (though they are used primarily in the templates: //projects_list.html// and //projects_view.html//). All functions //return// values and //never echo// them, so that further operations can be made by themers/plugins/etc.
**projectContent( [int $id / string $slug] )**
returns //HTML//
Use this function inside of the //projects_view.html// template to display the project's files. It sorts all the files into their respective groups and orders files, groups and textblocks according to how the user has ordered them in the back-end. Required JavaScript, CSS, etc for the various display types is automatically included by the system.
**projectView()**
returns //HTML//
Use this function in the //layout_projects.php// layout to display a project. Internally, it calls projects() with the following options line: //show= big, id= [$project_id]//. This in turn includes the //projects_view.html// template, which, in most cases, will contain a call to projectContent().
**projectList()**
returns //HTML//
This function is a useful theme function to automatically generate an HTML list of all projects. If the "Hide Section Titles" option is not on, then projects are divided for each section.
Sample list (note the 'active' class, which is automatically appended for CSS styling):
-
-
Print
-
Poster
-
Business Card
// Sample project array
array(
'id' => 3,
'title' => 'Around the Corner',
'slug' => 'around-the-corner',
'date' => 543456000,
'section' => 2,
'pos' => 3,
'flow' => 'group1:one-by-one,textblock2,group2:pop',
'thumbnail' => 'aroundthecorner.project.jpg',
'publish' => 1
)
**projectThumbnail()**
returns //HTML//
Generates an IMG tag of the project thumbnail, to be used in templates, complete with width and height attributes. If there is no thumbnail attached to the project, the function returns:
[project title]
**getProjectFiles()**
returns //array//
Returns an array of all the files (including text blocks) from the selected project. Retrieved from the database. Can be used both templates and layouts.
// Sample project files array
array(
'27' => array(
'id' => 23,
'title' => 'Shadowplay',
'caption' => 'The dance of shadows as the sun crawls out from beneath the darkness.',
'file' => 'shadowplay.jpg',
'thumbnail' => 'shadowplay.thumb.jpg',
'width' => '600',
'height' => '800',
'project_id' => 3,
'pos' => 1
'type' => 'image',
'filegroup' => 2
)
)
//Example usage in projects_list.html
competition, environmentally friendly, awards
**projectTagsArray()**
returns //array//
Similar to projectTags(), but this function instead returns an array of the project's tags, so you can loop through it and do your own formatting/magic.
array(
0 => 'competition',
1 => 'environmentally-friendly',
2 => 'awards'
)
**currentProjectTags()**
returns //HTML//
Same as projectTags(), except it returns the selected tags. If the user has clicked a tag link and is now viewing the URL www.domain.com/projects/tags/awards, this function will return HTML containing a link to the 'awards' tag. This is useful if you wish to display a list of "currently viewing tags". Note that tags can be stacked, like so: www.domain.com/projects/tags/awards,competition,environmentally-friendly
**currentProjectTagsArray()**
returns //array//
Same as currentProjectTags(), but instead returns an array for your own magic-doing, in the same format as projectTagsArray().
**allProjectTags()**
returns //HTML//
Same as projectTags(), but returns **all tags** in the database, for a tag cloud-esque list.
**allProjectTagsArray()**
Same as projectTagsArray(), but returns **all tags** in the database. Useful for creating your own tag cloud functions.