NetTalk Central

Author Topic: How do i serve static information in a dynamic way?  (Read 1526 times)

AvanIeperen

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
How do i serve static information in a dynamic way?
« on: February 15, 2013, 12:45:02 AM »
I have been using NetTalk for a couple years. Until recently i only used it for communication between programs. Now i am taking my first step in the world of web programs. I decided to start with something easy. It's a simple website that contains some pages with static information, no database, no fields, no hassle just a couple of pages with information with maybe an image or two.

After watching webinar episode 19 i built some static html pages added the NetTalk comments just like in the webinar, dumped the pages in the web folder and served it with a NetTalk webserver. This works. Hooray.

Then i watched the NetTalk Webshop recordings. In one of them Bruce said static "'bad" dynamic "'good"'. What would be the best way to put static information in a dynamic website? By best i mean not to much hard work to build and maintain.


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: How do i serve static information in a dynamic way?
« Reply #1 on: February 15, 2013, 02:14:46 AM »
Hi

First I should point out that there's nothing wrong with static pages, if they are indeed static. However if you are embedding browses and forms on a static page then you are better off turning it around and including "static" information on dynamic pages.

There are two common "containers" for dynamic pages. The NetWebPage template and the NetWebForm template. The NetWebForm is the best one for containing other Browses and so on. You can add "static" text using the xHtml tab, embed code, the Display field and so on. You can also use the <!-- Net:f:filename --> tag to include text from a file in the web folder.

Cheers
Bruce




AvanIeperen

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: How do i serve static information in a dynamic way?
« Reply #2 on: February 15, 2013, 02:30:32 AM »
Hi Bruce,

This first project only has a couple of static pages. Future projects will most certainly contain browses and forms and anything else i can think of that can be stored in a database.

If i create a webpage with something like wysysyg builder it creates header, body and footer, basically all the stuff you would need to make it a complete webpage. Can i simply include this in a dynamic page with <!-- Net:f:xxx or would i need to remove things like header and footer?

Cheers,

Adriaan

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: How do i serve static information in a dynamic way?
« Reply #3 on: February 15, 2013, 03:07:31 AM »
If the page has no dynamic content then I'd just leave it as static files in the web folder.

Down the road you'll probably become more comfortable with HTML and so the need for something like Wysiwyg Builder goes away somewhat. That sort of visual designer is actually very bad because it generates bad html, and encourages you into bad habits.

Once you start wanting to create pages in the app using the NetWebPage procedure (as an example) then you can put your own HTML onto the xHtml tab there. If you start small you'll probably get the hang of it.
In the low-numbered examples I think the IndexPage procedure has some examples of this.

There's definitely a learning curve involved here, so it pays to take baby steps and not get too far ahead of yourself.

>> Can i simply include this in a dynamic page with <!-- Net:f:xxx or would i need to remove things like header and footer?

you'd need to remove things - specifically the <head> section, and <body> tags and so on.
If there is CSS or JavaScript in the Head section then that needs to be moved into a custom css file for the app.

cheers
Bruce