Twitter Share Link Will Only Show First Word Of Topic Title - twitter

hi guys basically I have something called $content[topic] which in php would show the topic which could be something like "Platformers What Are They"
but when a user would click on my share button for twitter it will only show "PLATFORMERS [The LINK]" and not the whole title that I wanted showing, how do I correct this?
here is the code for the share button I am using
<a href=https://twitter.com/intent/tweet?url=http://www.sentuamessage.com/blog.php?who=$content[id]&text=$content[topic]&hashtags=blogs,SentUAMessage target=new>Image Here</a>
any ideas?

You need to URLencode all your variables.
In your case, do something like....
$URL = "https://twitter.com/intent/tweet?"
+ "url=" + urlencode("http://www.sentuamessage.com/blog.php?")
+ "&who=" + urlencode($content[id])
+ "&text=" + urlencode($content[topic])
+ "&hashtags=" + urlencode("blogs,SentUAMessage");
Basically, make sure everything is properly encoded.

Related

Plotly - prevent <a> Tag from open new tab

The x label of my plotly diagram contains a link to the selected data point:
let str = '<a href="' + url + '"target=' + '_self' + '>' + cycleStart[1] + '</a>';
But the link is always opened in a new tab. I know that the target attribute causes this problem. But as you can see my simple solution is not working. I already searched
target="_blank"
in the plotly.min js file and changed it into
target="_self"
Also this does not work for me.
So how can I prevent this Tag from opening a new tab? I want the url to open in the same window.

Html.Raw splits string unintentionally

I am working on a page, where customers can write own descriptions for articles they sell. They can use html tags for this.
The code in the view looks like this:
#Html.Raw("<p class='description short'>" + shopItem.ShortDescription + "</p>")
The problem is, that this is splitted into two p-tags:
<p class="description short"></p>
and below that the content of shopItem.ShortDescription:
<p><em><strong>Title</strong></em></p>
I also tried
<p class="description short">#Html.Raw(shopItem.ShortDescription)</p>
but that leads to the same behavior.
I´m sure I´m missing or not seeing something. So, what is wrong with that code snippet?
I believe the issue here is that you cannot nest p elements. If you try it with just html it still will not work, but for example this works fine
#{
var shopItem = "<em><strong>Title</strong></em>";
}
#Html.Raw("<p class='description short'>" + shopItem + "</p>")

Can I use ,,What's here?" functionality with Leaflet

I am developing a Rails app. I use Leaflet to show some maps and to mark some of my data on them. I could use a GoogleMaps-like functionality of ,,What's here?" (you click on a map and get the coordinates?)
If not with Leaflet, is there another library that could make this happen?
Thanks
Yes, you can make your map listen to click events and open a popup ...
function onMapClick(e) {
var html = 'hello from ' + e.latlng.lat + ',' + e.latlng.lng;
map.openPopup(html, e.latlng);
}
map.on('click', onMapClick);
Look at this JSFiddle

jquerymobile url parameters

Have asked two questions and not getting an answer and having spent a few hours trying to find the answer without success I am wondering if someone can finally help me.
I need to generate dynamic urls and pass through parameters on jquerymobile.
example..
Menu 2
Result No. 4
The above urls need to be dynamic and I need to be able to pass through a parameter of ID.
I then need to get the id parameter on the given page.
I have read lots regarding changePage etc but I can specify in the function which page will be next as it needs to be dynamic. I also need the ajax transitions to work so ajax-false needs to be true.
Please help once and for all and provide me with sample code.
Kind Regards.
Ok, to get the url parameter on the page you navigated in, use something similar to the following.
It uses pageshow event to get the ID from the current URL.
I have used the function from the answer on this question - Get escaped URL parameter:
$(document).on("pageshow", function(event, data) {
var id = getURLParameter("id");
console.log("ID = " + id);
});
function getURLParameter(name) {
return decodeURI(
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
);
}
If the above regex doesn't work means try with this change
function getURLParameter(name) {
return decodeURI(
(RegExp(name + '=' + '(.+?)(&|$)').exec(window.location.href)||[,null])[1]
);
}

Info Window URL needs to be prefixed with http NOT the default https

I am using the following code in the fusion tables 'customize info window' to create hyperlinked URL's from a column in my table:
"{URL}"
This works fine in returning the clickable hyperlink in the info box except fusion maps by default tacks on https: instead of http: when the link is clicked. This causes problems when the user clicks the hyperlink and it tries to take them to a secure site when in fact it is not secure. The browsers throw up all sorts of warnings that will scare the pants off a lot of users who don't know what is happening.
Does anybody know how to remedy this and have the default be http and not the current https?
Thanks, Shep
You may want to abandon the "{URL}" approach and display the hyperlink with some simple HTML. This example from Google shows how to modify the info window's HTML in Javascript:
google.maps.event.addListener(layer, 'click', function(e) {
// Change the content of the InfoWindow
e.infoWindowHtml = e.row['Store Name'].value + "<br>";
// If the delivery == yes, add content to the window
if (e.row['delivery'].value == 'yes') {
e.infoWindowHtml += "Delivers!";
}
});
Changing the e.row['Store Name'] to your URL column name (maybe, e.row['URL']) and surrounding by a couple of hyperlink tags <a> should do the trick:
e.infoWindowHtml = "<a href='" + e.row['URL'].value + "'>Click here!</a>";
There are three ways:
Specify a full URL including protocol in your data
Use Link here in a custom info window layout
Completely override the content as in the answer above
I would recommend #1 because you can choose the right protocol for every link. However #2 is probably easier in that you can leave your data the way it is.

Resources