[eluser]JimmyJ[/eluser]
Think i posted this in the wrong thread before:-
Hey folks
I was wondering if anyone could help me. Trying to work out cl, but having a few troubles just getting to grips with it (never used a framework before).
Anyway, i'm pulling data from a database, and trying to format the string into seo urls and pass the id.
Here's my code for welcome.php
Code:
<?php
class Welcome extends Controller {
function Welcome()
{
parent::Controller();
}
function index()
{
$this->load->database();
$sql = "SELECT region_id, region_name FROM regions ORDER BY region_id ASC";
$regions['query'] = $this->db->query($sql);
$this->load->view('home', $regions);
}
}
?>
and here's the code for home.php
Code:
<ul>
<?php foreach($query->result() as $region): ?>
<li><a href="/detail/<?php echo $region->region_name; ?>/<?php echo $region->region_id; ?>/property-in-<?php echo $region->region_name; ?>.html"><?php echo $region->region_name; ?></a></li>
<?php endforeach;?>
</ul>
As you can see home.php is a mess. I would like to format the urls, lowercase and hyphens within the index function in welcome.php
Can anyone give me any tips to work this out?
Thanks