Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-04-01 16:30:23

feragnoli
Member
From: the hague
Registered: 2005-02-10
Posts: 150

run a php script on article save?

I need to generate a file on the server whenever a new article is saved. In my mind every ‘save’ would run a php function that collects data from the database and writes the file.
Is that possible? does that take hacking the publish.php file or the such..?
thank you.


what was that again…?

Offline

#2 2009-04-01 17:00:47

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: run a php script on article save?

rvm_css saves the stylesheet on a file so I guess that what you need is possible.

The problem that I see is there are too many variables which come with each article such as the text (textile, html, line breaks, leave untouched). custom fields, section, categories, form, date(s), article image, etc. Then, there is the content which is supplied by various plugins such as unlimited custom fields.

Last edited by colak (2009-04-01 17:16:03)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Online

#3 2009-04-01 18:57:20

juanjonavarro
Plugin Author
From: Valencia, Spain
Registered: 2005-05-16
Posts: 485
Website

Re: run a php script on article save?

You can create a plugin that “hooks” to the create article event:

register_callback("your_function", "article", "create");

Then create the your_function function:

function your_function($event, $step) {
  // Your code
}

Offline

#4 2009-04-01 22:37:49

feragnoli
Member
From: the hague
Registered: 2005-02-10
Posts: 150

Re: run a php script on article save?

great. thank you very much.


what was that again…?

Offline

Board footer

Powered by FluxBB