Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Overlook determine global variable
#1
In GetSimple v2 I have found overlook determine global variable:

admin\inc\theme_functions.php; function get_page_url (); line 74: I have add global $inter;
Without it the page title in header is incomplete.

Code:
function get_page_url($a=false) {
    global $inter;
    global $url;
    global $SITEURL;
    global $PRETTYURLS;
    global $parent;
    if ($parent != '' ) { $parent = tsl($parent); }
    if ($url == 'index' ) { $urls = ''; } else { $urls = $url; }
    
    if ($PRETTYURLS == '1') {
        if (!$a) {
            echo $SITEURL . $parent . $urls;
        } else {
            return $SITEURL . $parent . $urls;
        }
    } else {
        if (!$a) {
            if ($urls != '') {
                $inter = 'index.php?id=';
            } else {
                $inter = '';
            }
            echo $SITEURL . $inter . $urls;
            } else {
            return $SITEURL . $inter . $urls;
        }
    }
    
}
Reply
#2
I wonder why, we set $inter in the function itself. Why would it need to be global?

Code:
if ($urls != '') {
                $inter = 'index.php?id=';
            } else {
                $inter = '';
            }
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#3
no, you determine $inter in first IF, but in last ELSE the $inter is null. See last ELSE

Code:
if (!$a)
       {
    if ($urls != '')
              $inter = 'index.php?id=';
    else
              $inter = '';
    echo $SITEURL . $inter . $urls;
    }
else
    return $SITEURL . $inter . $urls;
Reply
#4
you are right, but I think i would fix it another way:

Code:
function get_page_url($a=false) {
    global $inter;
    global $url;
    global $SITEURL;
    global $PRETTYURLS;
    global $parent;
    if ($parent != '' ) { $parent = tsl($parent); }
    if ($url == 'index' ) { $urls = ''; } else { $urls = $url; }
    
    if ($PRETTYURLS == '1') {
        if (!$a) {
            echo $SITEURL . $parent . $urls;
        } else {
            return $SITEURL . $parent . $urls;
        }
    } else {

       if ($urls != '') {
          $inter = 'index.php?id=';
       } else {
          $inter = '';
       }

        if (!$a) {
            echo $SITEURL . $inter . $urls;
        } else {
            return $SITEURL . $inter . $urls;
        }
    }
    
}
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#5
haha, this was already fixed in 2.01
Code:
function get_page_url($a=false) {
        global $url;
        global $SITEURL;
        global $PRETTYURLS;
        global $parent;

        if (!$a) {
            echo find_url($url, $parent);
        } else {
            return find_url($url, $parent);
        }
        
    }
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#6
cool! Smile
Reply




Users browsing this thread: 1 Guest(s)