2013-01-18 53 views
0

我試圖創建一個菜單項,根據登錄的用戶動態更改。爲什麼我的菜單項不顯示?

這裏是我的模塊中的代碼:

<?php 
global $user; 
$current_uid = $user->uid; 
$current_name - $user->name; 
function willmodule_menu(){ 
$techprofile = 'tech=profile/' . $current_uid . '/' . $current_name; 
$items['$techprofile'] = array(
    'menu_name' => 'menu-tech-account-menu', 
    'title'=>'View Your Tech Profile', 
); 
return $items; 
} 
?> 

我不知道我做錯了什麼。我的菜單項甚至沒有顯示出來。不過,從另一方面來說,它並沒有打破我的網站。

回答

0

那麼有同時發佈幾件事情無論是拼寫錯誤或實際的錯誤代碼:

1. $current_name - $user->name; //change dash to = sign? 
    2. $items['$techprofile'] //use double quotes instead of single quotes when 
          //using php variables 
+0

這是真的,我以前也有頭髮拉挫折是由於簡單的錯別字,但即使解決這兩個沒有幫助我出去了。 – willrichir

相關問題