vspaceone / spaceinfo

Spaceinfo is a webserver the provides a slideshow of predefined webpages, either external or hosted by itself. It can easily be used to setup a kiosk info screen on any computer.
https://spaceinfo.vspace.one
MIT License
1 stars 1 forks source link

Setup default template for one/multiple images #27

Open noppelmax opened 2 years ago

H3wastooshort commented 2 years ago

maybe allow for an option in the config.ini for ex.:

...
template="1picture.html"

[template_options]
pic_url="pic.png"

this uses the 1picture.html file from the _templates directory located at the root of the pages directory

noppelmax commented 2 years ago

I thought about simply

pics= pic1.png pic2.png

But yes, having multiple options for template might be helpful in the future...

H3wastooshort commented 2 years ago

how are you planning to hand the configuration over? Just supplying a static html with javascript to read the config out of the .ini on its own would be the simplest but maybe not that efficient

noppelmax commented 2 years ago

?

H3wastooshort commented 2 years ago

how does the template know the options set the config.ini? is it included into the template by the server before the file is sent to the client or does it have to fetch() the config.ini itself and then parse it?

example for serverside: <!-- pic_url --> -> https://http.cat/200.jpg

noppelmax commented 2 years ago

Yes sure, the server is populating the templates with values from the config.ini. I'm on it. :)

H3wastooshort commented 2 years ago

how would you do the syntax? funky HTML comments like <!--{config_name_here}--> that get replaced by the actual value?

i want to make a few templates and having the syntax defined would allow me to stop guessing dumb solutions

noppelmax commented 2 years ago

https://palletsprojects.com/p/jinja/

noppelmax commented 2 years ago

But you have to pass the wanted value explicitely in the template call e.g. flask.render_template('home.html', shows = getShows(), version=VERSION)

noppelmax commented 2 years ago

https://flask.palletsprojects.com/en/2.1.x/tutorial/templates/