• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Timetable with (almost) static data

Scheduled Pinned Locked Moved Requests
16 Posts 5 Posters 7.1k Views 5 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    ninjabreadman @doubleT
    last edited by ninjabreadman Jan 27, 2018, 12:03 AM Jan 26, 2018, 11:31 PM

    @doubleT D’oh! I totally overlooked the PHP requirement in contemplating a revised approach. Given it’s already written, probably not worth porting the code to native js. ¯\_(ツ)_/¯

    @AxLed could however view the PHP file, save the generated HTML, and then serve the static file (until next semester, anyway!).

    Problem with config or JavaScript? Copy/paste it into JSHint.
    Check out the detailed walkthroughs on install, config, modules, etc.

    1 Reply Last reply Reply Quote 0
    • A Offline
      AxLed Module Developer
      last edited by Jan 27, 2018, 7:00 PM

      @doubleT and ninjabreadman

      My request was to show a timetable, where i can change the datas in an .csv file.
      The only way i knew to realize this was via php. So thats the reason why i tried this via apache2 an php which worked (somehow).
      If i understood you right, there are to ways to solve my request:
      A. Show the .php page via node
      B. use the node_helper.js to open a .csv file and loop through the datas.

      If i am right, i dont know what do i need for Way A and Way B, as i dont know (right now) how to write a own module.

      I am looking forward hearing from you.

      Best regards

      Axled

      N 1 Reply Last reply Jan 27, 2018, 7:12 PM Reply Quote 0
      • N Offline
        ninjabreadman @AxLed
        last edited by ninjabreadman Jan 27, 2018, 7:13 PM Jan 27, 2018, 7:12 PM

        @AxLed Honestly, I derailed the conversation with other ways it could be accomplished.

        If you have apache2 and php serving up your .csv file, you’ve accomplished what you need to in a way that can easily be updated in future. You already solved the requirement with option A. You could change how you generate the table from the CSV, but that’s a lot of work with no real benefit.

        If you want to post your CSV/HTML, we can maybe recommend ways to help style it, but you’ve already accomplished what you set out to do.

        Problem with config or JavaScript? Copy/paste it into JSHint.
        Check out the detailed walkthroughs on install, config, modules, etc.

        1 Reply Last reply Reply Quote 0
        • D Offline
          doubleT Module Developer
          last edited by Jan 27, 2018, 7:48 PM

          Or maybe I derailed it when I looked at the question of “how to get the csv” after the thread already went to the iframe solution? :D
          @AxLed Did you get the php page shown via iframe module?

          A. Show the .php page via node

          A. will not be able to show the php page via node – if you mean my suggestion. It will just get all echo’d content from the php file into the js module. So in this case it’s an over-complicated way of receiving the csv file into a module.

          B. use the node_helper.js to open a .csv file and loop through the datas.

          The node_helper.js should send the whole package back to the module.js and there it should loop through the datas.

          If you have the php knowledge to build a page that reads a csv and shows the content, it shouldn’t be too hard to get into the necessary js. To build a module for the MM, the Readme in the module folder is the first step to go to.

          A 1 Reply Last reply Jan 27, 2018, 7:59 PM Reply Quote 0
          • A Offline
            AxLed Module Developer @doubleT
            last edited by Jan 27, 2018, 7:59 PM

            @doubleT said in Timetable with (almost) static data:

            @AxLed Did you get the php page shown via iframe module?

            Yes i did, see my screenshot:
            0_1517083100346_timetable.JPG
            Timetable and datas below is a .php Website, which runs local on RPI and is integrated in MM via MMM-iFrame

            Axled

            1 Reply Last reply Reply Quote 0
            • D Offline
              doubleT Module Developer
              last edited by Jan 27, 2018, 8:10 PM

              Ah, true. If that works for you, I’d leave it at that. But then again, it’s always good to learn something new.
              Do you want to try it yourself and maybe ask for help when you get stuck? Or maybe this would be an excellent case for a tutorial, I could try to do something like that.

              1 Reply Last reply Reply Quote 0
              • P Offline
                pinsdorf Module Developer
                last edited by pinsdorf Jan 28, 2018, 1:46 PM Jan 28, 2018, 1:43 PM

                @AxLed, I also wanted to show today’s class schedules on my magic mirror. Those weekly schedules, e.g. at school or sports clubs, are very reliable and update only with a low frequency. So it is no big deal to change the config every now and then.

                I’ve created a module MMM-WeeklySchedule to solve this for me. Feel free to give it a try. Feedback is most welcome.

                Cheers.

                alt text

                1 Reply Last reply Reply Quote 1
                • A Offline
                  AxLed Module Developer
                  last edited by Jan 28, 2018, 4:34 PM

                  @pinsdorf
                  Thanks for the link an the name of your module, thats that what i was looking for. I will test it. I like your implementation with “starting time only” and “actual weekday only”, so this saves a lot of space in width to fit better to the other modules.

                  And you are right, if i change datas in an .csv or in a list in the config-file is pretty most the same.

                  Regards

                  Axled

                  1 Reply Last reply Reply Quote 0
                  • 1
                  • 2
                  • 2 / 2
                  2 / 2
                  • First post
                    13/16
                    Last post
                  Enjoying MagicMirror? Please consider a donation!
                  MagicMirror created by Michael Teeuw.
                  Forum managed by Sam, technical setup by Karsten.
                  This forum is using NodeBB as its core | Contributors
                  Contact | Privacy Policy