5 posts by 2 authors in: Forums > CMS Builder
Last Post: August 9, 2017   (RSS)

Hi willydoit, 

Did you get this sorted out?  If not, try this: 

  • Create a new section called: Categories
  • Only have these fields in it: num, name
  • For any sections that you want these categories in, create a list field with: Get options from database (advanced)
  • Select the category table as the Tablename, num for "values" and name for "labels"

Let me know if that works for you.

Note: I'm using "num" as the stored value, which means you'll need to look up categories like this: category=4, you can use text if you want.  The benefits of using record numbers is that even if your text changes the records are still linked.

Dave Edis - Senior Developer
interactivetools.com

Hi Dave,

thanks for the help but I still cannot get this working but I know it is likely to be something simple caused by my lack of php and mysql knowledge.

I have created a new section called category list

it contains the pre created num field and I have added a text field called title

I have created two test records in the category list section.

I have then created a field in my section information pages called Category List

I have selected field type Related Records

In the related table I have selected categories_list

List Actions I have ticked view

And this is where I come unstuck,

I have changed the MySQL Where element to num='<?php echo mysql_escape(@$RECORD['num']) ?>'

I have also tried changing it to

title='<?php echo mysql_escape(@$RECORD['num']) ?>'

I have left the More "Search" Link as the default entry.

When I go to edit or create a record in the information pages table this field shows "Sorry, no records found!" if I click on see related records it goes to the correct table and I can see the two test records but they dont populate the list as I assumed they would.

I obviously havent grasped what is supposed to be happening and what it is actually doing. In case it helps I have uploaded screen dumps showing settings etc.

Hi willydoit, 

Instead of a related records field, can you try creating a list field? 

  • For any sections that you want these categories in, create a list field with: Get options from database (advanced)
  • Select the category table as the Tablename, num for "values" and name for "labels"

Let me know if that works for you.  

Dave Edis - Senior Developer
interactivetools.com

Hi Dave,

that sorted it, thanks, that,s opened up a whole new world of possibilities now. Thanks again for your patience, it is appreciated.