I have this code,
#if ($browserSniffer.isIe($request) && $browserSniffer.getMajorVersion($request) < 8)
in my page layouts in Liferay to tell them to use table based Layouts for browser IE 7, but I get the following warning:
Invalid character used in text string ( #if($browserSniffer.isIe($request) && $browserSniffer.getMajorVersion($request) < 8) ).
The problem seems to be the AND (&&) parameter, but I don't see any problem in that. So, I would be grateful if someone could tell me what the problem is.
Thanks in advance, Adia.
UPDATE: The layout file
<div class="default-page-template" id="main-content" role="main">
#if ($browserSniffer.isIe($request) && $browserSniffer.getMajorVersion($request) < 8)
<table class="portlet-layout">
<tr>
<td class="portlet-column portlet-column-first" id="column-1">
$processor.processColumn("column-1", "portlet-column-content portlet-column-content-first")
</td>
<td class="portlet-column portlet-column-last" id="column-2">
$processor.processColumn("column-2", "portlet-column-content portlet-column-content-last")
</td>
</tr>
</table>
<table>
<tr>
<td class="portlet-column portlet-column-first" id="column-3">
$processor.processColumn("column-3", "portlet-column-content portlet-column-content-first")
</td>
</tr>
</table>
<table class="portlet-layout">
<tr>
<td class="portlet-column portlet-column-first" id="column-4">
$processor.processColumn("column-4", "portlet-column-content portlet-column-content-first")
</td>
<td class="portlet-column" id="column-5">
$processor.processColumn("column-5", "portlet-column-content portlet-column-content-last")
</td>
<td class="portlet-column portlet-column-last" id="column-6">
$processor.processColumn("column-6", "portlet-column-content portlet-column-content-last")
</td>
</tr>
</table>
<table class="portlet-layout">
<tr>
<td class="portlet-column portlet-column-last" id="column-7">
$processor.processColumn("column-7", "portlet-column-content portlet-column-content-last")
</td>
</tr>
</table>
#else
<div class="portlet-layout">
<div class="portlet-column portlet-column-first" id="column-1">
$processor.processColumn("column-1", "portlet-column-content portlet-column-content-first")
</div>
<div class="portlet-column portlet-column-last" id="column-2">
$processor.processColumn("column-2", "portlet-column-content portlet-column-content-last")
</div>
</div>
<div class="portlet-layout">
<div class="portlet-column portlet-column-first" id="column-3">
$processor.processColumn("column-3", "portlet-column-content portlet-column-content-first")
</div>
</div>
<div class="portlet-layout">
<div class="portlet-column portlet-column-first" id="column-4">
$processor.processColumn("column-4", "portlet-column-content portlet-column-content-first")
</div>
<div class="portlet-column" id="column-5">
$processor.processColumn("column-5", "portlet-column-content portlet-column-content-last")
</div>
<div class="portlet-column portlet-column-last" id="column-6">
$processor.processColumn("column-6", "portlet-column-content portlet-column-content-last")
</div>
</div>
<div class="portlet-layout">
<div class="portlet-column portlet-column-first" id="column-7">
$processor.processColumn("column-7", "portlet-column-content portlet-column-content-first")
</div>
</div>
#end
</div>
You can easily determine and workaround the && problem, if that's indeed the problem - though it'd be the way that velocity handles logical operators:
#if ($browserSniffer.isIe($request))
#if($browserSniffer.getMajorVersion($request) < 8)
... (your stuff here)
#end
#end
If it isn't at least you get the new error message in only half the statement and can continue debugging from there.
In what kind of file do you have this? Layout-Template? Theme?
Related
There is a page with tables of statistics I'm trying to pull.
The page has the default year as 2020, with a dropdown box to select different years. I wrote this code to select 2009.
from selenium import webdriver as wd
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from pandas.io.html import read_html
from selenium.webdriver.support.ui import Select
import numpy as np
import re
import pandas as pd
driver=wd.Chrome()
driver.implicitly_wait(10)
driver.get('https://www.cpbl.com.tw/standings/history')
select = Select(driver.find_element_by_id('Year'))
# select by visible text
select.select_by_visible_text('2009')
button = driver.find_elements_by_xpath("//input[#value='查詢']")[0]
button.click()
main=driver.find_elements_by_xpath('//*[(#id = "PageListContainer")]')[0]
main_att=main.get_attribute('innerHTML')
tab=pd.read_html(main_att)
I purposely didn't say driver.close() to leave the browser open, so I can look at it, and apparently the selection of 2009 worked. The browser had tables for 2009. However, the data my code pulled was still from the default year (2020). I want data from 2009. Anyone know why?
I am using Python 3.7 and Spyder 4.0.1
To select 2009 from the html-select and extract the innerHTML of the PageListContainer you need to induce WebDriverWait for the visibility_of_element_located() and you can use either of the following Locator Strategies:
Code Block:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
driver.get("https://www.cpbl.com.tw/standings/history")
Select(WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, "select#Year")))).select_by_visible_text("2009")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[#value='查詢']"))).click()
print(WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, "//div[#id = 'PageListContainer']"))).get_attribute("innerHTML"))
Console Output:
<!--上半季戰績-->
<div class="RecordTableWrap">
<div class="record_table_caption">上半季戰績</div>
<div class="record_table_swipe_guide" style="display: none;">
<div class="desktop"></div>
<div class="mobile"></div>
</div>
<div class="record_table_scroll_ctrl" style="display: none;">
</div>
<div class="RecordTableOuter">
<div class="RecordTable">
<table>
<tbody><tr>
<th class="sticky">
<div class="sticky_wrap">
<div class="rank">排名</div>
<div class="team-w-trophy">球隊</div>
</div>
</th>
<th class="num">出賽數</th>
<th class="num">勝-和-敗</th>
<th class="num">勝率</th>
<th class="num">勝差</th>
<th class="num">中信兄弟</th>
<th class="num">樂天桃猿</th>
<th class="num">統一7-ELEVEn獅</th>
<th class="num">富邦悍將</th>
<th class="num">主場戰績</th>
<th class="num">客場戰績</th>
</tr>
<tr>
<td class="sticky">
<div class="sticky_wrap">
<div class="rank">1</div>
<div class="team-w-trophy">
中信兄弟
</div>
</div>
</td>
<td class="num">60</td>
<td class="num">37-0-23</td>
<td class="num">0.617</td>
<td class="num">-</td>
<td class="num"> </td>
<td class="num">8-0-12</td>
<td class="num">16-0-4</td>
<td class="num">13-0-7</td>
<td class="num">18-0-12</td>
<td class="num">19-0-11</td>
</tr>
<tr>
<td class="sticky">
<div class="sticky_wrap">
<div class="rank">2</div>
<div class="team-w-trophy">
樂天桃猿
</div>
</div>
</td>
<td class="num">60</td>
<td class="num">34-0-26</td>
<td class="num">0.567</td>
<td class="num">3</td>
<td class="num">12-0-8</td>
<td class="num"> </td>
<td class="num">9-0-11</td>
<td class="num">13-0-7</td>
<td class="num">18-0-12</td>
<td class="num">16-0-14</td>
</tr>
<tr>
<td class="sticky">
<div class="sticky_wrap">
<div class="rank">3</div>
<div class="team-w-trophy">
統一7-ELEVEn獅
</div>
</div>
</td>
<td class="num">60</td>
<td class="num">26-0-34</td>
<td class="num">0.433</td>
<td class="num">11</td>
<td class="num">4-0-16</td>
<td class="num">11-0-9</td>
<td class="num"> </td>
<td class="num">11-0-9</td>
<td class="num">13-0-17</td>
<td class="num">13-0-17</td>
</tr>
<tr>
<td class="sticky">
<div class="sticky_wrap">
<div class="rank">4</div>
<div class="team-w-trophy">
富邦悍將
</div>
</div>
</td>
<td class="num">60</td>
<td class="num">23-0-37</td>
<td class="num">0.383</td>
<td class="num">14</td>
<td class="num">7-0-13</td>
<td class="num">7-0-13</td>
<td class="num">9-0-11</td>
<td class="num"> </td>
<td class="num">13-0-17</td>
<td class="num">10-0-20</td>
</tr>
</tbody></table>
</div>
</div>
</div>
<!--上半季戰績 end-->
<!--下半季戰績-->
<div class="RecordTableWrap">
<div class="record_table_caption">下半季戰績</div>
<div class="record_table_swipe_guide" style="display: none;">
<div class="desktop"></div>
<div class="mobile"></div>
</div>
<div class="record_table_scroll_ctrl" style="display: none;">
</div>
<div class="RecordTableOuter">
<div class="RecordTable">
<table>
<tbody><tr>
<th class="sticky">
<div class="sticky_wrap">
<div class="rank">排名</div>
<div class="team-w-trophy">球隊</div>
</div>
</th>
<th class="num">出賽數</th>
<th class="num">勝-和-敗</th>
<th class="num">勝率</th>
<th class="num">勝差</th>
<th class="num">中信兄弟</th>
<th class="num">樂天桃猿</th>
<th class="num">統一7-ELEVEn獅</th>
<th class="num">富邦悍將</th>
<th class="num">主場戰績</th>
<th class="num">客場戰績</th>
</tr>
<tr>
<td class="sticky">
<div class="sticky_wrap">
<div class="rank">1</div>
<div class="team-w-trophy">
統一7-ELEVEn獅
</div>
</div>
</td>
<td class="num">60</td>
<td class="num">32-1-27</td>
<td class="num">0.542</td>
<td class="num">-</td>
<td class="num">13-1-6</td>
<td class="num">10-0-10</td>
<td class="num"> </td>
<td class="num">9-0-11</td>
<td class="num">16-0-14</td>
<td class="num">16-1-13</td>
</tr>
<tr>
<td class="sticky">
<div class="sticky_wrap">
<div class="rank">2</div>
<div class="team-w-trophy">
富邦悍將
</div>
</div>
</td>
<td class="num">60</td>
<td class="num">31-1-28</td>
<td class="num">0.525</td>
<td class="num">1</td>
<td class="num">9-1-10</td>
<td class="num">11-0-9</td>
<td class="num">11-0-9</td>
<td class="num"> </td>
<td class="num">15-1-14</td>
<td class="num">16-0-14</td>
</tr>
<tr>
<td class="sticky">
<div class="sticky_wrap">
<div class="rank">3</div>
<div class="team-w-trophy">
中信兄弟
</div>
</div>
</td>
<td class="num">60</td>
<td class="num">30-2-28</td>
<td class="num">0.517</td>
<td class="num">1.5</td>
<td class="num"> </td>
<td class="num">14-0-6</td>
<td class="num">6-1-13</td>
<td class="num">10-1-9</td>
<td class="num">16-1-13</td>
<td class="num">14-1-15</td>
</tr>
<tr>
<td class="sticky">
<div class="sticky_wrap">
<div class="rank">4</div>
<div class="team-w-trophy">
樂天桃猿
</div>
</div>
</td>
<td class="num">60</td>
<td class="num">25-0-35</td>
<td class="num">0.417</td>
<td class="num">7.5</td>
<td class="num">6-0-14</td>
<td class="num"> </td>
<td class="num">10-0-10</td>
<td class="num">9-0-11</td>
<td class="num">16-0-14</td>
<td class="num">9-0-21</td>
</tr>
</tbody></table>
</div>
</div>
</div>
<!--下半季戰績 end-->
<!--全年戰績-->
<div class="RecordTableWrap">
<div class="record_table_caption">全年戰績</div>
<div class="record_table_swipe_guide" style="display: none;">
<div class="desktop"></div>
<div class="mobile"></div>
</div>
<div class="record_table_scroll_ctrl" style="display: none;">
</div>
<div class="RecordTableOuter">
<div class="RecordTable">
<table>
<tbody><tr>
<th class="sticky">
<div class="sticky_wrap">
<div class="rank">排名</div>
<div class="team-w-trophy">球隊</div>
</div>
</th>
<th class="num">出賽數</th>
<th class="num">勝-和-敗</th>
<th class="num">勝率</th>
<th class="num">勝差</th>
<th class="num">中信兄弟</th>
<th class="num">樂天桃猿</th>
<th class="num">統一7-ELEVEn獅</th>
<th class="num">富邦悍將</th>
<th class="num">主場戰績</th>
<th class="num">客場戰績</th>
</tr>
<tr>
<td class="sticky">
<div class="sticky_wrap">
<div class="rank">1</div>
<div class="team-w-trophy">
中信兄弟
</div>
</div>
</td>
<td class="num">120</td>
<td class="num">67-2-51</td>
<td class="num">0.568</td>
<td class="num">-</td>
<td class="num"> </td>
<td class="num">22-0-18</td>
<td class="num">22-1-17</td>
<td class="num">23-1-16</td>
<td class="num">34-1-25</td>
<td class="num">33-1-26</td>
</tr>
<tr>
<td class="sticky">
<div class="sticky_wrap">
<div class="rank">2</div>
<div class="team-w-trophy">
樂天桃猿
</div>
</div>
</td>
<td class="num">120</td>
<td class="num">59-0-61</td>
<td class="num">0.492</td>
<td class="num">9</td>
<td class="num">18-0-22</td>
<td class="num"> </td>
<td class="num">19-0-21</td>
<td class="num">22-0-18</td>
<td class="num">34-0-26</td>
<td class="num">25-0-35</td>
</tr>
<tr>
<td class="sticky">
<div class="sticky_wrap">
<div class="rank">3</div>
<div class="team-w-trophy">
統一7-ELEVEn獅
</div>
</div>
</td>
<td class="num">120</td>
<td class="num">58-1-61</td>
<td class="num">0.487</td>
<td class="num">9.5</td>
<td class="num">17-1-22</td>
<td class="num">21-0-19</td>
<td class="num"> </td>
<td class="num">20-0-20</td>
<td class="num">29-0-31</td>
<td class="num">29-1-30</td>
</tr>
<tr>
<td class="sticky">
<div class="sticky_wrap">
<div class="rank">4</div>
<div class="team-w-trophy">
富邦悍將
</div>
</div>
</td>
<td class="num">120</td>
<td class="num">54-1-65</td>
<td class="num">0.454</td>
<td class="num">13.5</td>
<td class="num">16-1-23</td>
<td class="num">18-0-22</td>
<td class="num">20-0-20</td>
<td class="num"> </td>
<td class="num">28-1-31</td>
<td class="num">26-0-34</td>
</tr>
</tbody></table>
</div>
</div>
</div>
<!--全年戰績 end-->
It worked when I used time.sleep(10)
In the process of moving from Bootstrap 3 to Bootstrap 4.2. I have a table inside a Ajax modal screen. Here is the code snippet:
<div class="card-body">
<div class="row">
<table class="table table-hover table-responsive-lg">
<thead>
<tr>
<td class="text-center col-sm-3"><strong>ACTIVITY</strong></td>
<td class="text-center col-sm-3"><strong>QTY</strong></td>
<td class="text-center col-sm-3"><strong>RATE</strong></td>
<td class="text-center col-sm-3"><strong>AMOUNT</strong></td>
</tr>
</thead>
<tbody>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Closing Service" CssClass="form-con"></asp:Label></td>
<td class="text-center ">
<asp:TextBox ID="txtClosing_QTY" runat="server" CssClass="form-control"></asp:TextBox></td>
<td class="text-center ">
<asp:TextBox ID="txtClosing_Rate" runat="server" CssClass="form-control"></asp:TextBox></td>
<td class="text-center ">
<asp:TextBox ID="txtClosing_Total" runat="server" CssClass="form-control" ClientIDMode="Static"></asp:TextBox></td>
</tr>
</tbody>
</table>
</div>
</div>
In my system the columns showing QTY is too small to see the full number, even the number 1.
UPDATE
I changed the headers to col-sm-4 and the results are much the same. Here is an image of the outcome:
UPDATE 2
Suggested adding ROW class to the <tr> results in:
You can try adding class="row" to each tr instead of to the outside div
Example:
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.2.1/css/bootstrap.min.css">
</head>
<body>
<div style="width: 572px;">
<div class="card-body">
<div class="">
<table class="table table-hover table-responsive-lg">
<thead>
<tr class="row">
<td class="text-center col-sm-3"><strong>ACTIVITY</strong></td>
<td class="text-center col-sm-3"><strong>QTY</strong></td>
<td class="text-center col-sm-3"><strong>RATE</strong></td>
<td class="text-center col-sm-3"><strong>AMOUNT</strong></td>
</tr>
</thead>
<tbody>
<tr class="row">
<td class="col-sm-3 text-center "><asp:Label ID="Label1" runat="server" Text="Closing Service" CssClass="form-con"></asp:Label></td>
<td class="text-center col-sm-3">
<asp:TextBox ID="txtClosing_QTY" runat="server" CssClass="form-control"></asp:TextBox></td>
<td class="text-center col-sm-3">
<asp:TextBox ID="txtClosing_Rate" runat="server" CssClass="form-control"></asp:TextBox></td>
<td class="text-center col-sm-3">
<asp:TextBox ID="txtClosing_Total" runat="server" CssClass="form-control" ClientIDMode="Static"></asp:TextBox></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>
I wanted to close this out with a solution that worked for me. It was simple to fix. In the <thead> section of the table I removed the col-sm-3 tag and the table behaved as expected.
Thanks everyone!
I am having a table which contains multiple td/tr.
My problem is label which i want to get doesn't contains input immediately neither that label has any attributes property.
I want to get "Countries of Permanent Residence" and Dates which are in span but doesn't have any properties that span is in div that too doesn't contains any property.
I tried with
formElement[input[name="icims_gh_Permanent_Country_Residence"]]
But don't know how to get associate label.
Html looks like:
<div style="margin:0px">
<table style="width:100%" border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td valign="top">
<div style="margin:0px">
<span style="font-family:arial,helvetica,sans-serif;font-size:12px"> Countries of Permanent Residence (list all) </span>
</div>
</td>
<td valign="top">
<div style="margin:0px">
<span style="font-family:arial,helvetica,sans-serif;font-size:12px"> Dates </span>
</div>
</td>
</tr>
<tr>
<td colspan="2" valign="top">
<div style="margin:0px">
<div>
<input type="hidden" name="icims_gh_Permanent_Country_Residence" value="1">
<a name="0.1_icims_ga_Permanent_Country_Residence"></a>
<div>
<table style="width:100%;border:0px">
<tbody>
<tr>
<td>
<table style="width:100%" border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td valign="top">
<div style="margin:0px">
<span style="font-family:arial,helvetica,sans-serif;font-size:12px">
<input type="text" name="icims_0_permResidenceCountry"> </span>
</div>
</td>
<td valign="top">
<div style="margin:0px">
<span style="font-family:arial,helvetica,sans-serif;font-size:12px">
<input type="text" name="icims_0_permResidenceCountryDates"> </span>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
Imagine situation when you need to have output like this
<table>
<tr class="row">
<td class="cell">First resource</td>
<td class="cell">Second resource</td>
</tr>
<tr class="row">
<td class="cell">Third resource</td>
<td class="cell">Fourth resource</td>
</tr>
<tr class="row">
<td class="cell">Fifth resource</td>
<td class="cell">Sixth resource</td>
</tr>
</table>
or like this
<div class="container">
<div class="row"><!--groups-->
<div class="col-md-6">
First resource
</div>
<div class="col-md-6">
Second resource
</div>
<div class="clearfix"> </div>
</div>
<div class="row"><!--group-->
<div class="col-md-6">
Third resource
</div>
<div class="col-md-6">
Fourth resource
</div>
<div class="clearfix"> </div>
</div>
<div><!--group-->
...
</div>
...
...
</div>
As for me this structures are similar for my purpose. I was looking for examples of the usage of placeholders, but do not get it. Please write the example with getResources or PDOTools or similar.
[[pdoResources?
&parents=`0`
&depth=`1`
&tplFirst=`tplFirst`
&tpl=`tpl`
&tplOdd=`tplOdd`
&tplLast=`tplLast`
&tplWrapper=`tplWrapper`
]]
tplFirst
<tr class="row">
<td class="cell">[[+pagetitle]]</td>
tpl
<td class="cell">[[+pagetitle]]</td>
tplOdd
<td class="cell">[[+pagetitle]]</td>
</tr>
<tr class="row">
tplLast
<td class="cell">[[+pagetitle]]</td>
</tr>
tplWrapper
<table>
[[+output]]
</table>
I am using Liferay 6.1.1 CE.
I am trying to use 1-2-1 layout in my page.
But i cant Drag n Drop portlets to the 2 column in my page.also 1-2-1 is not working properly.
What is the reason?
this is 1_2_1.column.tpl
<div class="columns-1-2-1" id="main-content" role="main">
#if ($browserSniffer.isIe($request) && $browserSniffer.getMajorVersion($request) < 8)
<table class="portlet-layout">
<tr>
<td class="portlet-column portlet-column-only" id="column-1">
$processor.processColumn("column-1", "portlet-column-content portlet-column-content-only")
</td>
</tr>
</table>
<table class="portlet-layout">
<tr>
<td class="aui-w50 portlet-column portlet-column-first" id="column-2">
$processor.processColumn("column-2", "portlet-column-content portlet-column-content-first")
</td>
<td class="aui-w50 portlet-column portlet-column-last" id="column-3">
$processor.processColumn("column-3", "portlet-column-content portlet-column-content-last")
</td>
</tr>
</table>
<table class="portlet-layout">
<tr>
<td class="portlet-column portlet-column-only" id="column-4">
$processor.processColumn("column-4", "portlet-column-content portlet-column-content-only")
</td>
</tr>
</table>
#else
<div class="portlet-layout">
<div class="portlet-column portlet-column-only" id="column-1">
$processor.processColumn("column-1", "portlet-column-content portlet-column-content-only")
</div>
</div>
<div class="portlet-layout">
<div class="aui-w50 portlet-column portlet-column-first" id="column-2">
$processor.processColumn("column-2", "portlet-column-content portlet-column-content-first")
</div>
<div class="aui-w50 portlet-column portlet-column-last" id="column-3">
$processor.processColumn("column-3", "portlet-column-content portlet-column-content-last")
</div>
</div>
<div class="portlet-layout">
<div class="portlet-column portlet-column-only" id="column-4">
$processor.processColumn("column-4", "portlet-column-content portlet-column-content-only")
</div>
</div>
#end
Dragging portlets to the "2" portion of the 1-2-1 template wasn't working for me either. It may be an issue with the Social Office theme. I switched the page back to the classic theme, added the portlets, and then switched back to the SO theme. I now have the 1-2-1 layout with the Social Office theme applied.
hth