GetSimpleCMS / GetSimpleCMS

GetSimple CMS
http://get-simple.info
GNU General Public License v3.0
392 stars 114 forks source link

suggestion: pretemplate hooks in admin or ajax.php that is hookable #82

Closed n00dles closed 11 years ago

n00dles commented 11 years ago

Original author: talkingt...@gmail.com (November 01, 2010 21:00:31)

I ran into a interesting issue where I needed to populate a jquery plugin with json data but due to the way you can't directly call plugins and theres no hook in admin to inject json, it makes creating advanced plugins rather complicated.

Could we maybe get a standard ajax.php that just loads core/settings and has a hook for output? or even having a pretemplate hook in the load.php would be great.

Original issue: http://code.google.com/p/get-simple-cms/issues/detail?id=82

n00dles commented 11 years ago

From talkingt...@gmail.com on November 01, 2010 21:07:04 I think a load-ajax.php would make sense so that we could maybe pass something like:

load-ajax.php?id={plugin}&func={plugin_function}

This way it keeps the same concept by loading a specified function from the loaded plugin file.

n00dles commented 11 years ago

From talkingt...@gmail.com on November 01, 2010 23:47:52 Example of what I have done to create this functionality:

load-ajax.php

<?php /**

// Setup inclusions $load['plugin'] = true;

// Include common.php include('inc/common.php');

// Variable Settings login_cookie_check();

// Setup this plugin $plugin_id = $_GET['id']; global $plugin_info;

if (function_exists($_GET['func'])) { call_user_func_array($_GET['func'],array()); } else { echo 'Invalid Function'; } ?>

n00dles commented 11 years ago

From ccagle8 on November 07, 2010 01:10:50 this looks ok, but im having trouble seeing why this is needed. Im sure you can present a good case for this, but can you explain it a little more?

n00dles commented 11 years ago

From talkingt...@gmail.com on November 07, 2010 09:26:04 sure.

I ran across a position where i needed to get json back for a jquery plugin I was using with my plugin. While I know most have made workarounds to do such things (working out of plugin folder directories and including files, etc..), I really just saw a way to keep security high while giving developers much more built in flexibility. in this case I simply could make a single function that outputted json and have native access to all the things that the plugin would normally have.

Basically, it picks up where load.php can't help (since it outputs template). A simple native way to communicate via ajax could be very helpful towards future development.

n00dles commented 11 years ago

From ccagle8 on November 12, 2010 18:51:04 This issue was closed by revision r267.