0

If I have a control panel page and I want to submit it to a PHP page in my extensions' directory, how do I do that? What would the URL be?

Or would I instead make an ACT URL? If so, how do I do that on the control panel side of EE?

1

You shouldn't be submitting to PHP file in system folder directly, as the system folder might be located outside of web root and so inaccessible for direct requests.

Instead you need to place those functions inside of a module and post data to ACT page, just like you say. The function reference need to be added to exp_actions database table (see example in the docs)

Then to get URL to post to you will need code similar to this:

$act = ee()->db->select("action_id")->from("actions")->where("class", 'Module_name')->where('method', 'function_name')->get();
$remoteUrl = trim(ee()->config->item('site_url'), '/').'/?ACT='.$act->row('action_id');
| improve this answer | |
  • Thank you. So how would I link to stylesheets and JavaScript files within my html? – Don Rhummy Nov 21 '15 at 8:13
  • Something like ee()->cp->add_to_foot('<link type="text/css" href="'.URL_THIRD_THEMES.'module_name/style.css" rel="stylesheet" />'); – Yuri Salimovskiy Nov 21 '15 at 13:31
  • Thanks! Will that also work for the front end? – Don Rhummy Nov 21 '15 at 18:29
  • The URL_THIRD_THEMES constant will be available on front-end too, but ee()->cp->add_to_foot function is control panel-only. – Yuri Salimovskiy Nov 22 '15 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.