GetSimple Support Forum
Double Slash in get_page_url - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: Double Slash in get_page_url (/showthread.php?tid=57)



Double Slash in get_page_url - stever - 2009-08-14

Hi Guys,

Xampp server, version 1.4 getsimple. Using the default theme, with a page called 'suzuki-jeep' under the parent page of 'cars'. I get a double slash as below between the parent and subpage.

http://localhost/getsimple/cars//suzuki-jeep | Saved Thursday, August 13th, 2009 - 8:12 PM

I presume it should have one slash, I have taken a look at the <?php get_page_url(); ?> function but I am just starting with PHP so not sure what I am looking at/for.

Blown away with this cms, I have been looking around for a simple flat cms for yonks and this fits the bill perfectly.


Double Slash in get_page_url - Derek - 2009-08-14

It's the way that parent is being matched here:
Code:
function get_page_url() {
        global $url;
        global $SITEURL;
        global $PRETTYURLS;
        global $parent;
        
        if ($PRETTYURLS == '1') {
            if ($parent != '') {$parent = $parent."/"; }

            if ($url == 'index' ) { $url = ''; }
            echo $SITEURL . @$parent ;
        } else {
            echo $SITEURL .'index.php?id='.$url;
        }
        
    }
Trying to figure out a better way to do it without regex right now


Double Slash in get_page_url - Derek - 2009-08-14

This works for me:
Code:
function get_page_url() {
        global $url;
        global $SITEURL;
        global $PRETTYURLS;
        global $parent;
        
        if ($PRETTYURLS == '1') {
            if ($url == 'index' ) { $url = ''; }
            echo $SITEURL . @$parent  . $url ;
        } else {
            echo $SITEURL .'index.php?id='.$url;
        }
        
    }

This is in theme_functions.php, line 65. haven't tried it without prettyurls yet.


Double Slash in get_page_url - stever - 2009-08-14

Hi Derek,

Mod works fine with pretty URLs

http://localhost/getsimple/cars/suzuki-jeep | Saved Thursday, August 13th, 2009 - 8:12 PM

Thanks
Steve


Double Slash in get_page_url - ccagle8 - 2009-08-14

I think I know what's happening here and dereks fix is it. I created a funtion tsl() that puts a trailing slash on urls, but I also add on in the code, which derek removed. Thanks guys!


Double Slash in get_page_url - stever - 2009-08-15

Hi, ugraded to 1.5.

Now the parent page shows;
http://localhost/getsimple//cars | Saved Thursday, August 13th, 2009 - 11:10 PM

And the child page shows;
http://localhost/getsimple/cars/suzuki-jeep | Saved Thursday, August 13th, 2009 - 8:12 PM

I must admit, I didn't pay much attention to what happened to the parent when Derek posted the fix as I was focusing on the child, it must have been OK or I would have noticed it, but anyway as you can see now we have a double slash on the parent.

Steve


Double Slash in get_page_url - ccagle8 - 2009-08-16

thanks steve. I thought i had it fixed, but i guess not. Let me look into this more. I am not really sure how that second slash is getting there in the first place. I should have to add that slash to work.... hmmmm.


Double Slash in get_page_url - Derek - 2009-08-17

Steve, try deleting everything in your admin/inc folder, re-upload those files form the current version, and then post the results


Double Slash in get_page_url - Derek - 2009-08-18

I am getting the error on parent items now too. Chris, did you change your TSL function or anything else?