Fixed markdown whitespace usage

This commit is contained in:
Ingo Schommer 2012-10-02 11:38:16 +02:00
parent fe4f0c92e2
commit 4684601c38
9 changed files with 20 additions and 32 deletions

View File

@ -117,7 +117,7 @@ sorted by month name from January to December. This can be accomplshed by sortin
class Page extends SiteTree { class Page extends SiteTree {
// ... // ...
/** /**
* Returns all news items, sorted by the month they were posted * Returns all news items, sorted by the month they were posted
* @return GroupedList * @return GroupedList

View File

@ -30,7 +30,6 @@ The basic .htaccess file after installing SilverStripe look like this:
RewriteRule .* framework/main.php?url=%1&%{QUERY_STRING} [L] RewriteRule .* framework/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule> </IfModule>
### SILVERSTRIPE END ### ### SILVERSTRIPE END ###
</file> </file>
The `<Files>` section denies direct access to the template files from anywhere but the server itself. The `<Files>` section denies direct access to the template files from anywhere but the server itself.

View File

@ -61,7 +61,7 @@ The subsequent call returns the SAME object as the first call.
// set by the injector on object creation // set by the injector on object creation
public $permissions; public $permissions;
public $textProperty; public $textProperty;
static $dependencies = array( static $dependencies = array(
'textProperty' => 'a string value', 'textProperty' => 'a string value',
'permissions' => '%$PermissionService', 'permissions' => '%$PermissionService',
@ -123,11 +123,11 @@ Assuming a class structure such as
$this->database = $d; $this->database = $d;
} }
} }
class MySQLDatabase { class MySQLDatabase {
private $username; private $username;
private $password; private $password;
public function __construct($username, $password) { public function __construct($username, $password) {
$this->username = $username; $this->username = $username;
$this->password = $password; $this->password = $password;

View File

@ -34,7 +34,6 @@ Returns the full *Member* Object for the current user, returns *null* if user is
} }
## Subclassing ## Subclassing
<div class="warning" markdown="1"> <div class="warning" markdown="1">

View File

@ -49,7 +49,7 @@ RestfulService (see [flickrservice](http://silverstripe.org/flickr-module/) and
$peopleXML = $service->connect('/people'); $peopleXML = $service->connect('/people');
$people = $service->getValues($peopleXML, 'user'); $people = $service->getValues($peopleXML, 'user');
... // ...
$taskXML = $service->connect('/tasks'); $taskXML = $service->connect('/tasks');
$tasks = $service->getValues($taskXML, 'task'); $tasks = $service->getValues($taskXML, 'task');
@ -117,16 +117,13 @@ If the web service returned an error (for example, API key not available or inad
could delgate the error handling to it's descendant class. To handle the errors define a function called errorCatch could delgate the error handling to it's descendant class. To handle the errors define a function called errorCatch
:::php :::php
/* // This will raise Youtube API specific error messages (if any).
This will raise Youtube API specific error messages (if any).
*/
public function errorCatch($response){ public function errorCatch($response){
$err_msg = $response; $err_msg = $response;
if(strpos($err_msg, '<') === false) if(strpos($err_msg, '<') === false) {
//user_error("YouTube Service Error : $err_msg", E_USER_ERROR); user_error("YouTube Service Error : $err_msg", E_USER_ERROR);
user_error("YouTube Service Error : $err_msg", E_USER_ERROR); }
else
return $response; return $response;
} }

View File

@ -31,13 +31,13 @@ CustomSideReport.php
<?php <?php
class CustomSideReport_NameOfReport extends SideReport { class CustomSideReport_NameOfReport extends SideReport {
public function title() { public function title() {
// the name of our report // the name of our report
} }
public function records() { public function records() {
// what we want the report to return and what order // what we want the report to return and what order
} }
public function fieldsToShow() { public function fieldsToShow() {
// which fields on that object do we want to show? Title, Author? // which fields on that object do we want to show? Title, Author?
} }
} }
?> ?>
@ -52,23 +52,22 @@ CustomSideReport.php
:::php :::php
<?php <?php
/** /**
* This report lists all the pages in the CMS * This report lists all the pages in the CMS
* of type Page. Sorted by title. * of type Page. Sorted by title.
*/ */
class CustomSideReport_AllPages extends SideReport { class CustomSideReport_AllPages extends SideReport {
public function title() { public function title() {
// this is the title of the report // this is the title of the report
return "All Pages"; return "All Pages";
} }
public function records() { public function records() {
// the data the report returns all the dataobjects of type Page and sorted by title. See datamodel for more info // the data the report returns all the dataobjects of type Page and sorted by title. See datamodel for more info
return Page::get()->sort("Title"); return Page::get()->sort("Title");
} }
public function fieldsToShow() { public function fieldsToShow() {
// fields you want to display. This will display a list of titles which link to the page in the cms. Handy! // fields you want to display. This will display a list of titles which link to the page in the cms. Handy!
return array( return array(
"Title" => array("NestedTitle", array("2")), "Title" => array("NestedTitle", array("2")),
); );

View File

@ -21,7 +21,7 @@ Here is a very simple template:
<header> <header>
<h1>Bob's Chicken Shack</h1> <h1>Bob's Chicken Shack</h1>
</header> </header>
<% with $CurrentMember %> <% with $CurrentMember %>
<p>Welcome $FirstName $Surname.</p> <p>Welcome $FirstName $Surname.</p>
<% end_with %> <% end_with %>

View File

@ -276,7 +276,6 @@ For example:
:::php :::php
// Without an alias // Without an alias
$members = Member::get()->leftJoin("Group_Members", "\"Group_Members\".\"MemberID\" = \"Member\".\"ID\""); $members = Member::get()->leftJoin("Group_Members", "\"Group_Members\".\"MemberID\" = \"Member\".\"ID\"");
$members = Member::get()->innerJoin("Group_Members", "\"Rel\".\"MemberID\" = \"Member\".\"ID\"", "REl"); $members = Member::get()->innerJoin("Group_Members", "\"Rel\".\"MemberID\" = \"Member\".\"ID\"", "REl");
Passing a *$join* statement to DataObject::get will filter results further by the JOINs performed against the foreign Passing a *$join* statement to DataObject::get will filter results further by the JOINs performed against the foreign

View File

@ -193,7 +193,6 @@ the date field will have the date format defined by your locale.
:::php :::php
<?php <?php
class ArticlePage extends Page { class ArticlePage extends Page {
// ..... // .....
@ -356,12 +355,11 @@ It would be nice to greet page visitors with a summary of the latest news when t
**mysite/code/HomePage.php** **mysite/code/HomePage.php**
:::php :::php
... // ...
public function LatestNews($num=5) { public function LatestNews($num=5) {
$holder = ArticleHolder::get()->First(); $holder = ArticleHolder::get()->First();
return ($holder) ? ArticlePage::get()->filter('ParentID', $holder->ID)->sort('Date DESC')->limit($num) : false; return ($holder) ? ArticlePage::get()->filter('ParentID', $holder->ID)->sort('Date DESC')->limit($num) : false;
} }
...
This function simply runs a database query that gets the latest news articles from the database. By default, this is five, but you can change it by passing a number to the function. See the [Data Model](../topics/datamodel) documentation for details. We can reference this function as a page control in our *HomePage* template: This function simply runs a database query that gets the latest news articles from the database. By default, this is five, but you can change it by passing a number to the function. See the [Data Model](../topics/datamodel) documentation for details. We can reference this function as a page control in our *HomePage* template:
@ -369,13 +367,12 @@ This function simply runs a database query that gets the latest news articles fr
**themes/simple/templates/Layout/Homepage.ss** **themes/simple/templates/Layout/Homepage.ss**
:::ss :::ss
... <!-- ... -->
<div class="content">$Content</div> <div class="content">$Content</div>
</article> </article>
<% loop LatestNews %> <% loop LatestNews %>
<% include ArticleTeaser %> <% include ArticleTeaser %>
<% end_loop %> <% end_loop %>
...
When SilverStripe comes across a variable or page control it doesn't recognize, it first passes control to the controller. If the controller doesn't have a function for the variable or page control, it then passes control to the data object. If it has no matching functions, it then searches its database fields. Failing that it will return nothing. When SilverStripe comes across a variable or page control it doesn't recognize, it first passes control to the controller. If the controller doesn't have a function for the variable or page control, it then passes control to the data object. If it has no matching functions, it then searches its database fields. Failing that it will return nothing.
@ -444,7 +441,6 @@ Nothing here should be new. The *StaffPage* page type is more interesting though
:::php :::php
<?php <?php
class StaffPage extends Page { class StaffPage extends Page {
static $db = array( static $db = array(
); );
@ -462,7 +458,6 @@ Nothing here should be new. The *StaffPage* page type is more interesting though
} }
class StaffPage_Controller extends Page_Controller { class StaffPage_Controller extends Page_Controller {
} }