How can I make these HashTags Widgets?
+2
Ange Tuteur
Van-Helsing
6 posters
Page 1 of 4
Page 1 of 4 • 1, 2, 3, 4
How can I make these HashTags Widgets?
Hello,
How can I make these two hashtags widgets?
Recent HashTags Widget:
Popular HashTags Widget:
How can I make these two hashtags widgets?
Recent HashTags Widget:
Popular HashTags Widget:
Re: How can I make these HashTags Widgets?
LG is using an external server to store this data in an external database. You'd need a knowledge of PHP, MySQL, and JavaScript to achieve said effect. You could use the topic method of storing data as well.
Re: How can I make these HashTags Widgets?
Hello @Ange Tuteur,
There are to methods to develop this, the one is with an external server which I can found easily a little server to host some scripts and a little MySql database, and other method which we tried at the past is pseudo-database which the hashtags will grabbing into a topic which it will use as database.
I dont know how to grab the hashtags from the topic in second method and write them into pseudo-database. The first method has a lot of work in programming languages. I think the second method is more simple than the first.
Now I think another method:
a javascript field which it will displaying while posting something similar with "Reason for Editing" with the name "HashTags" and the user fill it before press the button "Send". Then the javascript writes the hashtags into pseudo-database.
There are to methods to develop this, the one is with an external server which I can found easily a little server to host some scripts and a little MySql database, and other method which we tried at the past is pseudo-database which the hashtags will grabbing into a topic which it will use as database.
I dont know how to grab the hashtags from the topic in second method and write them into pseudo-database. The first method has a lot of work in programming languages. I think the second method is more simple than the first.
Now I think another method:
a javascript field which it will displaying while posting something similar with "Reason for Editing" with the name "HashTags" and the user fill it before press the button "Send". Then the javascript writes the hashtags into pseudo-database.
Re: How can I make these HashTags Widgets?
Identifying hashtags is rather trivial. There's two things to note :
1. Hashtags and Mentions are the only links in posts to have a title, IF HTML is disabled.
2. Hashtags always begin with a hash or pound
So, this is a simple example of iterating all anchors on the page to find those which are a hashtag. It's spaced out for readability.
What can be done to store the hashtags is pretty simple as well. We make a query to the database after the iteration is complete with all hashtags that were found and the post ID which they were contained in. Basically there will be two columns for the database :
1. Hashtag
- The name of the hashtag
2. Post ID array
- A list of post id's where this hashtag occurred.
A user may tag it more than once in a post, so we could add some brackets to the end of the post ID to hold the number of times it was tagged. e.g. t1p72[3]
broken down :
t1 // topic id
p72 // post id
[3] // number of times tagged in that post
It sounds simple, but there is a lot more to this to make sure it succeeds. Furthermore, you have a character limit of 65,000, so this can hinder the amount of data you store via a post. At the moment, I've not had time to dedicate to developing something like this, but I've thought about it.
1. Hashtags and Mentions are the only links in posts to have a title, IF HTML is disabled.
2. Hashtags always begin with a hash or pound
So, this is a simple example of iterating all anchors on the page to find those which are a hashtag. It's spaced out for readability.
- Code:
// start with a jQuery document ready event to execute code when the document is loaded
$(function() {
var a = document.getElementsByTagName('A'), // get all links in the document
i = 0, // link index ; 0 is the first link, 1 is the second, and so on..
j = a.length; // define link length so it doesn't need to be looked up after each iteration
for (;
i<j; // continues iteration until all links have been looped
i++ // increments our index after each loop
)
{
if (
a[i].title // only hashtags and mentions have titles if HTML is disabled
&& // and
/^#/.test(a[i].innerHTML) // hastags always begin with a pound or "hash"
// if these two conditions are true, we can execute code specifically for them
)
{
a[i].className += ' fa-hashtag'; // add classname .fa-hashtag
}
}
});
What can be done to store the hashtags is pretty simple as well. We make a query to the database after the iteration is complete with all hashtags that were found and the post ID which they were contained in. Basically there will be two columns for the database :
1. Hashtag
- The name of the hashtag
2. Post ID array
- A list of post id's where this hashtag occurred.
A user may tag it more than once in a post, so we could add some brackets to the end of the post ID to hold the number of times it was tagged. e.g. t1p72[3]
broken down :
t1 // topic id
p72 // post id
[3] // number of times tagged in that post
It sounds simple, but there is a lot more to this to make sure it succeeds. Furthermore, you have a character limit of 65,000, so this can hinder the amount of data you store via a post. At the moment, I've not had time to dedicate to developing something like this, but I've thought about it.
Re: How can I make these HashTags Widgets?
To prevent the limit of 65,000 characters of post we can keep a specific number of the latest hashtags in the pseudo-database etc. 1000-5000 hashtags or any custom number of hashtags as records in pseudo-database by overwriting the oldest records.
Re: How can I make these HashTags Widgets?
In practice the character limit is only 15,000!Ange Tuteur wrote:(...) you have a character limit of 65,000 (...)
I have confirmed in my tests...
JS
Re: How can I make these HashTags Widgets?
How can happening this?JScript wrote:In practice the character limit is only 15,000!Ange Tuteur wrote:(...) you have a character limit of 65,000 (...)
I have confirmed in my tests...
JS
Page 1 of 4 • 1, 2, 3, 4
Similar topics
» Hashtags don't work
» widgets-make appears to one group only?
» How to make widgets visible only on the index?
» Two little add-ons for Hashtags
» hashtags and tags
» widgets-make appears to one group only?
» How to make widgets visible only on the index?
» Two little add-ons for Hashtags
» hashtags and tags
Page 1 of 4
Permissions in this forum:
You cannot reply to topics in this forum