Skip to content

Commit

Permalink
Changes flush and build URLs for tutorials.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwelsh committed Oct 23, 2012
1 parent 1b1f645 commit 29c2fec
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions docs/en/tutorials/1-building-a-basic-site.md
Expand Up @@ -145,8 +145,8 @@ or placed between SilverStripe template tags:

**Flushing the cache**

Whenever we edit a template file, we need to append *?flush=all* onto the end of the URL, e.g.
http://localhost/your_site_name/?flush=all. SilverStripe stores template files in a cache for quicker load times. Whenever there are
Whenever we edit a template file, we need to append *?flush=1* onto the end of the URL, e.g.
http://localhost/your_site_name/?flush=1. SilverStripe stores template files in a cache for quicker load times. Whenever there are
changes to the template, we must flush the cache in order for the changes to take effect.

## The Navigation System
Expand Down Expand Up @@ -343,7 +343,7 @@ Create a new file *HomePage.php* in *mysite/code*. Copy the following code into


Every page type also has a database table corresponding to it. Every time we modify the database, we need to rebuild it.
We can do this by going to [http://localhost/your_site_name/dev/build?flush=all](http://localhost/your_site_name/dev/build?flush=1) (replace *localhost/your_site_name* with your own domain name if applicable).
We can do this by going to [http://localhost/your_site_name/dev/build](http://localhost/your_site_name/dev/build) (replace *localhost/your_site_name* with your own domain name if applicable).

It may take a moment, so be patient. This add tables and fields needed by your site, and modifies any structures that have changed. It
does this non-destructively - it will never delete your data.
Expand All @@ -366,7 +366,7 @@ It always tries to use the most specific template in an inheritance chain.

### Creating a new template

To create a new template layout, create a copy of *Page.ss* (found in *themes/simple/templates/Layout*) and call it *HomePage.ss*. If we flush the cache (*?flush=all*), SilverStripe should now be using *HomePage.ss* for the homepage, and *Page.ss* for the rest of the site. Now let's customize the *HomePage* template.
To create a new template layout, create a copy of *Page.ss* (found in *themes/simple/templates/Layout*) and call it *HomePage.ss*. If we flush the cache (*?flush=1*), SilverStripe should now be using *HomePage.ss* for the homepage, and *Page.ss* for the rest of the site. Now let's customize the *HomePage* template.

First, we don't need the breadcrumbs and the secondary menu for the homepage. Let's remove them:
:::ss
Expand Down
6 changes: 3 additions & 3 deletions docs/en/tutorials/2-extending-a-basic-site.md
Expand Up @@ -90,7 +90,7 @@ to be children of the page in the site tree. As we only want **news articles** i

We will be introduced to other fields like this as we progress; there is a full list in the documentation for `[api:SiteTree]`.

Now that we have created our page types, we need to let SilverStripe rebuild the database: [http://localhost/your_site_name/dev/build?flush=all](http://localhost/your_site_name/dev/build?flush=all). SilverStripe should detect that there are two new page types, and add them to the list of page types in the database.
Now that we have created our page types, we need to let SilverStripe rebuild the database: [http://localhost/your_site_name/dev/build](http://localhost/your_site_name/dev/build). SilverStripe should detect that there are two new page types, and add them to the list of page types in the database.

<div class="hint" markdown="1">
It is SilverStripe convention to suffix general page types with "Page", and page types that hold other page types with
Expand Down Expand Up @@ -177,7 +177,7 @@ There are many more fields available in the default installation, listed in ["fo
return $fields;


Finally, we return the fields to the CMS. If we flush the cache (by adding ?flush=all at the end of the URL), we will be able to edit the fields in the CMS.
Finally, we return the fields to the CMS. If we flush the cache (by adding ?flush=1 at the end of the URL), we will be able to edit the fields in the CMS.

Now that we have created our page types, let's add some content. Go into the CMS and create an *ArticleHolder* page named "News", then create a few *ArticlePage*'s within it.

Expand Down Expand Up @@ -469,7 +469,7 @@ the CMS.

![](_images/tutorial2_photo.jpg)

Rebuild the database ([http://localhost/your_site_name/dev/build?flush=1](http://localhost/your_site_name/dev/build?flush=1)) and open the CMS. Create
Rebuild the database ([http://localhost/your_site_name/dev/build](http://localhost/your_site_name/dev/build)) and open the CMS. Create
a new *StaffHolder* called "Staff", and create some *StaffPage*s in it.

![](_images/tutorial2_create-staff.jpg)
Expand Down
6 changes: 3 additions & 3 deletions docs/en/tutorials/3-forms.md
Expand Up @@ -156,7 +156,7 @@ Add the following code to the existing `form.css` file:
}


All going according to plan, if you visit [http://localhost/your_site_name/home?flush=all](http://localhost/your_site_name/home?flush=all) it should look something like this:
All going according to plan, if you visit [http://localhost/your_site_name/home?flush=1](http://localhost/your_site_name/home?flush=1) it should look something like this:

![](_images/tutorial3_pollform.jpg)

Expand All @@ -179,7 +179,7 @@ If you recall, in the [second tutorial](2-extending-a-basic-site) we said that a
);
}

If we then rebuild the database ([http://localhost/your_site_name/dev/build?flush=all](http://localhost/your_site_name/dev/build?flush=all)), we will see that the *BrowserPollSubmission* table is created. Now we just need to define 'doBrowserPoll' on *HomePage_Controller*:
If we then rebuild the database ([http://localhost/your_site_name/dev/build](http://localhost/your_site_name/dev/build)), we will see that the *BrowserPollSubmission* table is created. Now we just need to define 'doBrowserPoll' on *HomePage_Controller*:

**mysite/code/HomePage.php**

Expand Down Expand Up @@ -349,4 +349,4 @@ We use the normal tactic of putting the data into an unordered list and using CS

In this tutorial we have explored custom php forms, and displayed result sets through Grouped Lists. We have briefly covered the different approaches to creating and using forms. Whether you decide to use the [userforms module](http://silverstripe.org/user-forms-module) or create a form in PHP depends on the situation and flexibility required.

[Next Tutorial >>](4-site-search)
[Next Tutorial >>](4-site-search)
4 changes: 2 additions & 2 deletions docs/en/tutorials/4-site-search.md
Expand Up @@ -18,7 +18,7 @@ This will enable fulltext search on page content as well as names of all files i
:::php
FulltextSearchable::enable();

After including that in your `_config.php` you will need to rebuild the database by visiting [http://localhost/your_site_name/home?flush=all](http://localhost/your_site_name/home?flush=all) in your web browser (replace localhost/your_site_name with a domain if applicable). This will add fulltext search columns.
After including that in your `_config.php` you will need to rebuild the database by visiting [http://localhost/your_site_name/dev/build](http://localhost/your_site_name/dev/build) in your web browser (replace localhost/your_site_name with a domain if applicable). This will add fulltext search columns.

The actual search form code is already provided in FulltextSearchable so when you add the enable line above to your `_config.php` you can add your form as `$SearchForm`.

Expand Down Expand Up @@ -146,7 +146,7 @@ class.
<% end_if %>
</div>

Then finally add ?flush=all to the URL and you should see the new template.
Then finally add ?flush=1 to the URL and you should see the new template.


![](_images/tutorial4_search.jpg)
Expand Down
6 changes: 3 additions & 3 deletions docs/en/tutorials/5-dataobject-relationship-management.md
Expand Up @@ -72,7 +72,7 @@ we don't need to define any additional ones for our purposes.

Now that we have our models defined in PHP code,
we need to tell the database to create the related tables.
Trigger a rebuild through *dev/build?flush=all* before you
Trigger a rebuild through *dev/build* before you
proceed to the next part of this tutorial.

### Organizing pages: ProjectHolder
Expand Down Expand Up @@ -318,7 +318,7 @@ a named list of object.

Navigate to the holder page through your website navigation,
or the "Preview" feature in the CMS. You should see a list of all projects now.
Add `?flush=all` to the page URL to force a refresh of the template cache.
Add `?flush=1` to the page URL to force a refresh of the template cache.

To get a list of all projects, we've looped through the "Children" list,
which is a relationship we didn't define explictly.
Expand Down Expand Up @@ -419,4 +419,4 @@ we suggest some excercises to make the solution more flexible:
and avoid any duplication between the two subclasses.
* Render mentor details in their own template
* Change the `GridField` to list only five records per page (the default is 20).
This configuration is stored in the `[api:GridFieldPaginator]` component
This configuration is stored in the `[api:GridFieldPaginator]` component

5 comments on commit 29c2fec

@adrexia
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why?

@simonwelsh
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most places ?flush=all is overkill, now that includes have the same filemtime() check, so slows things down for no real reason. When used in dev/build, it gave the false impression that templates would be flushed as well (no SSViewer, so they're not).

Then search tutorial had a link to home?flush=all for enabling search where it needs to be dev/build to get the table type changed to MyISM and the indexes added.

@adrexia
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It was really just the change from flush=all to flush=1 that I was questioning. In the past using flush=1 could have tripped up new users, as they would assume it had flushed all templates, rather than just the one they were on. Does the filemtime() check fix that?

@hafriedlander
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could easily have changed with the new include system in 3, but the mtime check used to not work when includes had changed.

@simonwelsh
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't work in 2.4 because includes were copied directly into the main template, so the check only happened on the main template. Now that they're rendered individually again, it works. I've certainly had a lot fewer "gah, forgot to flush" moments when working in includes, since now they're all manifest related too.

Please sign in to comment.