Stopping certain fields from displaying in all records

6 posts by 3 authors in: Forums > CMS Builder
Last Post: December 24, 2012   (RSS)

By Mel - December 21, 2012

I have a section editor called Bios which is the master section for adding records

I add records by logging in to admin and not through a php page

In the Bios section there are roughly 100+ fields some are text, picture uploads, and others are check boxes


Of these 100 plus, around 60 of these are check boxes that deal with towns/cities/regions

for example the field tw20 is Alderly Edge, cu1 is Ambleside ...... etc, etc, etc

Most of the other check boxes, text areas, image upload boxes deal with bio details of the individual

So if I design a list page with the following

list($biosRecords, $biosMetaData) = getRecords(array(
    'tableName'   => 'bios',
    
    'where' => "  ambleside='1' OR ambleside60='1' OR ambleside90='1' OR ambleside2='1'",

This works fine for ambleside it loads all the individual bios record thumbnails and link to the individual record page which in turn displays a single bio record with all details

Up until now this has worked fine

However for a person to visit certain areas a minimum appointment time is required, so trying to be clever I added extra check boxes like

ambleside60 - which equals 60 mins
ambleside90 - which equals 90 mins        
ambleside2 -   which equals 2hrs

Then added the following code to the master single record page - which is used for all bios irrespective of town/city/region

<?php if ($biosRecord['ambleside60'] == '1'): ?>**<?php echo $biosRecord['name'] ?>'s minimum appointment time for Ambleside is 1hr
            <?php elseif ($biosRecord['ambleside90'] == '1'): ?>**<?php echo $biosRecord['name'] ?>'s minimum appointment time for Ambleside is 90 minutes
            <?php elseif ($biosRecord['ambleside2'] == '1'): ?>**<?php echo $biosRecord['name'] ?>'s minimum appointment time for Ambleside is 2hrs

Which works fine for ambleside but when you go to the Alderly Edge listings page or any other town/city/region and click on the same persons individual record link

Yes youv'e guessed it it also shows the above text up on that individual record page as well - because the check boxes are ticked on their bio's

And of course if you added more minimum appointment times for other areas, you will get a whole bunch more of irrelevant text showing up in single record pages for other towns/cities/regions

So a two part problem

1. How do I stop the text showing up in unrelated areas and only the places it is meant for

2. if I keep adding the else/if's for other towns to the master single record detail page it could get very cumbersome

Also I have this gut feeling that having a 100 plus fields on the master Bios section is possibly not the best way to do things

Initially I need to solve problems 1 & 2 but I am also open to suggestions as to a better way of organising things when it comes to the master Bios section or it may be that I need to organise it differently to solve questions 1 & 2

Thank you for your comments and help in advance
Mel
    


By gregThomas - December 21, 2012

Hi Mel,

Are you passing any data to the detail page to tell it which town/city/region the user is from? 

If your planning on displaying all of the locations for every user, you could reduce the number of check boxes by having a wysiwyg editor and manually entering all of the data.

Another option is to replace grouped checkboxes with a list field. I've attached a screenshot of how you could set up the list field.

Then you could display what has been selected using the fields label:

 <?php echo @$biosRecord['amberside_time:label']; ?> 

This will reduce having 3 checkbox fields down to one 1 list field, and should make the detail page code look cleaner. 

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com
Attachments:

example_003.png 15K

By Mel - December 21, 2012

Hi Greg,

Not a 100% sure I know what you are asking but I will have a stab at it

If I am looking for company to visit me in Ambleside I go along to the Ambleside listing page

On that listing page will be displayed lets say 5 thumbnail pics which link to the individual record page, on the individual record page all the persons bio is displayed

Some will visit Ambleside for 1 hr and others will require a longer appointment  time, hence the 1hr 90 mins 2hrs text

But the same people that visit Ambleside also visit other places lets say for example Manchester plus many other areas, so if you go to the Manchester page it will show lets say again 5 thumbnails and you click on the thumbnail and it takes you to the same master individual record page which at the present time still has the text on about Ambleside appointments

But I would not be interested in what their minimum appointment time was for Ambleside, obviously if it were the case that they had minimum appointment times for Manchester, then I would want them to show but NOT the comments about Ambleside

When you click on a thumbnail in any town/city/region section it does not as far as I am aware pass any information through to the detail page showing what town/city/region page you have clicked through from - which judging by your question might be what is adding to the problem - below is the code that display the thumbnail and link to the detail page

------------------------------------

 <div align="center" class="img_border"><?php foreach ($biosRecord['newimage'] as $upload): ?>
  <?php if ($upload['isImage']): ?>
          <a href="<?php echo $biosRecord['_link'] ?>" target="_self"><img src="<?php echo get_custom_watermark_url($upload['urlPath'], '110watermarkSmall.png') ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="<?php echo $biosRecord['name'] ?>"></a>
          <?php else: ?>     
          <?php endif ?>
    </div>
    <?php endforeach ?>
              
     <div align="right"style="padding-top:3px;">
     <a href="<?php echo $biosRecord['_link'] ?>" target="_self">View My Details</a>
     </div>

------------------------------------

Thanks

Mel

By gkornbluth - December 22, 2012

Hi Mel,

I'm assuming that there are a finite list of tons to be visited?

If that's true, then why not use Greg's suggestion of pull down menus and some sort of multi field search for information only where fields contain the keyword (ambleside, manchester, etc.)

Also,

Don't know if there's a tree to bark up here, but take a look at these two free plugins:

http://www.interactivetools.com/add-ons/detail.php?Show-Hide-Dependent-Fields-Plus-1060

and

http://www.interactivetools.com/add-ons/detail.php?Show-Hide-Fields-For-Users-1036

There may be a concept or two that will work for you.

Hope that helps

Jerry

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By gkornbluth - December 23, 2012

Mel,

I''ve attached a viewer that I use to cull records for particular exhibition submissions from a large database of submission records

maybe an idea will appear.

look around line 45 and 165.

I basically set the where from a pull down llist and use it to determine which records will show.

Jerry

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Attachments:

submissions_emaillist.php 11K