#1 2014-08-12 13:33:08

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

[solved]Module : strange issue with constant url call (ION.modulesUrl)

Waouu, i get a very strange issue :

My module display some content in a special tab in the right panel of articles.
And, in the view, i have some javascript code.

Each url i call with ION.HTML, ION.JSON... is like this :

  ION.JSON(
	          ION.adminUrl + 'module/my_module/my_controller/my_function',
	                {
	                    //some data
	                }
	        );

Note that the url is with 'module', not 'modules', and it works fine !!!

But if use ionize pure style with :

ION.JSON(
	          ION.modulesUrl + 'my_module/my_controller/my_function',
	                {
	                    //some data
	                }
	        );

I have this error :

A PHP Error was encountered
Severity: Notice
Message: Undefined property: Page::$settings_model
Filename: core/MY_Controller.php
Line Number: 84

Fatal error: Call to a member function get_languages() on a non-object in /var/www/my_website/application/core/MY_Controller.php on line 84

Any idea ?

Last edited by Kink (2014-08-12 15:38:29)


Webmaster / OUF!WEB

Offline

#2 2014-08-12 15:30:53

CodeStepper
Member
From: Poland
Registered: 2014-06-30
Posts: 53
Website

Re: [solved]Module : strange issue with constant url call (ION.modulesUrl)

Strange... looks like settings_model is not loaded.
adminUrl and modulesUrl are defined in this way:

	var base_url = '<?php echo base_url(); ?>';
	var theme_url = '<?php echo theme_url(); ?>';
	var site_theme_url = '<?php echo base_url() . 'themes/' . Settings::get('theme') .'/'; ?>';
	var modules_url = '<?php echo base_url(); ?>modules/';
	var admin_url = '<?php echo base_url().Settings::get_lang('current'); ?>/<?php echo config_item('admin_url'); ?>/';
	var date_format = '<?php echo Settings::get('date_format'); ?>';

in admin/views/desktop.php

So... putting there ION.modulesUrl, you're trying to run it from YOUR_SITE/modules/YOUR_MODULE.

Maybe try to use it this way:

ION.JSON(
	          ION.baseUrl + 'my_module_frontend_url/my_function',
	                {
	                    //some data
	                }
	        );

It call your function if your module has frontend url.
Frontend URL is next to module "install" button.

If you don't have frontend, you shoud call it from ION.admin_url + "module/....." like in your first code.

Last edited by CodeStepper (2014-08-12 15:35:17)

Offline

#3 2014-08-12 15:38:06

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [solved]Module : strange issue with constant url call (ION.modulesUrl)

Yes @CodeStepper, adminUrl add language in its url.
So if i understand, using modulesUrl is only for specific way.

Thanks, i close this topic.


Webmaster / OUF!WEB

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations