[eluser]ShoeLace1291[/eluser]
I have a url like this: pages/news/site/Site-Under-Construction
When I visit this url, I have a link to the admin page that can edit this news article. If the admin edits the title, I want to change the uri that's stored in the database to correspond with the new title. Right now, all my script does is change the title, but I need to change the uri that's stored in the database to fit the new title. The problem is, when I edit the page, I'm at the uri admin/pages/modify/8 the last segment being the id. I would use the uri_string function but that gets the current url.
so basically what I need to do is get pages/news/site/ out of the database stored uri.
I tried something like below, but it didn't seem to work.
Code:
$titleurl = url_title($this->page->title($pageid));
$titlelength = strlen($titleurl);
$totallength = strlen($this->page->seourl($pageid));
$end = $totallength - $titlelength -1;
if($_POST['title'] != $this->page->title($pageid)){
$seourl = substr($this->page->seourl($pageid). 0, $end);
} else {
$seourl = $this->page->seourl($pageid);
}
$this->page->title($pageid) gets the title of the page based on the id.