Elxis CMS Forum

Extensions => Modules => Topic started by: 1050 on June 27, 2012, 15:42:12

Title: folder path
Post by: 1050 on June 27, 2012, 15:42:12
Hi,
I want to write an ajax module, and I want to include ajax_new.js in my php file, it's on
/administrator/include/js/ajax_new.js
how should I wirte the path?
I find this it in one of your ajax topic :
<script type="text/javascript" src="includes/js/ajax_new.js"></script>
but it didn't work for me
thank you :)
Title: Re: folder path
Post by: datahell on June 27, 2012, 20:18:35
<?php echo $mainframe->getCfg('live_site'); ?>/administrator/....
or
<?php echo $mosConfig_live_site; ?>/administrator/....

Tip: you can alternative write your own ajax script without using the ajax sack library which works fine, but it is an old script.

Note for Elxis 4.0 Nautilus
The "live site URL" is now provided by the "URL" configuration option:
$live_site = eFactory::getElxis()->getConfig('URL');

But for scripts/stylesheets/images inclusion we strongly suggest to use the secureBase method which automatically switches to https on SSL/TLS protected pages:
$live_site = eFactory::getElxis()->secureBase();

And the link to site's frontpage:
$frontpage_link = eFactory::getElxis()->makeURL();
or
$frontpage_link = eFactory::getURI()->makeURL();