digitalmars.D.learn - How to implement D to HTML pages ?
- =?UTF-8?B?QXVyw6lsaWVu?= Plazzotta (14/14) Oct 01 2018 Hello guys,
- rjframe (18/33) Oct 01 2018 If you're most comfortable with PHP you may want to look at Adam Ruppe's...
- bauss (13/16) Oct 01 2018 As the creator of Diamond, then I can say it's 100% intentional
- bauss (3/4) Oct 01 2018 Minor typo sorry.
- =?UTF-8?B?QXVyw6lsaWVu?= Plazzotta (8/26) Oct 02 2018 Thank you both for all the links! I guess DiamondMVC is very
- bauss (59/91) Oct 02 2018 The learning curve is actually not that long since it's a
- Andrea Fontana (37/40) Oct 03 2018 I currently use two libraries I wrote to keep things easy.
- aberba (10/25) Oct 03 2018 Nothing get you simpler with Vibe.d than my blog[1]. I've done a
Hello guys, I would like to implement a forum and a blog within my website (currently including only HTML, CSS and JS, written without CMS), using D and SQL but I really don't know how to proceed. How can I integrate D into HTML pages? Are there any kind of include's commands like PHP ? Also, do I have to use vibe.d ? Or is it optional? I admit I didn't read the book yet (D Web Development), but only "Programming in D", which doesn't deal much with website workflow. Finally, what database system do you recommand to interact with for data-oriented website purpose? Perhaps, there are some standard or tierce-party librairies or ORM for PostgreSQL or SQLite ? Thanks for all the light anyone will be willing to spread :)
Oct 01 2018
On Mon, 01 Oct 2018 19:29:56 +0000, Aurélien Plazzotta wrote: On Mon, 01 Oct 2018 19:29:56 +0000, Aurélien Plazzotta wrote:Hello guys, I would like to implement a forum and a blog within my website (currently including only HTML, CSS and JS, written without CMS), using D and SQL but I really don't know how to proceed. How can I integrate D into HTML pages? Are there any kind of include's commands like PHP ? Also, do I have to use vibe.d ? Or is it optional? I admit I didn't read the book yet (D Web Development), but only "Programming in D", which doesn't deal much with website workflow.If you're most comfortable with PHP you may want to look at Adam Ruppe's arsd[0]; the readme has an overview of web-related and database-related modules. vibe.d has more of a node.js feel. There's also DiamondMVC[1], which reminds me of ASP.NET (I'm not 100% sure whether that's intentional, and I haven't tried Diamond) and includes an ORM.Finally, what database system do you recommand to interact with for data-oriented website purpose? Perhaps, there are some standard or tierce-party librairies or ORM for PostgreSQL or SQLite ? Thanks for all the light anyone will be willing to spread :)There are low-level bindings for MySQL/MariaDB, Postgres, SqLite, and some people have made higher-level libraries and ORMs[2]. You may want to browse a bit and see what you like. I believe the Diamond ORM can be used without the rest of the framework, and the hunt-entity ORM is actively developed. [0]: Repo: https://github.com/adamdruppe/arsd Docs: https://arsd-official.dpldocs.info/index.html (note that not everything is documented) [1]: https://github.com/DiamondMVC/Diamond [2]: http://code.dlang.org/?sort=updated&limit=20&category=library.database
Oct 01 2018
On Monday, 1 October 2018 at 23:17:59 UTC, rjframe wrote:vibe.d has more of a node.js feel. There's also DiamondMVC[1], which reminds me of ASP.NET (I'm not 100% sure whether that's intentional, and I haven't tried Diamond) and includes an ORM.As the creator of Diamond, then I can say it's 100% intentional that it reminds of ASP.NET. It was originally just an alternative template engine to vibe.d to create views similar to razor, but now it's a full-stack web-framework specifically targeting enterprise development, hence why the similarities to ASP.NET. As described on the website (https://diamondmvvc.org/): "Diamond is build on modern principles using vibe.d, inspired by ASP.NET and razor templates." It can also be used in combination with vibe.d projects, in which you can just utilize the extra tools Diamond gives you such as some additional security, authentication, api creation, database management (ORM) etc.
Oct 01 2018
On Tuesday, 2 October 2018 at 06:56:33 UTC, bauss wrote:As described on the website (https://diamondmvvc.org/):Minor typo sorry. https://diamondmvc.org/
Oct 01 2018
On Tuesday, 2 October 2018 at 06:56:33 UTC, bauss wrote:On Monday, 1 October 2018 at 23:17:59 UTC, rjframe wrote:Thank you both for all the links! I guess DiamondMVC is very powerful but I would rather avoid using such heavy artillery. I'm expecting the learning curve to be very long. Do you know of template engines in D ? like Jinja2 in Python for example. It would be way more lightweight and free-dependancies compared to a fully featured framework like DiamondMVC, besides the gain in time thanks to the simplicity of use.vibe.d has more of a node.js feel. There's also DiamondMVC[1], which reminds me of ASP.NET (I'm not 100% sure whether that's intentional, and I haven't tried Diamond) and includes an ORM.As the creator of Diamond, then I can say it's 100% intentional that it reminds of ASP.NET. It was originally just an alternative template engine to vibe.d to create views similar to razor, but now it's a full-stack web-framework specifically targeting enterprise development, hence why the similarities to ASP.NET. As described on the website (https://diamondmvvc.org/): "Diamond is build on modern principles using vibe.d, inspired by ASP.NET and razor templates." It can also be used in combination with vibe.d projects, in which you can just utilize the extra tools Diamond gives you such as some additional security, authentication, api creation, database management (ORM) etc.
Oct 02 2018
On Tuesday, 2 October 2018 at 18:27:04 UTC, Aurélien Plazzotta wrote:On Tuesday, 2 October 2018 at 06:56:33 UTC, bauss wrote:The learning curve is actually not that long since it's a relative small setup. It's a heavy beast, BUT everything is pretty much optional and opt-in, so you really only just use what you need. So for templating, just setup a project, the configuration and then create views. As soon as you're familiar with the template syntax then you're good to go without knowing the whole framework etc. You can write templates using D in it. Simple example: After 3.0.0 which is coming soon then <> is replaced by () layout.dd: ``` <doctype> <html> <head> <title>Website - <title></title> </head> <body> <view> </body> </html> ``` home.dd: Notes: placeholders is equivalent to an associative array in D. ``` [ route: home --- placeholders: [ "title": "Home" ] ] <p>Hello World!</p> ``` Output: ``` <!DOCTYPE html> <html> <head> <title>Website - Home</title> </head> <body> <p>Hello World!</p> </body> </html> ``` It's pretty much plug and play too using this as an empty example project: https://diamondmvc.org/download See empty project. It'll be ready to just compile and run. After that you can just work with views if you just want to use simple templates. No need to know the whole framework or any long installation guides.On Monday, 1 October 2018 at 23:17:59 UTC, rjframe wrote:Thank you both for all the links! I guess DiamondMVC is very powerful but I would rather avoid using such heavy artillery. I'm expecting the learning curve to be very long. Do you know of template engines in D ? like Jinja2 in Python for example. It would be way more lightweight and free-dependancies compared to a fully featured framework like DiamondMVC, besides the gain in time thanks to the simplicity of use.vibe.d has more of a node.js feel. There's also DiamondMVC[1], which reminds me of ASP.NET (I'm not 100% sure whether that's intentional, and I haven't tried Diamond) and includes an ORM.As the creator of Diamond, then I can say it's 100% intentional that it reminds of ASP.NET. It was originally just an alternative template engine to vibe.d to create views similar to razor, but now it's a full-stack web-framework specifically targeting enterprise development, hence why the similarities to ASP.NET. As described on the website (https://diamondmvvc.org/): "Diamond is build on modern principles using vibe.d, inspired by ASP.NET and razor templates." It can also be used in combination with vibe.d projects, in which you can just utilize the extra tools Diamond gives you such as some additional security, authentication, api creation, database management (ORM) etc.
Oct 02 2018
On Tuesday, 2 October 2018 at 18:27:04 UTC, Aurélien Plazzotta wrote:Thank you both for all the links! I guess DiamondMVC is very powerful but I would rather avoid using such heavy artillery. I'm expecting the learning curve to be very long.I currently use two libraries I wrote to keep things easy. https://code.dlang.org/packages/arrogant https://code.dlang.org/packages/reserved The first one is a html5 parser. So you don't need any template, you can directly read html and then edit them just like you are used to do in js, for example. For example: auto src = `<html><head></head><body><div>Hello World</div></body></html>`; auto arrogant = Arrogant(); auto tree = arrogant.parse(src); // Change div content from "Hello World!" to "Hello D!" tree.byTagName("div").front.innerText = "Hello D!"; // Print the edited html writeln(tree.document); The second library is a scgi library that allow you to send data to any webserver that support scgi (f.e. nginx). It works like php: import reserved; ReservedResponse private void response(Request req, Output output) { output ~= "Hello "; if ("name" in req.get) output ~= req.get["name"]; else output ~= "World"; // Using the library above you can do something like this instead: // output ~= tree.document; } mixin Reserved!"awesome_d_webservice"; So if you combine those two libraries you can output a validated/well-formed html5 document in a easy way. Andrea
Oct 03 2018
On Monday, 1 October 2018 at 19:29:56 UTC, Aurélien Plazzotta wrote:Hello guys, I would like to implement a forum and a blog within my website (currently including only HTML, CSS and JS, written without CMS), using D and SQL but I really don't know how to proceed. How can I integrate D into HTML pages? Are there any kind of include's commands like PHP ? Also, do I have to use vibe.d ? Or is it optional? I admit I didn't read the book yet (D Web Development), but only "Programming in D", which doesn't deal much with website workflow. Finally, what database system do you recommand to interact with for data-oriented website purpose? Perhaps, there are some standard or tierce-party librairies or ORM for PostgreSQL or SQLite ? Thanks for all the light anyone will be willing to spread :)Nothing get you simpler with Vibe.d than my blog[1]. I've done a series of tutorials for beginners but straight to the point. 1. https://aberba.netlify.com/ 2. https://aberba.netlify.com/2016/hello-world-app-with-the-vibe.d-web-framework/ 3. https://aberba.netlify.com/2016/form-upload-in-vibe-d/ 4. https://aberba.netlify.com/2017/multiple-file-upload-in-vibe-d/ 5. https://aberba.netlify.com/2018/using-vibe-d-web-interface/
Oct 03 2018