Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Admin plugins events and steps...how do they work?
I’m trying to build an admin plugin but I’m not sure I’m understanding how the event and step actions work… heres basically what i have…
<pre> if (@txpinterface == ‘admin’) { // Add a new tab under ‘extensions’ called ‘testing’, for the ‘test’ event register_tab(“extensions”, “test”, “testing”);
// ‘zem_admin_test’ will be called to handle the ‘test’ event register_callback(“zem_admin_test”, “test”); } function zem_admin_test($event, $step) { pagetop(‘Testing’, ($step == ‘export’ ? ‘You said hello!’: ‘’)); // The eInput/sInput part of the form is important, setting the event and step respectively // The eInput/sInput part of the form is important, setting the event and step respectively echo “<div align=\“center\” style=\“margin-top:3em\”>”; echo form( hed(“Testing Plugin”,2). graf( eInput(‘test’).sInput(‘start’). fInput(“submit”, “start”, “Start”, “publish”). gTxt(“Test Button No 1”). br. eInput(‘test’).sInput(‘stop’). fInput(“submit”, “stop”, “Stop”, “publish”). gTxt(“Test Button No 2”). ,” style=\“text-align:center\”“) );
if ($step == ‘start’) { doHello(); }
echo “</div>”; } //———————————————————————————————————————————————————- //Test Function
function doHello() {
echo “<p>Hello World</p>”;
}
</pre>
…ideally when you click the “start” button, it should echo “hello world”, but nothing happens when i click the button, the admin page just refreshes. What am I doing wrong? And can some explain to me the purpose of the event and step params ? (btw I’m new to making plugins so go easy on me lol).
edit: textile or the page is playing around with the code..the blank spaces you see in the echo statements are div tags. and the echo statements only span one line, rather than the 3 that they are displayed as
Last edited by marz (2005-06-25 02:41:00)
Offline