[TYPO3-mvc] Updated BlogExample

Bastian Waidelich bastian at typo3.org
Tue Feb 15 19:45:22 CET 2011


Hi,

I've just pushed a first version of an overhauled blog_example extension 
to Gerrit. It is not yet merged with the Git repository, but you can 
already test and comment the changes.

And that's how:

1. If not done already, check out a fresh version of the blog_example 
from Git

To do so, open your Git Bash, point it to your extension directory and 
enter following commands (line by line, followed by <enter>):

git clone --recursive 
git://git.typo3.org/TYPO3v4/CoreProjects/MVC/blog_example.git blog_example
cd blog_example

In order to be able to push changes to Gerrit, you'll have to install a 
commit hook and define the so called "pushurl".
You can also do that from the Git Bash (make sure to replace <USERNAME> 
with your typo3.org username):

scp -p -P 29418 <USERNAME>@review.typo3.org:hooks/commit-msg .git/hooks/
git config remote.origin.pushurl 
ssh://<USERNAME>@review.typo3.org:29418/TYPO3v4/CoreProjects/MVC/blog_example.git
git config remote.origin.push HEAD:refs/for/master

2. Create a local branch:

Whenever you want to make changes to your local working copy or if you 
plan to apply a patch, you should first create a local branch.
That's easy:

git branch dev
git checkout dev

(of course you can name it anything you want)

3. Apply changeset from Gerrit:

Point your browser to the Gerrit changeset at 
https://review.typo3.org/#change,807
Don't be put off by the HTTP authentication - it will accept your 
typo3.org credentials!

Below the latest patch set (currently "Patch Set 2") click the "pull" 
link and copy the git command from the input field below.

Currently that is:

git pull git://git.typo3.org/TYPO3v4/CoreProjects/MVC/blog_example 
refs/changes/07/807/2

Note: Usually I use the "cherry-pick" command, but in this case that 
couldn't deal with the changed case of filenames ("index.html" -> 
"Index.html")


4. Install/Configure the extension (if not already done):

Install the extension in the Extension Manager and decide, whether you 
want to register a single, fully fledged plugin that contains all 
actions or if the extension should be split up into four plugins.
(Usually you probably wouldn't provide an option like this, but it 
demonstrates the independence of page ids in your Fluid template. In 
this case I'd suggest to split up the extension)

Don't forget to include the static TypoScript template "BlogExample 
setup" ;)

With this version there is another TS template "BlogExample CSS Styles" 
that you can include optionally. The provided CSS tweaks the output by 
adding some nice icons, BE-like rendering of FlashMessages and much 
more. I tested it with the introduction package.

In the Constant Editor you have some new options for PLUGIN.TX_BLOGEXAMPLE
I suggest, that you at least set the "Default storage PID" to a 
Sysfolder that should contain your blogs and posts.
A new option is "Editor FE Usergroup uid". With that you can define the 
usergroup that should be allowed to add/modify/delete blogs and posts in 
the FE. for others those links will be hidden to demonstrate the usage 
of the security ViewHelpers (Note: The administrative actions are not 
yet protected in the controller, so you could still call them if you 
know the URL).

Insert the plugin(s). If you decided to split up the extension into 
multiple plugins, you should create a page for each of the plugins. Only 
the page containing the "BlogList" plugin should be visible in the menu.

Last but not least you should check the caching setup.
If you installed the single plugin and store blogs & posts on the same 
page as the plugin, you don't have to do anything. Extbase automatically 
clears the cache of the page as soon as something has been changed.
Otherwise you should edit the page properties of the SysFolder that 
contains your blogs & posts and add following line to the Page TSConfig 
field:
TCEMAIN.clearCacheCmd = 1,2,3,4

Where 1,2,3,4 should be replaced by the page uids of the pages that 
contain your plugin(s).


happy testing
Bastian


More information about the TYPO3-project-typo3v4mvc mailing list