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

[eluser]areesto[/eluser]
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 ?
#12

[eluser]Nicholas Valbusa[/eluser]
[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
#13

[eluser]areesto[/eluser]
[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..

#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
#15

[eluser]Gurik[/eluser]
[quote author="Nicholas Valbusa" date="1327403312"]
If you need more informations, feel free to ask me!
Btw i'm gonna write more documentation about these things in the nex days Smile[/quote]
it would be fantastic
i will document problems i had integrated Ion-Auth into this package

i also had another question concerning generation of website tree/menu

i have one main menu

* main menu element 1 * main menu element 2 * main menu element 3
and several sub menus like this

* Submenu 1 of main menu element 1
* Submenu 2 of main menu element 1
* Submenu 3 of main menu element 1

how could i generate submenus in right way?

when i try to use
echo menu(tree('current')) it generates child elements of current page but i want to generate child elements of only parent page


#16

[eluser]Nicholas Valbusa[/eluser]
[quote author="Gurik" date="1327762329"][quote author="Nicholas Valbusa" date="1327403312"]
If you need more informations, feel free to ask me!
Btw i'm gonna write more documentation about these things in the nex days Smile[/quote]
it would be fantastic
i will document problems i had integrated Ion-Auth into this package

i also had another question concerning generation of website tree/menu

i have one main menu

* main menu element 1 * main menu element 2 * main menu element 3
and several sub menus like this

* Submenu 1 of main menu element 1
* Submenu 2 of main menu element 1
* Submenu 3 of main menu element 1

how could i generate submenus in right way?

when i try to use
echo menu(tree('current')) it generates child elements of current page but i want to generate child elements of only parent page


[/quote]

Hello Smile
you can use the "get_default_branch" method of the model tree passing the starting page id of the submenu in this way:

Code:
$parent_page = page('id_parent');
$submenu = $this->tree->get_default_branch($parent_page);

You can find the full documentation of the model tree here:
http://docs.getbancha.com/framework/models/tree.html
#17

[eluser]Gurik[/eluser]
Thanks Nicholas
I think i cannot get the idea of using model&themes; in general Sad

there is get_default_branch in model_tree
but how do i use this in view should i add it to controller (core/controller/website )
or i can use this directly in view ?

I've tried both without any luck

#18

[eluser]Nicholas Valbusa[/eluser]
[quote author="Gurik" date="1327771768"]Thanks Nicholas
I think i cannot get the idea of using model&themes; in general Sad

there is get_default_branch in model_tree
but how do i use this in view should i add it to controller (core/controller/website )
or i can use this directly in view ?

I've tried both without any luck

[/quote]

You can use it directly in the view like this:

Code:
$submenu = $this->tree->get_default_branch($page->get('id_parent')); 
#19

[eluser]areesto[/eluser]
Hi Nicholsa,

Are you planing for some future versions of getbancha or some tutorials on it? it would be great if there is more users functions like adding the field creator on record table to know who create the post.

Thanks.
#20

[eluser]Nicholas Valbusa[/eluser]
[quote author="areesto" date="1327940189"]Hi Nicholsa,

Are you planing for some future versions of getbancha or some tutorials on it? it would be great if there is more users functions like adding the field creator on record table to know who create the post.

Thanks.[/quote]
Hello,
I'm planning to do some screencasts and written tutorials, more detailed than the introduction tutorial that you can find here:
http://docs.getbancha.com/firststeps/index.html

On the next release I also expect to add an "author" field on the records table. By the way, you can add it by yourself using an xml field like this:

Code:
<field id="author">
    <type>hidden</type>
    <default>eval:$this->user('id');</default>
</field>

Futher info about the fields: http://docs.getbancha.com/content-types/...ields.html

You can also use $this->user('full_name') or $this->user('username')

On the post, you get the value as follows:

Code:
$post->get('author');




Theme © iAndrew 2016 - Forum software by © MyBB