Base Url is getting changed automatically |
[eluser]Ariful H Bhuiyan[/eluser]
Hi all I am new in CodeIgniter and started to loving it. Trying to develop my test application but got some problem at beginning. From view class, when I try to call any function in Controller class, my base url get changed automatically. Result is my css file become missing to app. Example: when I click on a button or link which is linked to a controller function, base url (http://localhost/greenimages) become (http://localhost/greenimages/contributor) where contributor is name of my controller. Please help me to understand what is the problem and what is the solution with this. Thanks Ariful
[eluser]LifeSteala[/eluser]
Hello, You might like to take a read here Codeigniter URLs. If your website is, www.greenimages.com and you click on the 'contributor' link, it's just like opening a standard link that takes you to www.greenimages.com/contributor.php. The link above will explain it better though. Good luck
[eluser]Ariful H Bhuiyan[/eluser]
Thanks for answer but thats not what is the problem. From my home page i can go easily to my Contributor page and than the url is greenimages.com/contributor Than when I try to register a user, i enter User ID, Email, Password in text box and when click Submmit button (its inside a form tag) than the form action call the "contributor/register" function. the register() call a register() from model and data get saved in database. but than when i hover my mouse on Home link, it show the link is localhost/greenmages/contributor where Home was suppose to show localhost/greenimages. In my config file config['base_url'] is set to 'http://localhost/greenimages' I think I explained the situation in more details now.
[eluser]LifeSteala[/eluser]
Can you show use the code for where your links are?
[eluser]Ariful H Bhuiyan[/eluser]
Controller: Contributor Code: class Contributor extends CI_Controller{ View: From where I am clicking the submit button Code: <?php echo form_open("contributor/registration"); ?>
[eluser]CroNiX[/eluser]
Hard to guess what you are doing. You need to post actual code.
[eluser]LifeSteala[/eluser]
Sorry, I'm looking for your view code that shows me how you marked up your navigation links not the code showing your form. Can you re-supply your full view code, maybe?
[eluser]Ariful H Bhuiyan[/eluser]
Sure.. This code is from my header.php file Code: <?php
[eluser]CroNiX[/eluser]
[quote author="Ariful H Bhuiyan" date="1330376653"]... but than when i hover my mouse on Home link, it show the link is localhost/greenmages/contributor where Home was suppose to show localhost/greenimages. [/quote] The code that creates the links you mention here is what we need to see, since that is what is giving you the problem... I'm guessing you are using a relative path, which would cause the problem you describe. |
Welcome Guest, Not a member yet? Register Sign In |