[英]Unable to refer css file in Drupal 6 theme for formatting a table
I have been trying to work with applying css to a Drupal page of mine but the changes i do do not reflect. 我一直在尝试将CSS应用于我的Drupal页面,但是我所做的更改没有体现出来。 The following is the screenshot of my page (a dashboard page) http://www.image-share.com/ijpg-1145-262.html .
以下是我的页面(仪表板页面) http://www.image-share.com/ijpg-1145-262.html的屏幕截图。 My aim is to format the table listing to show 10 rows at a time so that the table is scrollable to view all the rows (rather than how its spread across the entire page now).
我的目标是格式化表列表,使其一次显示10行,以便该表可滚动以查看所有行(而不是现在如何分布在整个页面上)。 The below given is the code.
下面给出的是代码。
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;
}
I have given the css class mention to the code at $form['table'] element in its value. 我已经在$ form ['table']元素的值中提到了css类代码。 I have tried to use the css inclusion using:
我试图通过以下方式使用css包含:
drupal_add_css(drupal_get_path('module', 'freeway_module') .'/css/dashboard_file.css');
The css file is placed at 'C:\\xampp\\htdocs\\drupalTheme\\sites\\all\\modules\\freeway_module\\css'. css文件位于“ C:\\ xampp \\ htdocs \\ drupalTheme \\ sites \\ all \\ modules \\ freeway_module \\ css”处。 The following is the code in the css file.
以下是css文件中的代码。
.table_class {
height: 200px;
overflow: auto;
}
But still i guess the code is not able to access the css file. 但是我仍然认为代码无法访问css文件。 Am i including the file correct?
我包括的文件正确吗? Looking forward for your advice.
期待您的建议。
Thanks Angela. 谢谢安吉拉。
Try using an absolute path to the CSS rather than a relative path. 尝试使用CSS的绝对路径,而不是相对路径。 Just figure out exactly where the CSS file is on the server and point to it... Then, you can backtrack and figure out what the relative path should be.
只需弄清楚CSS文件在服务器上的位置并指向它即可...然后,您可以回溯并弄清楚相对路径应该是什么。
drupal_add_css()
call to something like the following: drupal_add_css()
调用更改为以下内容: $path = drupal_get_path('module', 'freeway_module'); dpm($path . '/css/dashboard_file.css'); drupal_add_css($path . '/css/dashboard_file.css');
Good luck! 祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.