GetSimple Support Forum

Full Version: Undefined Variable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!

when I try to load the index page with flag debug actived I obtain:

Notice: Undefined variable: inter in /var/www/getsimple/admin/inc/theme_functions.php on line 96
Notice: Undefined variable: slugs in /var/www/getsimple/admin/inc/theme_functions.php on line 235
Notice: Undefined variable: slugs in /var/www/getsimple/admin/inc/theme_functions.php on line 238

the only code i have written is:

Code:
<head>
  
  <?php get_header(); ?>
  
  
</head>
<body>
  
  <?php $data = menu_data(); ?>
  
</body>
</html>

I can't run this function http://get-simple.info/forum/viewtopic.php?id=235 because the variable slug is always empty and url lacks of slug. I try to print the array with this code:

Code:
<head>
  
  <?php get_header(); ?>
  
  
</head>
<body>
  
  <?php $data = menu_data(); print("<pre>".print_r($data,true)."</pre>"); ?>
  
</body>

and this is tue output:

Code:
Array
(
    [0] => Array
        (
            [slug] =>
            [url] => http://192.168.0.2/getsimple/index.php?id=
            [parent_slug] => rooms
            [title] => Room A
            [menu_priority] => 0
            [menu_text] => Room A
            [menu_status] =>
            [private] =>
            [pub_date] => Wed, 03 Feb 2010 15:31:11 +0100
        )

    [1] => Array
        (
            [slug] =>
            [url] => http://192.168.0.2/getsimple/index.php?id=
            [parent_slug] =>
            [title] => Choose Your Room
            [menu_priority] => 0
            [menu_text] => Rooms
            [menu_status] => Y
            [private] =>
            [pub_date] => Wed, 03 Feb 2010 15:30:15 +0100
        )

    [2] => Array
        (
            [slug] =>
            [url] => http://192.168.0.2/getsimple/index.php?id=
            [parent_slug] =>
            [title] => Index
            [menu_priority] => 1
            [menu_text] => Home
            [menu_status] =>
            [private] =>
            [pub_date] => Wed, 03 Feb 2010 16:31:01 +0100
        )

)

The field 'slug' is always blank. The structure of pages is like:

+--index
|
---rooms
|
---room A

rooms ha slug 'rooms' and room a has slug 'room-a'

I cant' solve this problem, could you help me?

I'm running on Getsimple 2.0



Thank you

Pole
does the same thing happen when you have fancy urls turned ON?
ccagle8 Wrote:does the same thing happen when you have fancy urls turned ON?
It works with fancy urls turned on.

Thank You

Pole
daniele.polencic Wrote:
ccagle8 Wrote:does the same thing happen when you have fancy urls turned ON?
It works with fancy urls turned on.

Thank You

Pole

The "bug" is here:

Code:
if ($PRETTYURLS == '1') {
                        if ($parent != '') {$parent = tsl($parent); }
                        if ($slug == 'index' ) { $slugs = ''; } else { $slugs = $slug; }
                        $url = $SITEURL . @$parent . $slugs;
                    } else {
                        $url = $SITEURL .'index.php?id='.$slugs;
                    }

And I changed it to:

Code:
if ($slug == 'index' ) { $slugs = ''; } else { $slugs = $slug; }
if ($PRETTYURLS == '1') {
                        if ($parent != '') {$parent = tsl($parent); }
                        $url = $SITEURL . @$parent . $slugs;
                    } else {
                        $url = $SITEURL .'index.php?id='.$slugs;
                    }

And it works. Thank you

Pole
Thanks! I will add it in and test it...
Hello,

I started using GetSimple CMS as of yesterday and really like it, so far. However, when building my own menu via the menu_data() function I got the same error mentioned in the opening post.

When I looked for a solution I looked at the line specified by the PHP error output and saw that all I had to do was to change $slugs into $slug to make the function not return any erros but the slugs instead :-)

I don't know if that is all there is to it but it works for me and you might want to fix that bug (if it is one) in your next release.

Thanks for an awesome piece of software,
Jan
It should already be fixed in the last beta version, the next stable release is close so the bug will not exist once that one gets out.

Thanks for noticing.