One-pager create new sections

Permalink
Hi all,

I am trying to create a single page website in Concrete5 5.7 and am working on a way for the client to be able to create new page
<section></section>
with editable areas in each.

I think using C5's select page attribute with "allow user to add values" selected will give me the best outcome.

I am trying to work out how to pull each value added to the select attribute and create a new section for each.

I understand foreach is required for this however my php skills are quite weak.

If someone out there could offer a little help with foreach'ing' the values of a page attribute (select) I think I can make it create new sections and name them individually, hopefully even automatically create the nav for each section.

Any help would be greatly appreciated.

 
MrKDilkington replied on at Permalink Best Answer Reply 4 Attachments
MrKDilkington
Hi mobius2000,

You could try something like this:
$sections = $c->getAttribute('sections');
if ($sections) {
    foreach ($sections as $section) {
        $a = new Area("$section");
        $a->enableGridContainer();
        $a->display($c);
    }
}

The order of the select values on the attribute page will be the order of the areas. The select values ordering can be changed by dragging values up or down.

I have attached screenshots to help describe this.
mobius2000 replied on at Permalink Reply
Genius... Thank you very much for a great solution MrKDilkington.