content.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package fetdata
  2. import (
  3. "html/template"
  4. "time"
  5. "golang-fave/utils"
  6. )
  7. func (this *FERData) Name() string {
  8. if this.dataRow != nil {
  9. if this.wrap.CurrModule == "index" {
  10. return this.dataRow.(*utils.MySql_page).A_name
  11. }
  12. } else if this.is404 {
  13. // Return it from settings
  14. return "404"
  15. }
  16. return ""
  17. }
  18. func (this *FERData) Alias() string {
  19. if this.dataRow != nil {
  20. if this.wrap.CurrModule == "index" {
  21. return this.dataRow.(*utils.MySql_page).A_alias
  22. }
  23. }
  24. return ""
  25. }
  26. func (this *FERData) Content() template.HTML {
  27. if this.dataRow != nil {
  28. if this.wrap.CurrModule == "index" {
  29. return template.HTML(this.dataRow.(*utils.MySql_page).A_content)
  30. }
  31. } else if this.is404 {
  32. // Return it from settings
  33. return template.HTML("The page what you looking for is not found")
  34. }
  35. return template.HTML("")
  36. }
  37. func (this *FERData) DateTime() int {
  38. if this.dataRow != nil {
  39. if this.wrap.CurrModule == "index" {
  40. return this.dataRow.(*utils.MySql_page).A_datetime
  41. }
  42. }
  43. return 0
  44. }
  45. func (this *FERData) DateTimeFormat(format string) string {
  46. if this.dataRow != nil {
  47. if this.wrap.CurrModule == "index" {
  48. return time.Unix(int64(this.dataRow.(*utils.MySql_page).A_datetime), 0).Format(format)
  49. }
  50. }
  51. return ""
  52. }