The Artima Developer Community
Sponsored Link

PHP Buzz Forum
Detail templates for Content Types

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Forum One

Posts: 118
Nickname: forumone
Registered: Sep, 2004

Forum One is consulting firm specializing in helping non-profits improve their online presence.
Detail templates for Content Types Posted: Oct 26, 2004 11:42 PM
Reply to this message Reply

This post originated from an RSS feed registered with PHP Buzz by Forum One.
Original Post: Detail templates for Content Types
Feed Title: Syntax Framework
Feed URL: http://blog.syntaxcms.org/rss.php?version=0.91
Feed Description: Finally, a place to answer Syntax questions
Latest PHP Buzz Posts
Latest PHP Buzz Posts by Forum One
Latest Posts From Syntax Framework

Advertisement

Detail pages display a particular record on a site. If you have datatype specific modules, you might be tempted to have a detail.php capability within it - usually by just copying the detail.php file from the general module. Unless you'll be implementing a lot of custom code on the detail page, say to hook in to a third party shopping cart app, you're probably safer just re-using the general detail script.

Let's assume you have Press Releases to display and have put the related code in modules/press_release. Your user.conf.php file would have at least the following lines to register the module:

// The Abstract Documents Module
Modules::addModule('press_release', 'Press Releases');	
Modules::setAttribute('press_release', 'content_label', 'Press Release');	
Modules::setAttribute('press_release', 'datatype', array(  DATATYPE_DOCUMENT ));
Modules::setAttribute('press_release', 'public_exposure', true);
Moduels::setCapability('press_release', 'list' );

By NOT specifying a detail capability above, Syntax will route requests to /content/press_releases/detail/444 through modules/general/detail.php. This gains you a few things:

  • Fetching the record is done using collections, so that record privileges will be checked and enforced. If a record is restricted to a specific group or user, then it will only be displayed to them.
  • Will check if the datatype is in the exposed content datatypes list.
  • Breadcrumb to the detail page will be automatically built depending on if user's came to the page from a section or another module.
  • Less time coding or copying this code and one less file to manage.

Detail.php is smart enough to look for a custom detail.tpl file to use to display the matching record. It will look in the first module that works with the specified datatype. So, in this case it would look for modules/press_release/templates/detail.tpl and use that file if it exists. In your custom template, you have to use the $Record variable to get information out for display.

Read: Detail templates for Content Types

Topic: ONLamp.com: Allowing Registration-Required Binary Downloads Previous Topic   Next Topic Topic: Figlet driver for Text_CAPTCHA

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use