Extract website name string |
[eluser]Animas[/eluser]
I want to extract "mysite" from http://www.mysite.com(main website url). How to do this? Thanks.
[eluser]Crimp[/eluser]
If you mean, extract the domain from any website, you use JavaScript and camelcase from there (althoug not exactly sure how you would define the words). The URL is found by document.URL and then you treat that string.
[eluser]Animas[/eluser]
base_url()easily shows the url. But I am looking for a way which removes "http://" from beginning and ".com/" from end. I tried word_censor() which doesn't recognize "/", ":" etc. So anyone knows how to do it?
[eluser]Référencement Google[/eluser]
If this doesn't have to be dynamic, you could just add in your config.php file something like: Code: $config['site_name'] = 'yourwebsitename'; Is that helping?
[eluser]xwero[/eluser]
Code: preg_replace('/http:\/\/(.+).com/','$1',base_url());
[eluser]Animas[/eluser]
[quote author="xwero" date="1209133026"] Code: preg_replace('/http:\/\/(.+).com/','$1',base_url()); This is want I need. For http://localhost/app/ where "localhost/app" will be extracted I tried Code: preg_replace('/http:\/\/(.+)/','$1',base_url()); So my revised version is Code: preg_replace('/http:\/\/(.+)\//','$1',base_url()); Code: preg_replace('/http:\/\/(.+).com\//','$1',base_url()); Thank you guys. |
Welcome Guest, Not a member yet? Register Sign In |