UniPager Pagination. Is it possible to put absolute links instead of relative ones in "PreviousGroupURL" and "NextGroupURL"?
My code:
<PreviousPageTemplate>
<a href="<%# URLHelper.GetAbsoluteUrl(Convert.ToString(Eval("PreviousURL", true))) %>" >Previous</a>
</PreviousPageTemplate>
<NextPageTemplate>
Next
</NextPageTemplate>
<PreviousGroupTemplate>
...
</PreviousGroupTemplate>
<NextGroupTemplate>
...
</NextGroupTemplate>
HTML source page:
Previous
1
<span>2</span>
3
<a href="http://local/en/test?strona=3" >Next</a>
</div>
In your transformation use something like:
<%# GetAbsoluteUrl(Eval<string>("NextGroupURL")) %>
From https://devnet.kentico.com/docs/11_0/api/html/Methods_T_CMS_Helpers_URLHelper.htm
Please refer below URLs - -
https://docs.xperience.io/k11/references/kentico-controls/generic-controls/paging-controls/unipager
https://devnet.kentico.com/questions/repeater-and-unipager-in-a-custom-control-(widget)
https://devnet.kentico.com/questions/kentico-unipager-not-working
Related
I am trying to get all headers which are not in the footer.
So the header <h3 class="ibm-bold">Discover</h3> should be excluded from the scrape.
<footer role="contentinfo" aria-label="IBM">
<div class="region region-footer">
<div id="ibm-footer-module">
<section role="region" aria-label="Resources">
<h3 class="ibm-bold">Discover</h3>
I have tried using this expression to select the headers which should be excluded, but it doesn't return the right nodes.
//*[self::h1 or self::h2 or self::h3 or self::h4 or self::h5 or self::h6]/ancestor::footer/text()
The page I am scraping is this: https://www.ibm.com/products/informix/embedded-for-iot?mhq=iot&mhsrc=ibmsearch_a
Please help
You almost had it.
//*[
(self::h1 or self::h2 or self::h3 or self::h4 or self::h5 or self::h6)
and not(ancestor::footer)
]/text()
I just got into Scrapy & I’m aware this is a Noob question but How do I add an attribute to specify specific pagination link?
here is the html with the element I’m targeting.
`<div class="pagination">
<a rel="prev" href="/collections/all?page=1" class="fa fa-chevron-left prev pagination-icon"></a>
<ul>
<li class="pagination-icon">
1
</li>
<li class="pagination-icon pagination-icon--current">
2
</li>
<li class="pagination-icon">
3
</li>
<li class="pagination-icon">
4
</li>
<li class="pagination-icon pagination-icon--current">
…
</li>
<li class="pagination-icon">
50
</li>
</ul>
I Need to follow the link in this line
<a rel="next" href="/collections/all?page=3" class="fa fa-chevron-right next pagination-icon"></a>
Here is my scrapy code
next_page = response.css('div.pagination a::attr(href)').extract_first()
if next_page is not None:
yield response.follow(next_page, callback=self.parse)
What’s happening is its following this link instead of the other one because it is the first one in the class “pagination”
<a rel="prev" href="/collections/all?page=1" class="fa fa-chevron-left prev pagination-icon"></a>
I can see 2 differences between the attributes of the 2 links, both in the class “pagination”
Rel attribute is different, I need the one with “next”
Class attribute is different, I need “fa fa-chevron-right next pagination-icon”
I’m pretty sure I can get the correct link by specifying one of the 2 attributes listed above in my css selector. I tried using the following CSS selectors but none worked.
div.pagination a.fa fa-chevron-right next pagination-icon a::attr(href) does not work
a.fa fa-chevron-right next pagination-icon a::attr(href) does not work
a.fa fa-chevron-right next pagination-icon::attr(href) does not work
How can I achieve my goal? Why do none of the CSS selectors I tried work?
You can't select multiple classes with a single dot. Either combine each of them with dots or go for this syntax "[class='fa fa-chevron-right next pagination-icon']". However, if any class out of them is generated dynamically then the selector will break.
Then try with this to see what happens.
response.css('div.pagination a[rel="next"]::attr(href)').extract_first()
This is a piece of HTML from which I'd like to extract information from:
<li>
<p><strong class="more-details-section-header">Provenance</strong></p>
<p>Galerie Max Hetzler, Berlin<br>Acquired from the above by the present owner</p>
</li>
I'd like to have an xpath expression which extracts the content of the 2nd <p> ... </p> depending if there's a sibling before with <p> ... Provenance ... </p>
This is to where I got so far:
if "Provenance" in response.xpath('//strong[#class="more-details-section-header"]/text()').extract():
print("provenance = yes")
But how do I get to Galerie Max Hetzler, Berlin<br>Acquired from the above by the present owner ?
I tried
if "Provenance" in response.xpath('//strong[#class="more-details-section-header"]/text()').extract():
print("provenance = yes ", response.xpath('//strong[#class="more-details-section-header"]/following-sibling::p').extract())
But am getting []
You should use
//p[preceding-sibling::p[1]/strong='Provenance']/text()
I'm trying to trim ending white space from AlertTitle in an ascx transforamtion. I know there is TrimEnd, but i'm drawing a blank getting it to work.
The V9 Documentation has a method for this(https://docs.kentico.com/display/K9/Adding+custom+methods+to+transformations) but i don't want to fix the length.
Here's the transformatin code snippet.
<asp:placeholder id="alert" runat="server" Visible="false">
<li data-date="<%# Eval("AlertDate") %>">
<p class="alert-date"><%# FormatDateTime(Eval("AlertDate"), "MMMM dd, yyyy") %> </p>
<p class="alert-copy"><%# Eval("AlertTitle") %> <%# IfEmpty(Eval("AlertCopy"),"", "... <a href='" + GetDocumentUrl() + "'>" + CMS.Helpers.ResHelper.GetString("kff.Generic-ReadMore") + "</a> »") %></p>
</li>
</asp:placeholder>
In addition to using Trim() or TrimEnd() in the transformation, you can also set it up so Kentico will automatically trim the fields when the form is submitted by checking the "Trim" checkbox under "advanced" Editing control settings.
Like so:
You probably need to cast the ouput of Eval to a string first:
<%# ((string)Eval("AlertTitle")).TrimEnd() %>
In v8 and newer, you can also use a different version of Felix's answer
<%# Eval<string>("AlertTitle").TrimEnd() %>
I'm using AsciiDoctor to create an HTML manual. In order to keep existing links valid, I need multiple anchors at the same header.
Basically I want this output:
<a id="historic1"></a>
<a id="historic2"></a>
<h2 id="current">Caption</h2>
While it is possible to create multiple inline anchors like this
Inline [[historic1]] [[historic2]] [[current]] Anchor
Inline <a id="historic1"></a> <a id="historic2"></a> <a id="current"></a> Anchor
it looks like additional anchor macros in front of blocks are simply swallowed:
[[historic1]]
[[historic2]]
[[current]]
== Caption
<h2 id="current">Caption</h2>
So what are my options to have multiple anchors in front of a block?
You can also use the shorthand version of this solution.
[#current]
== [[historic1]][[historic2]]Caption
Now you get all three anchors on the same heading.
The best I could do (tested with Asciidoctor.js 1.5.4):
== anchor:historic1[historic1] anchor:historic2[historic2] anchor:current[current] Caption
Some text
Output:
<h2 id="__a_id_historic1_a_a_id_historic2_a_a_id_current_a_caption"><a id="historic1"></a> <a id="historic2"></a> <a id="current"></a> Caption</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Some text</p>
</div>
</div>
There are two issues:
#840
#1689