Query to create a category page?

14 posts by 3 authors in: Forums > CMS Builder
Last Post: July 16, 2014   (RSS)

By Perchpole - July 15, 2014

Actually, after lots of testing, the entire exercise is in danger of grinding to a halt!

There is something about the way categories are made that I cannot emulate with my front-end form. It doesn't matter what data I send to the query, it isn't enough. I believe this is due to the way a category is saved in cmsb. The process does far more than send data to a database. The act of saving a category also sets, resets and updates a number of additional parameters - like lineage, globalOrder, breadcrumb, etc. The only way to execute this process is to open the category record in cmsb and then immediately save it. 

Unless I'm mistaken, there is no way to replicate this process through a front-end form?

Perch

By Dave - July 15, 2014

Hi Perch, 

There's no easy or supported way.  Here's a hacky way: 

  // force update of category metadata for sorting (this may need to be updated in a much future version)
  $categoryTablename = 'category';
  $GLOBALS['escapedTableName'] = mysql_escape( $TABLE_PREFIX . $categoryTablename );
  $GLOBALS['schema']           = loadSchema($categoryTablename); // fake currently loaded schema
  if (!$GLOBALS['schema']) { die("Invalid table name '" .htmlencode($categoryTablename). "'"); }
  include_once(SCRIPT_DIR . '/lib/menus/default/common.php'); // load category menu functions 
  updateCategoryMetadata();

Let me know if that works for you.  

Dave Edis - Senior Developer
interactivetools.com

By Perchpole - July 16, 2014

Hi, Dave -

Thanks. This appears to work better than I had hoped for.

I now need to take this on to the next logical step... uploads!

Claire, you helped me with the AJAX which I'm using to send the data to the query. Would you be able/willing to help me to add uploading capability if I put in a priority consulting request?

Thanks,

Perch