Code for editing blocks

Permalink
Hi all,

I'm in the process of learning Concrete5, and i'm doing it with the help of Remo Laubacher's book.
Since i'm a frontend developer, i really don't know much Php, so i have a few questions.

I'm converting a Html/Css template into Concrete5 theme, and i'm following Remo's book. The book is overall good, but clearly lacks some concise explanations. For instance he includes typography.css file in the code example in the book, but never talks about it, or explains it, and it is very important file.(even his downloadable code doesn't have it.)

So in that vein, he is adding editable blocks, but never explains the code.
I understand that this code is for creating main editable area:
<?php
$b = new Area('Main');
$b->display($c);
?>

But then he creates a editable area for the sidebar with this code:
<?php
$as = new Area('Sidebar');
$as->display($c);
?>
and navigation with this:
$a = new Area('Header Nav');
$a->display($c)

My question is what is the difference with these three code blocks, i see that this is maybe some kind of constructor for area object, but please if someone could explain it.

Also if i would like to create a new editable area named Main 2, which code should i type to create it.

Sorry for the long question!!

Mirko

Madebym
 
JohntheFish replied on at Permalink Reply
JohntheFish
They are all effectively the same, but for 3 different areas. The only difference is he stores the area object in a differently named variable.
JohntheFish replied on at Permalink Reply
JohntheFish
PS. On 5.5.1, you would probably want to use

$a= new GlobalArea('Header Nav');
$a->display($c);


which makes the header nav global across all pages.
Madebym replied on at Permalink Reply
Madebym
Thanks for the quick reply, so if i would like to create new editable area this code would be ok:
<?php
$f = new Area('My Main');
$f->display($c);
?>

Thanks for the GlobalArea tip, i was adding menu to every page, since it was only displayed on Home page when i imported my theme.
Hopefully this will make it to appear on every page.

Just one last question, is it possible to have some content inside editable blocks when creating templates, so for example i want to have some content inside my Main area that i declared. I don't want it to be empty, i want it to be editable, but also i want it to have some content?
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
You can add new areas to a page type as you have suggested. If you may ever want to swap themes in the future, you need to stick to the usual area names (look in Greek Yogurt). These are case sensitive.

You also need to plan what different page types you need and whether they are truly different, or just variations that may best be settled with layouts later.

Have a look through the best ranked and newest CSS3 marketplace themes, see what areas and page types they have for ideas.

Also seehttp://www.concrete5.org/documentation/how-tos/designers/making-a-t... if you have not already.
Madebym replied on at Permalink Reply
Madebym
Thanks John for being so helpfull. Please if you could help me with two more questions;
1. I managed to incorporate navigation into my site using GlobalArea, and it works perfect. The thing that confuses me is that in the how-to that explains theme creation and in one theme i downloaded(rigid light-very nice theme) the navigation is created using this code:
$bt_main = BlockType::getByHandle('autonav');
$bt_main->controller->displayPages = 'top';
$bt_main->controller->orderBy = 'display_asc';                    
$bt_main->controller->displaySubPages = 'all';
$bt_main->controller->displaySubPageLevels = 'custom';      
$bt_main->controller->displaySubPageLevelsNum = '1'; 
$bt_main->render('templates/dropdown');


Please what is the difference, and which approach is better.
2. Let's say that i had created a web site for a client, which consists of 10 pages. I have created my theme, page templates and everything. Where do i insert initial content, so that the page is populated before handing it to client? By clicking on HTML in the tinyMCEditor or is there some other place to view the raw Html of the page?
JohntheFish replied on at Permalink Reply
JohntheFish
That was a theme developed before 5.5 and therefore before global areas were available. Many such themes have been updated to work with 5.5.1, but changing the nav to a global area when updating the theme would have resulted in an incompatibility for existing users of the theme. Some theme developers have used more complicated code to incorporate both methods and switch depending on the version of C5.

For content, use whatever blocks you want and just write it in. The content block is probably easiest for you to train your client to maintain text in.
Madebym replied on at Permalink Reply
Madebym
Ok, thanks!