Skip to content
This repository
Browse code

Fixed cms extension docs to remove zzz_admin workaround

No longer required due to fixes to TemplateManifest
  • Loading branch information...
commit b8c656b565bdf19dead1105126e755846c6056b0 1 parent 683db8d
Ingo Schommer authored December 04, 2012

Showing 1 changed file with 11 additions and 24 deletions. Show diff stats Hide diff stats

  1. 35  docs/en/howto/extend-cms-interface.md
35  docs/en/howto/extend-cms-interface.md
Source Rendered
@@ -13,28 +13,15 @@ guide on [CMS Architecture](../reference/cms-architecture).
13 13
 
14 14
 ## Overload a CMS template ##
15 15
 
16  
-First of all, create a new folder structure in your SilverStripe webroot, which will
17  
-form our module for this example. 
18  
-	
19  
-	cms/
20  
-	framework/
21  
-	zzz_admin/
22  
-		_config.php
23  
-		code/
24  
-		css/
25  
-		admin/
26  
-			templates/
27  
-				
28  
-Note: The `zzz_` prefix and `admin/` subfolder are only a temporary measure necessary to ensure our templates
29  
-are included *after* the original CMS templates. At the moment, you can't use the `mysite/` folder
30  
-to achieve the same result.
  16
+If you place a template with an identical name into your application template directory
  17
+(usually `mysite/templates/`), it'll take priority over the built-in one.
31 18
 
32 19
 CMS templates are inherited based on their controllers, similar to subclasses of
33 20
 the common `Page` object (a new PHP class `MyPage` will look for a `MyPage.ss` template).
34 21
 We can use this to create a different base template with `LeftAndMain.ss`
35 22
 (which corresponds to the `LeftAndMain` PHP controller class).
36 23
 
37  
-Copy the template markup of the base implementation at `framework/admin/templates/LeftAndMain.ss` into `zzz_admin/admin/templates/LeftAndMain.ss`. It will automatically be picked up by the CMS logic. Add a new section after the `$Content` tag:
  24
+Copy the template markup of the base implementation at `framework/admin/templates/LeftAndMain.ss` into `mysite/templates/LeftAndMain.ss`. It will automatically be picked up by the CMS logic. Add a new section after the `$Content` tag:
38 25
 	
39 26
 	:::ss
40 27
 	...
@@ -62,7 +49,7 @@ allows us to build complex layouts with minimal JavaScript configuration.
62 49
 ## Include custom CSS in the CMS
63 50
 
64 51
 In order to show the links in one line, we'll add some CSS, and get it to load with the CMS interface.
65  
-Paste the following content into a new file called `zzz_admin/css/BookmarkedPages.css`:
  52
+Paste the following content into a new file called `mysite/css/BookmarkedPages.css`:
66 53
 
67 54
 	:::css
68 55
 	.cms-bottom-bar {height: 20px; padding: 5px; background: #C6D7DF;}
@@ -70,17 +57,17 @@ Paste the following content into a new file called `zzz_admin/css/BookmarkedPage
70 57
 	.cms-bottom-bar ul li {float: left; margin-left: 1em;}
71 58
 	.cms-bottom-bar a {color: #444444;}
72 59
 
73  
-Load the new CSS file into the CMS, by adding the following line to `zzz_admin/_config.php`:
  60
+Load the new CSS file into the CMS, by adding the following line to `mysite/_config.php`:
74 61
 
75 62
 	:::php
76 63
 	<?php
77  
-	LeftAndMain::require_css('zzz_admin/css/BookmarkedPages.css');
  64
+	LeftAndMain::require_css('mysite/css/BookmarkedPages.css');
78 65
 
79 66
 ## Create a "bookmark" flag on pages ##
80 67
 
81 68
 Now we'll define which pages are actually bookmarked, a flag that is stored in the database.
82 69
 For this we need to decorate the page record with a `DataExtension`.
83  
-Create a new file called `zzz_admin/code/BookmarkedPageExtension.php` and insert the following code.
  70
+Create a new file called `mysite/code/BookmarkedPageExtension.php` and insert the following code.
84 71
 
85 72
 	:::php
86 73
 	<?php
@@ -94,7 +81,7 @@ Create a new file called `zzz_admin/code/BookmarkedPageExtension.php` and insert
94 81
 		}
95 82
 	}
96 83
 
97  
-Enable the extension with the following line in `zzz_mysite/_config.php`:
  84
+Enable the extension with the following line in `mysite/_config.php`:
98 85
 
99 86
 	:::php
100 87
 	SiteTree::add_extension('BookmarkedPageExtension');
@@ -108,7 +95,7 @@ One piece in the puzzle is still missing: How do we get the list of bookmarked
108 95
 pages from the datbase into the template we've already created (with hardcoded links)? 
109 96
 Again, we extend a core class: The main CMS controller called `LeftAndMain`.
110 97
 
111  
-Add the following code to a new file `zzz_admin/code/BookmarkedLeftAndMainExtension.php`;
  98
+Add the following code to a new file `mysite/code/BookmarkedLeftAndMainExtension.php`;
112 99
 
113 100
 	:::php
114 101
 	<?php
@@ -118,13 +105,13 @@ Add the following code to a new file `zzz_admin/code/BookmarkedLeftAndMainExtens
118 105
 		}
119 106
 	}
120 107
 	
121  
-Enable the extension with the following line in `zzz_mysite/_config.php`:
  108
+Enable the extension with the following line in `mysite/_config.php`:
122 109
 
123 110
 	:::php
124 111
 	LeftAndMain::add_extension('BookmarkedPagesLeftAndMainExtension');
125 112
 
126 113
 As the last step, replace the hardcoded links with our list from the database.
127  
-Find the `<ul>` you created earlier in `zzz_admin/admin/templates/LeftAndMain.ss`
  114
+Find the `<ul>` you created earlier in `mysite/admin/templates/LeftAndMain.ss`
128 115
 and replace it with the following:
129 116
 
130 117
 	:::ss

0 notes on commit b8c656b

Please sign in to comment.
Something went wrong with that request. Please try again.