Custom properies

Permalink
Hi,

I am looking of a way I can put a form into the properties area of a template so as to list multiple items.

For example:
ON each page i want the following fields in the properties,
Title
Image
URL
Content

so code an area into my template like so
<?php $file = $c->getAttribute("project_image");
if (is_object($file)) {
$im = Loader::helper('image');
$im->output($file);} ?>
<?php if (is_object($image)) {$im->output($image);}?>
<?php echo $c->getAttribute('project_title')?>
<a href="mailto:<?php echo $c->getAttribute('project_url')?>"><?php echo $c->getAttribute('project_url')?></a>
<?php echo $c->getAttribute('project_comment')?>


but how could I code it so that instead of putting 4 attributes into the properties I had one that you pressed add and it added the 4 fields.

The in my template cycle through the 4 fields for every instance listed.

Hopefully that make sense.

Ultimately I would like
Title 1
Image 1
URL 1
Content 1

Title 2
Image 2
URL 2
Content 2

etc...

appearing in my template.

TMDesigns
 
ScottSandbakken replied on at Permalink Reply
ScottSandbakken
Without really understanding what you are trying to accomplish, you could try creating a select property called "Form" and list all the form options, then load the appropriate form using a case statement in the template file.

$formProp = Page::getCurrentPage()->getAttribute('form');
switch ($formProp) {
   case 'form1':
      // form1 html here...
      break;
   case 'form2':
      // form2 html here...
      break;
}
TMDesigns replied on at Permalink Reply
TMDesigns
Thanks, but what I am trying to achieve is this.

Go to properties, click project, add new project which has 4 fields, if you want to add anothe click add project again and another for fuels shows up.

Then this shows up on template page
ScottSandbakken replied on at Permalink Best Answer Reply
ScottSandbakken
I would recommend setting up a block for the form, either using the standard Form block or a custom block created with Designer Content (http://www.concrete5.org/marketplace/addons/designer-content/). If you want these blocks to load by default when a page is created, just create a custom Page Type then add the form(s) as default blocks.

Your other option is to create a custom page attribute. Although I have never created one with multiple fields, I think it may be possible.
TMDesigns replied on at Permalink Reply
TMDesigns
This plug in looks perfect. Thank you