mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
remove tabs
This commit is contained in:
parent
5d6b7c85d7
commit
50c8a02bff
@ -15,10 +15,11 @@ If you can log-in to the CMS as an administrator, append `?isDev=1` to any URL t
|
||||
"dev mode". If you can't log-in in the first place because of the error, add this directive to your `mysite/_config/config.yml`
|
||||
(don't forget to remove it afterwards!):
|
||||
|
||||
:::php
|
||||
```yml
|
||||
Director:
|
||||
# temporary debugging statement
|
||||
environment_type: 'dev'
|
||||
```
|
||||
|
||||
<div class="warning" markdown='1'>
|
||||
On "live" environments, the `?isDev=1` solution is preferred, as it means that your other visitors don't see ugly
|
||||
|
@ -289,7 +289,7 @@ First, the template for displaying a single article:
|
||||
**themes/simple/templates/Layout/ArticlePage.ss**
|
||||
|
||||
|
||||
:::ss
|
||||
```ss
|
||||
<% include SideBar %>
|
||||
<div class="content-container unit size3of4 lastUnit">
|
||||
<article>
|
||||
@ -301,7 +301,7 @@ First, the template for displaying a single article:
|
||||
</article>
|
||||
$Form
|
||||
</div>
|
||||
|
||||
```
|
||||
|
||||
Most of the code is just like the regular Page.ss, we include an informational div with the date and the author of the Article.
|
||||
|
||||
@ -322,7 +322,7 @@ We'll now create a template for the article holder. We want our news section to
|
||||
|
||||
**themes/simple/templates/Layout/ArticleHolder.ss**
|
||||
|
||||
:::ss
|
||||
```ss
|
||||
<% include SideBar %>
|
||||
<div class="content-container unit size3of4 lastUnit">
|
||||
<article>
|
||||
@ -339,7 +339,7 @@ We'll now create a template for the article holder. We want our news section to
|
||||
<% end_loop %>
|
||||
$Form
|
||||
</div>
|
||||
|
||||
```
|
||||
|
||||
Here we use the page control *Children*. As the name suggests, this control allows you to iterate over the children of a page. In this case, the children are our news articles. The *$Link* variable will give the address of the article which we can use to create a link, and the *FirstParagraph* function of the [DBHTMLText](api:SilverStripe\ORM\FieldType\DBHTMLText) field gives us a nice summary of the article. The function strips all tags from the paragraph extracted.
|
||||
|
||||
@ -356,38 +356,39 @@ Cut the code between "loop Children" in *ArticleHolder.ss** and replace it with
|
||||
|
||||
**themes/simple/templates/Layout/ArticleHolder.ss**
|
||||
|
||||
:::ss
|
||||
```ss
|
||||
...
|
||||
<% loop $Children %>
|
||||
<% include ArticleTeaser %>
|
||||
<% end_loop %>
|
||||
...
|
||||
|
||||
```
|
||||
Paste the code that was in ArticleHolder into a new include file called ArticleTeaser.ss:
|
||||
|
||||
**themes/simple/templates/Includes/ArticleTeaser.ss**
|
||||
|
||||
:::ss
|
||||
```ss
|
||||
<article>
|
||||
<h2><a href="$Link" title="Read more on "{$Title}"">$Title</a></h2>
|
||||
<p>$Content.FirstParagraph</p>
|
||||
<a href="$Link" title="Read more on "{$Title}"">Read more >></a>
|
||||
</article>
|
||||
```
|
||||
|
||||
### Changing the icons of pages in the CMS
|
||||
|
||||
Now let's make a purely cosmetic change that nevertheless helps to make the information presented in the CMS clearer.
|
||||
Add the following field to the *ArticleHolder* and *ArticlePage* classes:
|
||||
|
||||
:::php
|
||||
```php
|
||||
private static $icon = "cms/images/treeicons/news-file.gif";
|
||||
|
||||
```
|
||||
|
||||
And this one to the *HomePage* class:
|
||||
|
||||
:::php
|
||||
```php
|
||||
private static $icon = "cms/images/treeicons/home-file.png";
|
||||
|
||||
```
|
||||
|
||||
This will change the icons for the pages in the CMS.
|
||||
|
||||
|
@ -191,14 +191,14 @@ named.
|
||||
|
||||
If you're using the default scaffolded form fields with multiple `has_one` relationships, you will end up with a CMS field for each relation. If you don't want these you can remove them by their IDs:
|
||||
|
||||
:::php
|
||||
```php
|
||||
public function getCMSFields()
|
||||
{
|
||||
$fields = parent::getCMSFields();
|
||||
$fields->removeByName(array('ManagerID', 'CleanerID'));
|
||||
return $fields;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## belongs_to
|
||||
|
||||
|
@ -16,11 +16,11 @@ name in the `mysite/templates/email` folder or in the `themes/your_theme/templat
|
||||
|
||||
**mysite/templates/email/GenericEmail.ss**
|
||||
|
||||
:::ss
|
||||
```ss
|
||||
$Body
|
||||
|
||||
<p>Thanks from Bob's Fantasy Football League.</p>
|
||||
|
||||
```
|
||||
All emails going out of our application will have the footer `Thanks from Bob's Fantasy Football Leaguee` added.
|
||||
|
||||
<div class="alert" markdown="1">
|
||||
|
@ -7,7 +7,7 @@ top level menu with a nested second level using the `Menu` loop and a `Children`
|
||||
|
||||
**mysite/templates/Page.ss**
|
||||
|
||||
:::ss
|
||||
```ss
|
||||
<ul>
|
||||
<% loop $Menu(1) %>
|
||||
<li>
|
||||
@ -27,7 +27,7 @@ top level menu with a nested second level using the `Menu` loop and a `Children`
|
||||
</li>
|
||||
<% end_loop %>
|
||||
</ul>
|
||||
|
||||
```
|
||||
## Related
|
||||
|
||||
* [Template Syntax](../syntax)
|
||||
|
@ -10,7 +10,7 @@ The `PaginatedList` will automatically set up query limits and read the request
|
||||
|
||||
**mysite/code/Page.php**
|
||||
|
||||
:::php
|
||||
```php
|
||||
/**
|
||||
* Returns a paginated list of all pages in the site.
|
||||
*/
|
||||
@ -20,6 +20,7 @@ The `PaginatedList` will automatically set up query limits and read the request
|
||||
|
||||
return new PaginatedList($list, $this->getRequest());
|
||||
}
|
||||
```
|
||||
|
||||
<div class="notice" markdown="1">
|
||||
Note that the concept of "pages" used in pagination does not necessarily mean that we're dealing with `Page` classes,
|
||||
@ -33,19 +34,19 @@ The first step is to simply list the objects in the template:
|
||||
|
||||
**mysite/templates/Page.ss**
|
||||
|
||||
:::ss
|
||||
```ss
|
||||
<ul>
|
||||
<% loop $PaginatedPages %>
|
||||
<li><a href="$Link">$Title</a></li>
|
||||
<% end_loop %>
|
||||
</ul>
|
||||
|
||||
```
|
||||
By default this will display 10 pages at a time. The next step is to add pagination controls below this so the user can
|
||||
switch between pages:
|
||||
|
||||
**mysite/templates/Page.ss**
|
||||
|
||||
:::ss
|
||||
```ss
|
||||
<% if $PaginatedPages.MoreThanOnePage %>
|
||||
<% if $PaginatedPages.NotFirstPage %>
|
||||
<a class="prev" href="$PaginatedPages.PrevLink">Prev</a>
|
||||
@ -65,6 +66,7 @@ switch between pages:
|
||||
<a class="next" href="$PaginatedPages.NextLink">Next</a>
|
||||
<% end_if %>
|
||||
<% end_if %>
|
||||
```
|
||||
|
||||
If there is more than one page, this block will render a set of pagination controls in the form
|
||||
`[1] ... [3] [4] [5] [6] [7] ... [10]`.
|
||||
@ -76,18 +78,19 @@ that you wish to display on the current page. In this situation the automatic li
|
||||
will break the pagination. You can disable automatic limiting using the [PaginatedList::setLimitItems()](api:SilverStripe\ORM\PaginatedList::setLimitItems()) method
|
||||
when using custom lists.
|
||||
|
||||
:::php
|
||||
```php
|
||||
$myPreLimitedList = Page::get()->limit(10);
|
||||
|
||||
$pages = new PaginatedList($myPreLimitedList, $this->getRequest());
|
||||
$pages->setLimitItems(false);
|
||||
|
||||
```
|
||||
|
||||
## Setting the limit of items
|
||||
|
||||
:::php
|
||||
```php
|
||||
$pages = new PaginatedList(Page::get(), $this->getRequest());
|
||||
$pages->setPageLength(25);
|
||||
```
|
||||
|
||||
If you set this limit to 0 it will disable paging entirely, effectively causing it to appear as a single page
|
||||
list.
|
||||
|
@ -5,12 +5,12 @@ title: Disable Anchor Rewriting
|
||||
Anchor links are links with a "#" in them. A frequent use-case is to use anchor links to point to different sections of
|
||||
the current page. For example, we might have this in our template:
|
||||
|
||||
:::ss
|
||||
```ss
|
||||
<ul>
|
||||
<li><a href="#section1">Section 1</a></li>
|
||||
<li><a href="#section2">Section 2</a></li>
|
||||
</ul>
|
||||
|
||||
```
|
||||
|
||||
Things get tricky because of we have set our `<base>` tag to point to the root of the site. So, when you click the
|
||||
first link you will be sent to http://yoursite.com/#section1 instead of http://yoursite.com/my-long-page/#section1
|
||||
@ -19,24 +19,27 @@ In order to prevent this situation, the SSViewer template renderer will automati
|
||||
doesn't specify a URL before the anchor, prefixing the URL of the current page. For our example above, the following
|
||||
would be created in the final HTML
|
||||
|
||||
:::ss
|
||||
```ss
|
||||
<ul>
|
||||
<li><a href="my-long-page/#section1">Section 1</a></li>
|
||||
<li><a href="my-long-page/#section2">Section 2</a></li>
|
||||
</ul>
|
||||
|
||||
```
|
||||
|
||||
There are cases where this can be unhelpful. HTML anchors created from Ajax responses are the most common. In these
|
||||
situations, you can disable anchor link rewriting by setting the `SSViewer.rewrite_hash_links` configuration value to
|
||||
`false`.
|
||||
|
||||
**mysite/_config/app.yml**
|
||||
|
||||
```yml
|
||||
SSViewer:
|
||||
rewrite_hash_links: false
|
||||
```
|
||||
|
||||
Or, a better way is to call this just for the rendering phase of this particular file:
|
||||
|
||||
:::php
|
||||
```php
|
||||
public function RenderCustomTemplate()
|
||||
{
|
||||
Config::inst()->update('SSViewer', 'rewrite_hash_links', false);
|
||||
@ -45,3 +48,4 @@ Or, a better way is to call this just for the rendering phase of this particular
|
||||
|
||||
return $html;
|
||||
}
|
||||
```
|
@ -17,7 +17,7 @@ bottle-necks and identify slow moving parts of your application chain.
|
||||
|
||||
The [Debug](api:SilverStripe\Dev\Debug) class contains a number of static utility methods for more advanced debugging.
|
||||
|
||||
:::php
|
||||
```php
|
||||
Debug::show($myVariable);
|
||||
// similar to print_r($myVariable) but shows it in a more useful format.
|
||||
|
||||
@ -26,6 +26,7 @@ The [Debug](api:SilverStripe\Dev\Debug) class contains a number of static utilit
|
||||
|
||||
Backtrace::backtrace();
|
||||
// prints a calls-stack
|
||||
```
|
||||
|
||||
## API Documentation
|
||||
|
||||
|
@ -406,8 +406,9 @@ in a single Ajax request.
|
||||
<a href="{$AdminURL}myadmin" class="cms-panel-link" data-pjax-target="MyRecordInfo,Breadcrumbs">
|
||||
Update record info
|
||||
</a>
|
||||
```
|
||||
|
||||
:::ss
|
||||
```ss
|
||||
// MyRecordInfo.ss
|
||||
<div data-pjax-fragment="MyRecordInfo">
|
||||
Current Record: $currentPage.Title
|
||||
@ -415,12 +416,14 @@ in a single Ajax request.
|
||||
```
|
||||
|
||||
A click on the link will cause the following (abbreviated) ajax HTTP request:
|
||||
|
||||
```
|
||||
GET /admin/myadmin HTTP/1.1
|
||||
X-Pjax:MyRecordInfo,Breadcrumbs
|
||||
X-Requested-With:XMLHttpRequest
|
||||
```
|
||||
... and result in the following response:
|
||||
|
||||
```
|
||||
{"MyRecordInfo": "<div...", "CMSBreadcrumbs": "<div..."}
|
||||
```
|
||||
|
@ -114,19 +114,19 @@ specifies "these are arguments to the controller".
|
||||
|
||||
In other words, change this:
|
||||
|
||||
:::php
|
||||
```php
|
||||
Director::addRules(50, array(
|
||||
'admin/ImageEditor/$Action' => 'ImageEditor',
|
||||
));
|
||||
|
||||
```
|
||||
|
||||
To this:
|
||||
|
||||
:::php
|
||||
```php
|
||||
Director::addRules(50, array(
|
||||
'admin/ImageEditor//$Action' => 'ImageEditor',
|
||||
));
|
||||
|
||||
```
|
||||
|
||||
|
||||
### Decorators
|
||||
@ -213,8 +213,9 @@ In most cases this won't have any effect on existing forms, although you might g
|
||||
like Validator.js and behaviour.js. If you want to disable JavaScript validation across forms, add the following to your
|
||||
_config.php:
|
||||
|
||||
:::php
|
||||
```php
|
||||
Validator::set_javascript_validation_handler('none');
|
||||
```
|
||||
|
||||
See http://open.silverstripe.com/changeset/69688
|
||||
|
||||
|
@ -73,7 +73,7 @@ can access them. In particular the following static variables have been changed
|
||||
Because of this, you will need to change the static definitions in your ModelAdmin subclasses. For example, you should
|
||||
change this:
|
||||
|
||||
:::php
|
||||
```php
|
||||
class MyCatalogAdmin extends ModelAdmin
|
||||
{
|
||||
|
||||
@ -84,11 +84,11 @@ change this:
|
||||
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
To this:
|
||||
|
||||
:::php
|
||||
```php
|
||||
class MyCatalogAdmin extends ModelAdmin
|
||||
{
|
||||
|
||||
@ -99,7 +99,7 @@ To this:
|
||||
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
#### Deprecated Translatable::enable()
|
||||
|
@ -129,9 +129,9 @@ post](http://www.silverstripe.org/preview-of-silverstripe-2-4-hierarchical-urls-
|
||||
You can enable it manually for existing websites. Existing URLs will automatically change to the nested format without
|
||||
republication (your old URLs should redirect automatically).
|
||||
|
||||
:::php
|
||||
```php
|
||||
SiteTree::enable_nested_urls();
|
||||
|
||||
```
|
||||
|
||||
### SiteTree->Link() instead of SiteTree->URLSegment
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user