Hello,
I’m trying to create a simple integration of Modx with phpBB. When my editors will be posting a new page in MODX, e.g. news item, the plugin I’m trying to create, will post a new topic on a forum. I know how to post something in phpBB, but I’m a complete newbie in ModX programming and OOP. There are not many plugins to look at either.
My plugin is going to use OnDocPublished event.
Please, help me with these questions:
1. How to access a template variable of a document in a plugin?
2. How to access a parents ID of a document in a plugin?
3. How to access Title and Content of a document in a plugin?
Thanks.
Thanks, I’m on the way now.
Just got a question: is there any log or something? My plugin doesn’t work and I can’t learn what exactly doesn’t work without log or at least printing something out. I feel blind.
There is a System Event Log under Reports tab, I guess it can provide you useful information regarding errors.
regards.
Argh, the posting script works fine, but when I include it to MODx it shows me some odd errors like
Fatal error: Call to a member function on a non-object in /home/login/public_html/forum/includes/functions.php on line 355
Heres that line (355):
if ( !($result = $db->sql_query($sql)) )
What troubles could MODX have with $db ?
-
☆ A M B ☆
- 24,524 Posts
Perhaps you need to declare $db global somewhere? Treat a snippet exactly as you would a function. Declare external stuff global, and return your output.
Is there any way to change a template variable of a document in a plugin?
Yes, I think so, what variable do you want to change and when?
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
I want my plugin to change TV called [*topicid*] of document the plugin is connected to, to some 4 digit integer value, which will be generated each time.
Also, another question, what "Event" should I use if I want my plugin to be run just when someone edited and saved the document?