26

Re: Indicia and PHP novice - help

Hi John

That would explain it. I did create a folder called upload and there are two cache files in it.

Is there anything else that you would like me to go through and test? It would be nice to have the data displaying on a map. Not sure I have seen a tutorial for that?

Jo

27

Re: Indicia and PHP novice - help

Hi John

Tried to follow the add a custom attribute from the Wiki, but I get a parse error. The code below is within a php tag.

    <label for"occAttr:2">Approximate population size:</label>
echo data_entry_helper:radio_group('occAtt:2','termlists_term', 'term', 'id', $readAuth + array('termlist_id'=>'1'));

I have tried to use the Dafor list

Jo

28

Re: Indicia and PHP novice - help

Hi Jo,

I don't have a tutorial for displaying data on a map, simply because the easiest technique is to use GeoServer which has it's own set of tutorials. But it would indeed be nice to have a tutorial to do this in the context of Indicia - it's just a case of finding the time.

So, I presume you have got to the point where you are relatively happy in building the data entry forms? Have you had a go at things like Flickr integration, or dropping grids into your website?

Best Wishes

John van Breda
Biodiverse IT

29

Re: Indicia and PHP novice - help

Hi John

I have tried adding a custom attribute field but got nowhere due to a parse error in the code (see#27)

Jo

30

Re: Indicia and PHP novice - help

Hi Jo,

Sorry, we'd cross posted so I missed your error...

The first thing I noticed is you have wrapped the whole thing in PHP tags including the label, but the label is not PHP (it is HTML) so it will cause a parse error. The PHP tags need to be just around the call to the data entry helper.

Second minor thing is a typo - occAtt:2 should be occAttr:2. This won't cause an error yet, but when you come to submit the data, the value would not get picked up.

A few more points about this code - the tutorial is actually still using an older technique of calling the data entry helper methods and needs updating (I'll do that in a moment). Using the new technique the code would be something like:

<?php
echo data_entry_helper::radio_group(array(
  'label'=>'Approximate population size',
  'fieldname'=>'occAttr:2',
  'table'=>'termlists_term',
  'captionField'=>'term',
  'valueField'=>'id',
  'extraParams'=>$readAuth + array('termlist_id'=>1)
));
?>

There is nothing wrong with the old way of calling the methods - it's just that the new method allows for much greater flexibility with more parameters. Plus in my opinion the code is more readable and tidier - although it is slightly more typing I favour readability over brevity!

Finally, I noticed a bug in the radio_group control which did not support templating labels like the other controls - so I've just fixed this in the code in the subversion repository.

That leads me to another suggestion for what to do next. You could have a look at the Wiki section on developer recipes, which includes guides on setting up your own themes, controlling the template of the code output for each control, performance tips, etc etc. It would be interesting to know how you get on using the templating and theme support for example.

Best Wishes

John van Breda
Biodiverse IT

31

Re: Indicia and PHP novice - help

I've updated the custom attribute tutorial...

John van Breda
Biodiverse IT

32

Re: Indicia and PHP novice - help

Hi John

I did try closing off the previous php tag and ensuring the html was outside this, but it made no difference and... lol I actually tried to rewrite it like the rest of the client_helper calls, but it was too much for my PHP skills at the moment. It was fun trying to think it through though. I will try the new code and see how that goes.

I will take a look at the Wiki section's recipes and have a bash.

Thanks

Jo

33

Re: Indicia and PHP novice - help

Hi Jo,

If you are still getting problems with this bit of code, can you post the exact code up here so I can take a look at it please.

Cheers

John

John van Breda
Biodiverse IT