Couple Questions - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Couple Questions (/showthread.php?tid=51933) |
Couple Questions - El Forum - 05-23-2012 [eluser]mfroseth[/eluser] Very new to CI and have a couple questions. I've created a folder inside views called "admin" and I have my html template, however the stylesheet and images could not be generated for some reason, Is there a special way to do this? I tried "../" "./" etc... Also, I used a tutorial for creating a login section that I have redirected to my views/admin_panel (which is the html template I was just referring to) and I want to create a function for displaying the username. How do I go about outputting the function that I create? Are there special calls? Inside the function I've pulled the username from the database using the user_id session and matching it with the user_id in the database. But I am unsure as to how I can display this using the function I created. Any help would be greatly appreciated. Thanks Couple Questions - El Forum - 05-23-2012 [eluser]the_unforgiven[/eluser] When linking to css, js always use syntax like this: Code: <link rel="stylesheet" href="<?php echo base_url(); ?>css/main.css" type="text/css" /> As for the rest you are talking about post your code in Code: '[code] Couple Questions - El Forum - 05-23-2012 [eluser]mfroseth[/eluser] [quote author="the_unforgiven" date="1337803533"]When linking to css, js always use syntax like this: Code: <link rel="stylesheet" href="<?php echo base_url(); ?>css/main.css" type="text/css" /> As for the rest you are talking about post your code in Code: '[code] Thank you very much! The base URL is what I set in config.php correct? So anything after that would be the actual directory (say: view/admin/style.css) right? I haven't finished creating this function, so it probably doesn't even work as expected right now. I'm still trying to grasp this whole system but here is the login function and displayUsername function: Code: public function displayUsername ($username) { Couple Questions - El Forum - 05-23-2012 [eluser]the_unforgiven[/eluser] in your config file Code: $config['base_url'] = ''; Code: $config['base_url'] = 'http://localhost/yoursite'; or just type your domain if your doing it l;ive An you functions look fine to me Couple Questions - El Forum - 05-23-2012 [eluser]mfroseth[/eluser] [quote author="the_unforgiven" date="1337805311"]in your config file Code: $config['base_url'] = ''; Code: $config['base_url'] = 'http://localhost/yoursite'; or just type your domain if your doing it l;ive An you functions look fine to me [/quote] Thanks, but how do I output the function for displaying the username of who is logged in on a view page? Is there a special way to do this with CI? Thanks Couple Questions - El Forum - 05-23-2012 [eluser]mfroseth[/eluser] Edit: nevermind, had wrong URL. Wouldn't work if I had these stored inside the application/views folder. Couple Questions - El Forum - 05-24-2012 [eluser]mfroseth[/eluser] Anybody? Couple Questions - El Forum - 05-24-2012 [eluser]Samus[/eluser] [quote author="mfroseth" date="1337864716"]Anybody? [/quote] store it in a session and then retrieve it? Couple Questions - El Forum - 05-24-2012 [eluser]mfroseth[/eluser] [quote author="Samus" date="1337866174"][quote author="mfroseth" date="1337864716"]Anybody? [/quote] store it in a session and then retrieve it?[/quote] This is my code, however I can't get it to display for the life of me: Code: function displayUsername () Couple Questions - El Forum - 05-24-2012 [eluser]mfroseth[/eluser] [quote author="mfroseth" date="1337868534"][quote author="Samus" date="1337866174"][quote author="mfroseth" date="1337864716"]Anybody? [/quote] store it in a session and then retrieve it?[/quote] This is my code, however I can't get it to display for the life of me: Code: function displayUsername () Gah, stupid typos. Had $user_id in single quotes for my $query. |