asp net 웹 페이지에 키워드 클라우드를 추가해야합니다! 누구든지 나에게 그것을 할 수있는 가장 좋은 방법을 제안 할 수 있습니까? C#을 사용하여 구현 된 몇 가지 작업 예제가 있지만이를 수행 할 다른 방법이 있는지 알고 싶습니다! 좋은 제안은 정말 감사하겠습니다! 사전 :ASP.NET에서 키워드 클라우드 추가하기 페이지
0
A
답변
0
이 코드를 사용하여 시도 할 수 있습니다 감사드립니다 .. 나는 어느 정도 짐작
Int32 rank, minVal, maxVal, scale, s;
minVal = st.GetMinRank();
maxVal = st.GetMaxRank();
scale = (maxVal - minVal)/6;
rank = Convert.ToInt32(yourRankValue that is stored in your DB);
if (scale == 0)
s = 0;
else
s = (rank - minVal)/scale;
if (s == 0)
{
lblSTName.Font.Size = FontUnit.Smaller;
}
else if (s == 1)
{
lblSTName.Font.Size = FontUnit.Small;
}
else if (s == 2)
{
lblSTName.Font.Size = FontUnit.Medium;
}
else if (s == 3)
{
lblSTName.Font.Size = FontUnit.Large;
}
else if (s == 4)
{
lblSTName.Font.Size = FontUnit.Larger;
}
else if (s >= 5)
{
lblSTName.Font.Size = FontUnit.Larger;
lblSTName.Font.Bold = true;
}
0
는 대답은 방법과 장소 키워드 데이터가 저장되는에 따라 달라집니다.
Photos-TagsPhotos-Tags http://www.doodle.co.uk/UserFiles/Image/Photos-Tags.png
이 그래서 사진이 TagsPhotos 테이블을 통해 태그에 연결되어 있습니다 :
나는 다음과 같은 테이블이있는 데이터베이스가 있습니다.
protected void Page_Load(object sender, EventArgs e) {
// "zhpCtx" is a LINQ to SQL data context.
// "TagCloud" is a Panel control.
// Select a list of tags and a count of how often they appear in TagsPhotos
var tagDensity = from t in zhpCtx.siteContent_Tags
join tp in zhpCtx.siteContent_TagsPhotos
on t.TagID equals tp.TagID
group t by new { t.TagID, t.TagText } into g
where g.Count() > 0
orderby g.Key.TagText
select new { g.Key.TagID, g.Key.TagText, NumTags = g.Count() };
if (null != tagDensity && tagDensity.Count() > 0) {
// We have some tags, get the lowest number of counts greater than 0, and
// the highest to give our range.
int? min = tagDensity.Min(t => t.NumTags);
int? max = tagDensity.Max(t => t.NumTags);
// Loop through each tag
foreach (var tag in tagDensity) {
// Create a new HyperLink control to take the user to a given tag
// Include the tag count in the list for accessibility.
// Could probably move it to the title attribute.
// Build the link however suits.
HyperLink tagLink = new HyperLink {
NavigateUrl = string.Format("Photos.aspx?TagID={0}", tag.TagID),
Text = string.Format("{0} ({1})", tag.TagText, tag.NumTags) };
// Adjust the font-size of the tag link - calling getPercentage.
// This will adjust the size based on the baseline font size for the
// container
tagLink.Style.Add("font-size",
string.Format("{0}%",
getPercentageSize((int)max, (int)min, tag.NumTags)));
// Add the HyperLink to the Panel.
TagCloud.Controls.Add(tagLink);
// Add a LiteralControl with a comma and a space.
TagCloud.Controls.Add(new LiteralControl(", "));
}
// Remove the last separator control from the Panel.
TagCloud.Controls.RemoveAt(TagCloud.Controls.Count - 1);
} else {
// Hide the tag cloud panel
TagCloud.Visible = false;
}
}
private int getPercentageSize(int max, int min, int score) {
// Ensure we've got a sensible number
if (min < 1) {
min = 1;
}
double spread = max - min;
if (spread == 0) {
spread = 1;
}
// Setup sensible bounds for the font sizes
int minSize = 80;
int maxSize = 200;
// Step ensures that our least used keyword is 80% and our
// most used is 200%
double step = (maxSize - minSize)/spread;
return (int)(minSize + ((score - min) * step));
}
:
나는 다음 내 키워드 구름을 생성하기 위해 다음과 같은 방법을 사용
관련 문제
- 1. PHP 페이지 매김 추가하기
- 2. 리피터에 페이지 매기기 추가하기
- 3. 키워드 검색 페이지 및 URL
- 4. asp.net에서 새로 고침 페이지
- 5. 페이지 새로 고침 ASP.NET에서
- 6. 레일즈 3 페이지 키워드 및 설명
- 7. 클라우드 드라이브 대 클라우드 파일
- 8. ASP.NET에서 링크 된 페이지 캐싱
- 9. ASP.NET에서 스타일 시트보기 로그온 페이지
- 10. asp.net에서 동적 HTML 페이지 만들기
- 11. 격자보기 페이지 asp.net에서 현명한 정렬
- 12. ASP.net에서 마스터 페이지 함수 재정의
- 13. 클라우드 컴퓨팅 - 블루 클라우드 컴퓨팅 및 클라우드 비교
- 14. 키워드
- 15. 동적으로 (런타임에) 사용자 정의 페이지 추가하기
- 16. GSP 내부에 gwt 태그 추가하기 페이지
- 17. cgcontext에 의해 생성 된 pdf에 페이지 추가하기
- 18. 팬 페이지 탭에 LIKE 플러그인 추가하기
- 19. 웹 사이트에 사용자 정의 오류 페이지 추가하기
- 20. 클라우드 이식성
- 21. 클라우드 컴퓨팅
- 22. 키워드 스터핑이란 무엇입니까?
- 23. ASP.NET에서 길거나 비정상적인 페이지 실행 시간 로깅
- 24. asp.net에서 페이지 생성 시간을 어떻게 표시합니까?
- 25. ASP.Net에서 수동으로 페이지 이벤트 처리기 추가 C#
- 26. Asp.net에서 Ajax 호출의 페이지 수명주기 란 무엇입니까?
- 27. ASP.net에서 여러 페이지 (Google 결과와 마찬가지로)
- 28. asp.net에서 어떤 페이지 요청이 리디렉션되는지 추적하는 방법
- 29. ASP.net에서 로딩 페이지 표시기를 표시하는 간단한 방법.
- 30. 안전하게 ASP.NET에서 HTML 문자열을 분할/페이지 매기기