Forum

Thread tagged as: Question

Set the select item as the title for a region

I have a template set up that uses

<section class="content <perch:content label="Background color for Section" id="class" type="select" options="dark_section, light_section, darkgrey_section, black_section" title="true"/>">
content here using blocks
</section>

I have set up a template that allows for 6 areas of content on the page

<?php perch_content('Content1'); ?>
<?php perch_content('Content2'); ?>
<?php perch_content('Content3'); ?>
<?php perch_content('Content4'); ?>
 etc ...

In the control panel if they use a section, it shows in the panel as Content1, Content2 respectively. If they don't use all 6 content areas, they just delete the ones not in use for that page.

My question is, how do I get a more descriptive title for each section? IE - Content 1, Black Section or simply Black Section, Light Section.

I added the title attribute to the select dropdown, but that didn't work.

Kim Mazzola

Kim Mazzola 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is each region set to allow multiple items?

Each region is not set to allow multiple items. Each region has a template that includes several blocks. The user can choose 2 columns, 3 columns, 4 columns, etc. But they are not set up for multiple items using your checkbox.

Each content region will use the same template so that they can create several "sections" on a page. I hope this answers your question clearly enough.

Simon Clay

Simon Clay 127 points

I would have thought that if they delete 'Content2', 'Content3', or 'Content4' they will come back once the page is reloaded in the browser.

I would try to use 1 Content region, and allow it to be 'multiple'.

Simon,

I tried that, however it didn't seem to work as I'd like it too. I need each region to have it's own background color soI'm achieving this with a select on the section. And allowing "multiple" became quite confusing to see where you were on a page with all the options available to the end user.

Since the template uses blocks it just became massive to try to look at the page content.

Simon Clay

Simon Clay 127 points

Hi, I understand. I think I have a similar scenario to you on one of my sites:

multiple regions

So, tell me, you have a template set to allow multiple and then you set the editing to "not edit in one page", is that correct? Then please, tell me how you got the content names and section background color listed? Did you do some work in php?

Because if you did, that leaves me out. I don't know php that well.

Simon Clay

Simon Clay 127 points

That's right, the template is set to allow multiple and 'not edit on one page'.

In the 'Region options' you can set what you want to be shown in the columns by adding the IDs in the 'Item list column IDs' field. Its very useful, you can even show images here. No need for php code :)

In my template, I have a title field that the editor can enter the title for the section, which can serve as a heading or just title to help with the listing

<perch:if exists="heading AND !hide_heading"><h2><perch:content id="heading" type="text" label="Section Title" title="true" order="1" /></h2></perch:if>
        <perch:content id="hide_heading" type="checkbox" label="Hide Heading" value="1" order="2" suppress="true" divider-before="Section options" />

Thank you. Still so much to learn, I see. This is my first site. I'm trying to set templates up so that I can reuse them on all my sites without having to re-do everything. This looks like a great solution. I didn't know about the suppress and hide features. Thank you again. I'll what I can do. WARING … I may be back. :-)

Simon Clay

Simon Clay 127 points

That's great Kim :)