[英]Unable to refer css file in Drupal 6 theme for formatting a table
我一直在嘗試將CSS應用於我的Drupal頁面,但是我所做的更改沒有體現出來。 以下是我的頁面(儀表板頁面) http://www.image-share.com/ijpg-1145-262.html的屏幕截圖。 我的目標是格式化表列表,使其一次顯示10行,以便該表可滾動以查看所有行(而不是現在如何分布在整個頁面上)。 下面給出的是代碼。
function freeway_dashboard(){
drupal_add_css(drupal_get_path('module', 'freeway_module') .'/css/dashboard_file.css');
//echo(drupal_get_path('module', 'freeway_module') .'/css/dashboard_file.css');
drupal_add_js(drupal_get_path('module', 'freeway_module') .'/js/dashboardscript.js');
$listOfProjectsIds = array();
$listOfProjectsDesc = array();
$node = node_load(arg(1));
$form = array();
$arrayStatus = array(1 =>'Draft',2=>'NotSpecified',3=>'Quote',4=>'Forecasted',5=>'InEvaluation',6=>'Cancelled',7=>'Booked',8=>'InProduction',9=>'Completed',10=>'Closed');
$LoginClient = new SoapClient("https://freeway.demo.lionbridge.com/vojo/FreewayAuth.asmx?wsdl", array("trace"=>1));
$ServicesLink = new SoapClient("https://freeway.demo.lionbridge.com/vojo/Service.asmx?wsdl", array("trace"=>1));
try{
$arrResponse = $LoginClient->Logon(array ('Username'=>'user','Password'=>'Password'));
$ticket = ($arrResponse->LogonResult);
$getSrcLang = $ServicesLink->GetSourceLanguages(array('Ticket'=>$ticket));
$getDraftProjectIds = $ServicesLink->GetProjectSummariesList(array('Ticket'=>$ticket,'NumberOfProjects'=>100,'SortOrder'=>MostRecent,'ProjectStatusCode'=>'Draft'));
foreach ($getDraftProjectIds->GetProjectSummariesListResult->ProjectSummaries->ProjectSummary as $i=>$getDraftProjectIds->GetProjectSummariesListResult->ProjectSummaries->ProjectSummary)
{
$listOfProjectsIds[$i] = $getDraftProjectIds->GetProjectSummariesListResult->ProjectSummaries->ProjectSummary->ID;
$listOfProjectsDesc[$i] = $getDraftProjectIds->GetProjectSummariesListResult->ProjectSummaries->ProjectSummary->Description;
}
}
catch (SoapFault $exception){
return $exception;
}
$form['status_list']=array(
'#type'=>'select',
'#title' => t('Freeway Project Statuses'),
'#options' => $arrayStatus,
'#default_value' => ('Draft'),
'#attributes'=> array('onselect' => "populateStatusTables();"),
'#weight'=>3,
);
$header = array('Project ID', 'Project Description');
$rows = array();
for($m=0;$m <count($listOfProjectsIds);$m+=1){
$rows[$m] = array($listOfProjectsIds[$m], $listOfProjectsDesc[$m]) ;
}
$form['table'] = array(
'#value' => theme('table', $header, $rows, array( 'class' => 'table_class','id'=>'dashboard_Table')),
//'#value' => '<div class="table_class_wrapper">'. theme('table', $header, $rows, array('class' => 'table_class','id'=>'dashboard_Table')) .'</div>',
'#weight' => 4,
);
return $form;
}
我已經在$ form ['table']元素的值中提到了css類代碼。 我試圖通過以下方式使用css包含:
drupal_add_css(drupal_get_path('module', 'freeway_module') .'/css/dashboard_file.css');
css文件位於“ C:\\ xampp \\ htdocs \\ drupalTheme \\ sites \\ all \\ modules \\ freeway_module \\ css”處。 以下是css文件中的代碼。
.table_class {
height: 200px;
overflow: auto;
}
但是我仍然認為代碼無法訪問css文件。 我包括的文件正確嗎? 期待您的建議。
謝謝安吉拉。
嘗試使用CSS的絕對路徑,而不是相對路徑。 只需弄清楚CSS文件在服務器上的位置並指向它即可...然后,您可以回溯並弄清楚相對路徑應該是什么。
drupal_add_css()
調用更改為以下內容: $path = drupal_get_path('module', 'freeway_module'); dpm($path . '/css/dashboard_file.css'); drupal_add_css($path . '/css/dashboard_file.css');
祝好運!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.