Writing PHP code to creating menu in block show and alert I have a menu in a block and this is my code in that block that is in sidebar second:

&lt;?php
  $url=$base_url.'/drupal';
  echo
  '&lt;ul&gt;
  &lt;li&gt;&lt;a href="'.$url.'/article/1"&gt;One&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt; &lt;a href="'.$url.'/article/2"&gt;Two&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;';
?&gt;


it is working correctly, but return and red alert:


  Notice: Undefined variable: base_url in eval() (line 2 of C:\xampp\htdocs\drupal\modules\php\php.module(80) : eval()'d code).
You need to define it as a global variable first: 

global $base_url;


So that your code is now: 

&lt;?php
global $base_url;
$url=$base_url.'/drupal';
echo
'&lt;ul&gt;
&lt;li&gt;&lt;a href="'.$url.'/article/1"&gt;One&lt;/a&gt;&lt;/li&gt;
&lt;li&gt; &lt;a href="'.$url.'/article/2"&gt;Two&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;';
?&gt;


Then you may don't need drupal in your $url variable. and it would become:

$url=$base_url;