Limiting input in "new Area" (within template)

Permalink 1 user found helpful
Hi all,

I've been looking around a while now to find a solution for the following issue:

Static HTML within my Template:
<div id="myDiv">
<h1>My Headline</h1>
<p>Some Content</p>
</div>



if I change this to:
<?php
    $a = new Area('H1');
    $a->display($c);
?>
</div>


That's not what I want!! Now the user can put in any content he wants, that might mess up the design etc. also a lot of clients will use more than one h1 on each page.

QUESTION:
HOW DO I LIMIT THE POSSIBLE INPUT (TYPE)??
For instance something like
<div id="myDiv">
<h1> <?php $a = new Area('H1'); $a->display($c); $type="textOnly";?> </h1>
<p> <?php $a = new Area('paragraph'); $a->display($c); $type="textOnly";?> </p>
</div>



Any advice is highly appreciated
Thanks in advance
Tom

miosdesign
 
Mainio replied on at Permalink Reply
Mainio
1. Enable advanced permissions:
http://www.concrete5.org/documentation/general-topics/simple-permis...

2. Limit blocks of that content area only to "Content", here's a video tutorial on that (not the specific case but you can see what you need to do):
http://www.concrete5.org/documentation/how-tos/editors/set-permissi...

If you want to limit the number of blocks your users can add to that area, just add this code in the template:
<?php
   $a = new Area('H1');
   // Addition start -->
   $a->setBlockLimit(5);
   // Addition end <--
   $a->display($c);
?>
</div>



Antti / Mainio
adajad replied on at Permalink Reply
adajad
You should also read this excellent how-to on making a theme: http://www.concrete5.org/documentation/how-tos/designers/making-a-t...
Mainio replied on at Permalink Best Answer Reply
Mainio
And if you want to create block types like "h1" and "paragraph" that allow you to do what you're trying to do, you should check out the Designer Content add-on:
http://www.concrete5.org/marketplace/addons/designer-content/...

With that you can pretty easily create pre-styled block types.

Antti / Mainio
miosdesign replied on at Permalink Reply
miosdesign
Thanx for your help guys:

The Designer Content Add-on does excactly what I wanted!