Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-02-22 11:25:56

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

auto-increment a custom-field (custom Id for articles per sections)

Hello Txp users,

In a personal project manager/todoList application build with Txp, I use 2 distinct sections for define the 2 contents types

  • Project: create a new project
  • Task: create a new task.

Created projects and tasks are stored in Textpattern table, it’s not ideal: both share ID column incrementation.

I would like projects and tasks that have their own ID.
I don’t want to replace the logic of textpattern (URL etc.), Just adding a new auto-increment column but in relation with sections.

A idea ?

Offline

#2 2018-02-22 13:33:08

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,534
Website GitHub Twitter

Re: auto-increment a custom-field (custom Id for articles per sections)

Hi,

a plugin that is fired on article.save, test wich section is the article and then select the max number of the custom_field then write the value+1 on the desired custom_field.

Si c’est pas claire, je me comprends!

Cheers.

Offline

Board footer

Powered by FluxBB