Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##Guide holder
- <?php
- /**
- * Defines the ArticlePage page type
- */
- class GuideHolder extends Page {
- }
- class GuideHolder_Controller extends Page_Controller {
- function init() {
- parent::init();
- Requirements::javascript('patagonicas/javascript/facebox/facebox.js');
- Requirements::javascript('patagonicas/javascript/guides.js');
- }
- }
- ?>
- ##guides.js
- jQuery(document).ready(function($) {
- $('a[rel*=facebox]').facebox()
- })
- ##Guide Page
- <?php
- /**
- * Defines the GuidePage page type
- */
- class GuidePage extends Page {
- static $db = array(
- 'Certifications' =>"Enum('IFMGA/UIAGM,AMGA')",
- );
- static $has_one = array(
- 'Guide' => 'Image'
- );
- function getCMSFields() {
- $fields = parent::getCMSFields();
- $fields->addFieldToTab("Root.Content.Images", new ImageField('Guide'));
- $fields->addFieldToTab("Root.Content.Main", new CheckboxSetField ("Certifications","Select the guide's certifications",
- $this->dbObject('Certifications')->enumValues()),"Content");
- return $fields;
- }
- }
- class GuidePage_Controller extends Page_Controller {
- function getInfo(){
- if (Director::urlparam('ID')) {
- $Guide = DataObject::get_by_id("GuidePage",Director::urlparam('ID'));
- return $this->customise( array(
- 'Title' => $Guide->Title ."'s Profile",
- 'Content' => '' . $Guide->Content
- ))->renderWith("guide_getinfo");
- }
- }
- }
- ?>
- ##Guide_getinfo.ss
- <h2>$Title</h2>
- $Content
- ##guideholder
- <h2>$Title </h2>
- $Content
- <ul class="guides">
- <% control Children %>
- <li>
- <a rel="facebox" href="guides/getInfo/$ID/$URLSegment" title="$Title">
- <% if Guide %>
- <% control Guide %>
- <% control CroppedImage(150,200) %>
- <img src="$URL" title="$Title" alt="$Title" />
- <% end_control %>
- <% end_control %>
- <% end_if %>
- </a>
- </li>
- <% end_control %>
- </ul>
- ## _config.php
- Director::addRules(100, array('guides//$Action/$ID/$Title' => 'GuidePage_Controller'));
Add Comment
Please, Sign In to add comment