content.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. } else if this.Is404 {
  24. // Return it from settings
  25. return "404"
  26. }
  27. return ""
  28. }
  29. func (this *FERData) Content() template.HTML {
  30. if this.DataRow != nil {
  31. if this.Wrap.CurrModule == "index" {
  32. return template.HTML(this.DataRow.(*utils.MySql_page).A_content)
  33. }
  34. } else if this.Is404 {
  35. // Return it from settings
  36. return template.HTML("The page what you looking for is not found")
  37. }
  38. return template.HTML("")
  39. }
  40. func (this *FERData) DateTime() int {
  41. if this.DataRow != nil {
  42. if this.Wrap.CurrModule == "index" {
  43. return this.DataRow.(*utils.MySql_page).A_datetime
  44. }
  45. }
  46. return 0
  47. }
  48. func (this *FERData) DateTimeFormat(format string) string {
  49. if this.DataRow != nil {
  50. if this.Wrap.CurrModule == "index" {
  51. return time.Unix(int64(this.DataRow.(*utils.MySql_page).A_datetime), 0).Format(format)
  52. }
  53. }
  54. return ""
  55. }