Welcome Guest, Not a member yet? Register   Sign In
Question About URI's
#1

[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.
#2

[eluser]jedd[/eluser]
[quote author="ShoeLace1291" date="1263034603"]
... but it didn't seem to work.
[/quote]

What does 'didn't seem to work' actually mean?

Have a read about [url="http://codeigniter.com/wiki/How_to_ask_a_good_question/"]asking good questions[/url].
#3

[eluser]richfearless[/eluser]
maybe use an ID instead of the title in your URI?
pages/news/site/Site-Under-Construction -> pages/news/site/10

10 = site-under-construction content in database




Theme © iAndrew 2016 - Forum software by © MyBB