Remove div in shiny app's title - html

I'm using shinydashboard, and I want to put an image in the title with the following code:
header <- dashboardHeader(
title = div(img(src = 'logo.png',
height = 60,
width = 120))
)
Everything goes well, but when I open the app by chrome, in my browser's tag, it looks very weird like below.
Is there any way to keep this from showing on the browser and show some normal text?
<div> <img src="logo.png" height="60" width="120"/>

Since you're overwriting Dashboard's Title, You've to explicitly mention the page title with tags$title
tags$title('This is my page')
For shinydashboard:
ui <- dashboardPage(title = 'This is my title', header, sidebar, body, skin='red')

The best solution could be the following:
header <- dashboardHeader(
title = HTML('<div> <img src="logo.png" height="60" width="120"/>')
)

Old thread, but there is now in 2022 an argument windowTitle to titlePanel
titlePanel(title, windowTitle = title)
So it is simply a case of supplying that, as in the following where the tab gets its own text string:
`titlePanel(
title=htmltools::div(
htmltools::img(
src="Transparent Logo No Slogan.png",style="width:50px; height:50px"),
"my application title"
),
windowTitle = "my tab title"
)`

Related

cannot get tag however it is appear on html

I am trying a scraping job using BeatifulSoup and find methods, I get the HTML with lxml parser as following :
result = requests.get('https://wuzzuf.net/jobs/p/xgUqkfYngXZL-Senior-Python-Developer-Remote---Part-Time-Cairo-Egypt?o=2&l=sp&t=sj&a=python|search-v3|hpb')
#print(result.status_code)
soup1 =BeautifulSoup(result.content , "html5lib")
sections = soup1.find( 'section' ,class_="css-3kx5e2")
divs = sections.find_all('div')
spans = sections.find_all('span')
span = divs[3].find('span' , class_ ='css-47jx3m')
divs[3]
I get the following
<div class="css-rcl8e5"><span class="css-wn0avc">Salary<!-- -->:</span></div>
however, the original HTML is
<div class="css-rcl8e5"><span class="css-wn0avc">Salary<!-- -->:</span>
<span class="css-47jx3m"><span class="css-8il94u">Confidential, Hourly Based</span>
</span>
</div>
I need to get the ('span class="css-8il94u"') which have the text ('Confidential, Hourly Based') but it does not appear
thanks

Typo3-Fluid doesnt render my Content Elements | Error : "Content Element with uid "189" and type "text" has no rendering definition!"

i am trying to setup a Typo3 (v.8.7.27) Homepage using Fluid and Backendlayouts.
First i created a Backendlayout (uid = 4) and also a new Template-Html (...\Resources\Private\Templates\Page\Test1). I edited my setup.typoscript for the extension and added the following Code (actuelly just the part with the 4 / 4.)
10 = FLUIDTEMPLATE
10 {
templateName = TEXT
templateName.stdWrap.cObject = CASE
templateName.stdWrap.cObject {
key.data = pagelayout
pagets__site_theme_default = TEXT
pagets__site_theme_default.value = Default
4 = TEXT
4.value = Test1
default = TEXT
default.value = Default
}
My Test1.html looked like this:
<f:layout name="Default" />
<f:section name="Main">
<main role="main">
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="{pageUid: '{data.uid}', colPos: '11', wrap: '<div class=\"hero\">|</div>'}" />
</main>
</f:section>
Here is the Problem: Everything worked but it didnt render the Content - instead it "wrapped" the Error Msg: " Content Element with uid "189" and type "text" has no rendering definition!"
<div class="hero">
<p style="background-color: yellow; padding: 0.5em 1em;">
<strong>ERROR:</strong> Content Element with uid "189" and type "text" has no rendering definition!
</p>
</div>
In the Backend i added this Backendlayout to the Rootpage and created the Content Element for colPos 11 - its just a simple Text. I have problems understand what could be wrong as it correctly shows the uid of the Contentelement in the Error msg... Any idears?
Thank you for your help! And please write if you need more information
Daniel
The Import of Fluid had a syntax mistake. The Problem is fixed - thanks to #bandanh. If you have a problem like this check your TypoScript Objekt Browser and look for unexpected stuff / missing Objects.
Thank you,
Daniel

Replacing ALL HREF URL attributes with ALT tag and Placeholder Text

I need to find an automated way to update href URLs in a HTML file with the corresponding image alt text the anchor tag is wrapping while also including leading and closing RPL text.
Start:
<img src="/images/image.jpg" alt="ALT_TEXT">
End:
<img src="/images/image.jpg" alt="ALT_TEXT">
Breaking down the new URL:
First Variable: ${clickthrough('<br>
Second Variable: ALT_TEXT<br>
Third Variable: ')}
Anyone know where I should start in designing a solution for this problem? What coding language might handle this?
The language that you are looking for is JavaScript.
Here is a working example that does what you mentioned. (and here is a codepen with the same example)
const anchorElements = document.querySelectorAll('a');
[...anchorElements].forEach((anchor) => {
const altText = anchor.querySelector('img').alt;
anchor.href = "${clickthrough('" + altText + "')}";
})
<img src="https://place-hold.it/300x100" alt="text1">
<img src="https://place-hold.it/300x100" alt="text2">
<img src="https://place-hold.it/300x100" alt="text3">

How to extract something I want in html using 'xpath'

The html code is looking like this:
<img alt="Papa's Cupcakeria To Go!" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-old-hires="" class="a-dynamic-image a-stretch-vertical" id="landingImage" data-a-dynamic-image="{"https://images-na.ssl-images-amazon.com/images/I/814vdYZK17L.png":[512,512],"https://images-na.ssl-images-amazon.com/images/I/814vdYZK17L._SX425_.png":[425,425],"https://images-na.ssl-images-amazon.com/images/I/814vdYZK17L._SX466_.png":[466,466],"https://images-na.ssl-images-amazon.com/images/I/814vdYZK17L._SY450_.png":[450,450],"https://images-na.ssl-images-amazon.com/images/I/814vdYZK17L._SY355_.png":[355,355]}" style="max-width:512px;max-height:512px;">
I want to get "https://images-na.ssl-images-amazon.com/images/I/814vdYZK17L.png" and now I'm using
extract_item(hxs.xpath("//img[#id='landingImage']/#data-a-dynamic-image"))
, what I got is all the content inside that tag.
How can I get the first url only?
If you just want the first URL:
full_content = extract_item(hxs.xpath("//img[#id='landingImage']/#data-a-dynamic-image"))
list_contents = full_content.split(";")
first_image = list_contents[1].replace("&quot","")
print first_image
Also, you can refer this for extracting URL using regex.

Web scraping using excel VBA

I am looking at an HTML code link below:
<h1 class="wer wer">
<a href="http://somelink.com" rel="bookmark" title="Permanent Link to Title of this page that covers some random topic">
Short title of this page...</a>
</h1>
I am currently using the below code to pull out innertext ("Short title of this page...")
For Each ele In .document.all
Select Case ele.classname
Case "wer wer"
RowCount = RowCount + 1
sht.Range("A" & RowCount) = ele.innertext
End Select
Next ele
How can I modify this code to pull out title ("Permanent Link to Title of this page that covers some random topic") and href ("http://somelink.com")?
Any help would be much appreciated. Thanks.
Select the element by its styling.
.document.querySelector("a[href=http://somelink.com]").innerText
a[href=http://somelink.com] is a CSS selector of first element with an a tag having href = 'http://somelink.com'.