I want to create a base controller where I want to set my template's header, menu and footer and then extend this controller in my other controller. If I make different controllers for different views, this works fine but if i put different action methods to call different views in a single controller, my index page works fine but all other pages do not. My code looks something like this:
class Controller_Public extends Controller_Template
If I create separate controller to call my register page, it works fine. However, if I do as above, my index page loads fine but when I go to my register page, I just get listing of all my content and my styles and formatting are all gone.Further, after I go to register page, navigating back to my index page generates error. I am not sure if I made myself clear. I am a complete newbie. Please help.
First, if you make a base controller, it's best not to call it Controller_something, and put it in classes/controller. That will make it publicly accessible. It's better to either put it in classes, or in a folder of classes (and change the class name accordingly).
The problem you describe has nothing to do with your controllers, your views are not ok, or your base_url is not ok.
From your description my guess is that when you request "http://yoursite", your assets are prefixed with that, and it works. When you request "http://yoursite/register", your assets are prefixed with that, and obviously nothing will be found.
Are you using the Asset class, or something hardcoded? Perhaps you can post the header part of your "content/register" view? Use http://bin.fuelphp.com for larger code blocks, it's easier to read and reply to,
I am not sure if this has got anything to do with my problem but when i run my project, my url is "http://mysite", when I navigate to my register page, my url is "http://mysite/site/register" and my styles are gone. Then when I navigate back to my index page, my url is "http://mysite/site/index" and my styles are again gone.
which I find a bit cleaner. Uri::create() is also more feature rich, so it can generate url's with "fake" extensions if you configure that, it supports query string generation from array data, https links, etc.