![]() |
A really simple question - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: A really simple question (/showthread.php?tid=8705) Pages:
1
2
|
A really simple question - El Forum - 05-28-2008 [eluser]daulex[/eluser] Ok, I'm a real newbie to coding/developing (I'm a designer with 6 years behind my back in photoshop and xhmtl), but I am getting quite bored with it and I decided to learn php(and everything that comes with it like mysql and ajax stuff), thought to start up with php.com, but then found out about codeigniter.com and the CI framework, man this stuff rocks, can't wait to learn a bit more and push it as far as I could. So, to begin with, I went and watched both the tutorials that you got on the main page, built the blog and it was working and yeah, everything is great, I'm getting the hang of functions and more or less how CI works, however I still don't know the basics and its obvious that its hard to run without being able to walk properly... So I wanted to understand how to call content from the database one by one, I learned this way: Code: function index () { Code: <title><?=$title?></title> So there probably is a better(and/or faster) way to do it, the database structure I am using (no idea if this is the proper way or not) is: Code: -- phpMyAdmin SQL Dump Oh wise ones please give me advice on what would be the best thing to do ![]() A really simple question - El Forum - 05-28-2008 [eluser]GSV Sleeper Service[/eluser] I'm not sure what you're asking, but the example code looks fine for what you're trying to accomplish. A really simple question - El Forum - 05-28-2008 [eluser]daulex[/eluser] not really, Code: function index () { this looks at the uri to find out what I need, unless I set up a forward, it will display all results on index, understand now? cheers A really simple question - El Forum - 05-28-2008 [eluser]krwl[/eluser] [quote author="daulex" date="1211994284"]not really, this looks at the uri to find out what I need, unless I set up a forward, it will display all results on index, understand now? [/quote] sorry for my bad understanding, but what do you want to achieve from the script? oh, and maybe you want to learn about CI model to separate database access from controller ![]() A really simple question - El Forum - 05-28-2008 [eluser]Pascal Kriete[/eluser] So what you're saying is, you want blog/index/some-title and blog/some-title to both show the same thing. As they should. Or am I missing something? A really simple question - El Forum - 05-28-2008 [eluser]daulex[/eluser] Sorry for being confusing guys, thanks for A really simple question - El Forum - 05-29-2008 [eluser]daulex[/eluser] My internet was bust yesterday ![]() Sorry for being confusing guys, thanks for trying ![]() All I am trying to achieve is to have a basic web site, simply 4 pages, with url's like: /ci/index.php/site/aboutus /ci/index.php/site/services /ci/index.php/site/clients /ci/index.php/site/contactus and I can do that, everything works (via the foreach and $this->db->where('title',$this->uri->segment(2));, so the title of the page matches the second bit(from index.php) of the url of the page, thus if the title field in the db is services and the url bit is services, in the foreach the body bit gives me the body that matches the services, so I get the correct content. (look through the sql dump and links ![]() and that is awesome ![]() Quote:aboutus That's not good ![]() HELP ![]() ![]() A really simple question - El Forum - 05-29-2008 [eluser]gunter[/eluser] you can do this by routing (look under routing) or with the _remap function (look for remapping function calls - in the docs) another quick solution would be this: Code: function index() A really simple question - El Forum - 05-29-2008 [eluser]daulex[/eluser] pasted that into site.php (which is my controller) and: Code: <div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;"> A really simple question - El Forum - 05-29-2008 [eluser]Pascal Kriete[/eluser] gunter's snippet doesn't define the $data['title'] variable anymore. So you have to add that line to the _db_and_view function: Code: $data['title'] = "Galenko.co.uk - ".$title; |