Welcome Guest, Not a member yet? Register   Sign In
Bancha, Open-source CMS
#14

[eluser]Nicholas Valbusa[/eluser]
[quote author="areesto" date="1327679253"][quote author="Nicholas Valbusa" date="1327404921"][quote author="areesto" date="1327404712"]Hi Nicholas,

i start using your excellent cms, and want to use some ajax in the admin view edit content, i want to use nested combo-box (for cars : one for make and the other for model). i use jCombo for this so my javascript is :
$("#model").jCombo("getModels.php?id=", { parent: "#make" } );

my question is where i can place the file "getModels.php" and is it possible to use the bancha classes and helpers.. on it ? [/quote]

Hello, you can extend the admin/Axax Controller so you can add a new method with your code. Please refer to:
http://docs.getbancha.com/framework/core...llers.html[/quote]

Thank you for the response, but jcombo need a file to be indicated like :
$("#model").jCombo("getModels.php?id=", { parent: "#make" } );

so i creat the file getModels.php in the views directory and call it like :
$("#model").jCombo("<?php echo the path here?>admin/getModels.php?id=", { parent: "#make" } );

and in getModels.php i use directly a query tio the records table by a mysql connection...
i know it's not cute but it works fine.

i hope you continue your excellent work..

[/quote]

Hello, you could use the helpers to print the controller path, like this:

Code:
$("#model").jCombo("<?php echo admin_url('ajax/getmodels'); ?>");

That prints out a string similar to: http://example.com/admin/ajax/getmodels
"getmodels" is your method inside the controllers/admin/ajax.php controller

Documentation can be found here: http://docs.getbancha.com/framework/help...bsite.html

Inside the method, you can use the base CodeIgniter DB Active record like this:

Code:
$this->db->select('*')->from('yourtable')->get()->result();

Or, if you need to extract the records from a content type:

Code:
$this->records->type('typename')->get();

Cheers,
Nicholas


Messages In This Thread
Bancha, Open-source CMS - by El Forum - 01-08-2012, 10:36 AM
Bancha, Open-source CMS - by El Forum - 01-19-2012, 02:09 PM
Bancha, Open-source CMS - by El Forum - 01-19-2012, 04:49 PM
Bancha, Open-source CMS - by El Forum - 01-19-2012, 05:03 PM
Bancha, Open-source CMS - by El Forum - 01-22-2012, 07:17 AM
Bancha, Open-source CMS - by El Forum - 01-22-2012, 08:07 AM
Bancha, Open-source CMS - by El Forum - 01-23-2012, 06:24 PM
Bancha, Open-source CMS - by El Forum - 01-23-2012, 08:02 PM
Bancha, Open-source CMS - by El Forum - 01-24-2012, 04:04 AM
Bancha, Open-source CMS - by El Forum - 01-24-2012, 04:08 AM
Bancha, Open-source CMS - by El Forum - 01-24-2012, 04:31 AM
Bancha, Open-source CMS - by El Forum - 01-24-2012, 04:35 AM
Bancha, Open-source CMS - by El Forum - 01-27-2012, 08:47 AM
Bancha, Open-source CMS - by El Forum - 01-27-2012, 09:23 AM
Bancha, Open-source CMS - by El Forum - 01-28-2012, 07:52 AM
Bancha, Open-source CMS - by El Forum - 01-28-2012, 08:57 AM
Bancha, Open-source CMS - by El Forum - 01-28-2012, 10:29 AM
Bancha, Open-source CMS - by El Forum - 01-29-2012, 12:54 AM
Bancha, Open-source CMS - by El Forum - 01-30-2012, 09:16 AM
Bancha, Open-source CMS - by El Forum - 01-30-2012, 09:44 AM
Bancha, Open-source CMS - by El Forum - 01-30-2012, 09:51 AM
Bancha, Open-source CMS - by El Forum - 02-06-2012, 12:04 PM
Bancha, Open-source CMS - by El Forum - 03-19-2012, 02:12 AM
Bancha, Open-source CMS - by El Forum - 03-19-2012, 03:10 AM
Bancha, Open-source CMS - by El Forum - 04-17-2012, 02:11 AM
Bancha, Open-source CMS - by El Forum - 04-21-2012, 02:50 AM
Bancha, Open-source CMS - by El Forum - 04-21-2012, 09:55 AM
Bancha, Open-source CMS - by El Forum - 04-23-2012, 02:38 AM
Bancha, Open-source CMS - by El Forum - 04-23-2012, 03:45 AM
Bancha, Open-source CMS - by El Forum - 04-23-2012, 06:12 AM
Bancha, Open-source CMS - by El Forum - 04-23-2012, 06:38 AM
Bancha, Open-source CMS - by El Forum - 04-23-2012, 07:21 AM
Bancha, Open-source CMS - by El Forum - 04-23-2012, 07:43 AM
Bancha, Open-source CMS - by El Forum - 04-23-2012, 08:23 AM
Bancha, Open-source CMS - by El Forum - 04-23-2012, 08:43 AM
Bancha, Open-source CMS - by El Forum - 04-23-2012, 09:18 AM
Bancha, Open-source CMS - by El Forum - 04-23-2012, 09:43 AM
Bancha, Open-source CMS - by El Forum - 04-23-2012, 09:56 AM
Bancha, Open-source CMS - by El Forum - 04-26-2012, 10:23 PM
Bancha, Open-source CMS - by El Forum - 05-07-2012, 04:00 AM
Bancha, Open-source CMS - by El Forum - 05-08-2012, 06:13 AM
Bancha, Open-source CMS - by El Forum - 05-14-2012, 06:06 PM
Bancha, Open-source CMS - by El Forum - 05-17-2012, 08:03 AM
Bancha, Open-source CMS - by El Forum - 07-07-2012, 01:15 PM
Bancha, Open-source CMS - by El Forum - 08-16-2012, 05:00 AM
Bancha, Open-source CMS - by El Forum - 06-02-2014, 11:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB