Nishith Nesdiya Posted July 23, 2013 Share Posted July 23, 2013 hi..friends i need to get the site baseurl in my custom modules. how can i get the baseurl in my custom modules? i am using the PS 1.5.3.1 can anyone help me solve this problems...... thanks..... 1 Link to comment Share on other sites More sharing options...
spm.presto Posted July 23, 2013 Share Posted July 23, 2013 Hi Use following code: global $smarty; $smarty->tpl_vars['base_dir']->value; or global $smarty; $smarty->tpl_vars['base_dir_ssl']->value; Regards hi..friends i need to get the site baseurl in my custom modules. how can i get the baseurl in my custom modules? i am using the PS 1.5.3.1 can anyone help me solve this problems...... thanks..... 1 Link to comment Share on other sites More sharing options...
me.yasin Posted July 26, 2013 Share Posted July 26, 2013 (edited) You can use following const. _PS_BASE_URL_ (domain) __PS_BASE_URI__ (base url) Edited July 26, 2013 by me.yasin (see edit history) 3 Link to comment Share on other sites More sharing options...
vekia Posted July 26, 2013 Share Posted July 26, 2013 but in this case is necessary to check the SSL, if it is available then you must use other variables (related to the SSL) where you want to use it? in the .PHP file or in the .TPL ? 1 Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted July 29, 2013 Author Share Posted July 29, 2013 thanks.... i use the.. Tools::getHttpHost(true).__PS_BASE_URI__; it is wroking for me.. 3 Link to comment Share on other sites More sharing options...
vekia Posted July 29, 2013 Share Posted July 29, 2013 okay. thanks for confirmation im going to mark this topic as [solved] best regards 1 Link to comment Share on other sites More sharing options...
diamondgate Posted February 5, 2015 Share Posted February 5, 2015 (edited) You can try this $this->context->link->getPageLink('index',true); (if you are in a controller or module main file) Cheer! Edited February 5, 2015 by diamondgate (see edit history) 1 Link to comment Share on other sites More sharing options...
daniley Posted February 19, 2015 Share Posted February 19, 2015 okay. thanks for confirmation im going to mark this topic as [solved] best regards я не совсем вкурил, что и где надо поменять что бы по умолчанию был домен https ? - сертификат установил, вижу в настройках nginx появилось 2 строчки ssl_certificate /var/www/httpd-cert/site/site.com.chained.crt; ssl_certificate_key /var/www/httpd-cert/site/site.com.key; в настройках админки включена безопасность, по ссылке в админке перехожу - всё работает, но по умолчанию обычный http адрес стоит Link to comment Share on other sites More sharing options...
vekia Posted July 21, 2015 Share Posted July 21, 2015 im affraid that i don't understand ;-) please translate it to english if it is possible thanks in advance! Link to comment Share on other sites More sharing options...
rubenlodi Posted March 9, 2016 Share Posted March 9, 2016 (edited) Hey, I moddified "classes / Mail.php" addin one line to be able to use at templates a variable whis is the domain. But it appear 2 times instead of one. $template_vars['{shop_inurl}'] = Tools::getHttpHost(false)._PS_BASE_URL_; It appears like "mydomain.eshttp://mydomain.es" But if I use this: $template_vars['{shop_inurl}'] = Tools::getHttpHost(false).__PS_BASE_URI__; It appears like "mydomain.es/" so I can't use it for emails for example "info@{shop_inurl}" or it will show "[email protected]/"I think I may use _PS_BASE_URL_ but without the doubled url Edited March 9, 2016 by rubenlodi (see edit history) Link to comment Share on other sites More sharing options...
MahmutGulerce Posted August 12, 2017 Share Posted August 12, 2017 A better way may be Context::getContext()->shop->getBaseURL(true); 3 1 Link to comment Share on other sites More sharing options...
kelvin Posted June 8, 2018 Share Posted June 8, 2018 What of if you want to use in the JS file, for instance using ajax Link to comment Share on other sites More sharing options...
kelvin Posted July 9, 2018 Share Posted July 9, 2018 I tried something like $this->context->smarty->tpl_vars['base_url']->value. And it complaining about mixed content. My website is https but the output is http Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now