NetTalk Central

Author Topic: Advice need on calling html pages based on login information  (Read 5103 times)

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Advice required
When a client logs in I save 3 sessionvalues
  Language   favorite   level

based on these three values I then need to display an HTML page
e.g.
Language - english
favourite - johnny depp
level - gold

I would then display the Johnny Depp gold page in English

What is the best way to do this
What I have done so far is to add a child table to the artist table in which for each of the permutations I store an HTML page so that Johnny Depp has the following attached to his record (pseudocode)
 gold english jdGe.html
 gold afrikaans jdGa.html
 silver english jdSe.html
 etc.

Based on the login sessionvalues I would then know which html page to run.

Advice required:
1. What is the best method of calling the correct html page. I thought of a netwebsource page to be called on closing of the login and then use the sesssion values to read the favourite child file to get the html page name.
How do I then call the HTML page e.g. jdGe.html

2. What the above means is that there are a whole lot of HTML pages which have to be maintained. If there are 50 favourites, 2 languages and 2 levels this comes to 200 fan pages. Is there a way of maintaining say a language page which would then be populated with images, bio information etc. based on the fan choice. If so any pointers are welcomed.
Thanks
Terry Davidson
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Advice need on calling html pages based on login information
« Reply #1 on: June 22, 2010, 04:33:13 AM »
Hi Terry,

You can achieve point 1 by setting the URL on save as a GSV, adding your own Save Button and refreshing that when you determine who is logging in. But as you mention in point 2 I'm no sure that is the best way either.

I would be looking to create some sort of generic page that you can populate with content from your DB. I would extend the DB to store the language, pics etc. I think the key is to create a couple of pages first and work out what fields you need in you DB to handle adding data to the page. There are some cool NTW tags (ref docs) where you can pump data into SSV's (as 1 example) and then embed them in a static page which may give you a better look.

Hopefully that gives you some ideas to explore. Let us know how you get on.

Cheers,

Kevin

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Advice need on calling html pages based on login information
« Reply #2 on: June 22, 2010, 07:18:21 AM »
It seems to me terry that the fan page is really a browse - in the sense that you've got a bunch of data in a table, and you want to display filtered data from that table.

Of course it won't _look_ like a browse - In the same way that http://www.capesoft.com/news.htm
and http://forums.capesoft.com/BrowseTopics?ThisForum=3 don't look like browses.

yes?


terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Advice need on calling html pages based on login information
« Reply #3 on: June 30, 2010, 01:34:55 AM »
Thanks Bruce Kevin
Sorry about the delay in coming back but I have creating the database info that I want to use.
What I would like to achieve is something like 
http://boydell.com.au  (This is a nettalk site (not mine.. I wish)
where the images displayed are in a table and as much possible of the website is database driven, i.e. adding a new house would involve going to the backend program selecting images, typing up a description and it would then be available on the website.
For example
If I have a table with 3 records
field location
web\picture\terry.gif
web\picture\bruce.gif
web\picture\kevin.gif

I would like to look through the table and display the images one after another with a wait between each image display.
Hope this makes sense
Terry Davidson
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Advice need on calling html pages based on login information
« Reply #4 on: June 30, 2010, 03:48:08 AM »
Hi Terry,

I guess i should have a go at answering since http://boydell.com.au is one of mine. If you wanna see a more "full on" version of something like boydell on steroids try http://prdrobina.litehouse.com.au (its not quite finished so you'll see some errors) - but it really does show how far NT can go.

We use a hybrid approach for our "normal" websites (normal being websites that must stack up in terms of visuals and features of public access websites).

We use NetTalk for everything, but specifically, fairly stock NT for site admin, database management, website CMS etc.

However, where is gets different is the visuals of the site. We still build them in HTML/CSS/JS (and sometimes even flash). So we still have to deal with all those issues, however, we use NT and Clarion as our server side language. So i get nice reusable code (even reusable HTML!).

But this approach does take some commitment. We build a layer on top of NetTalk for merging database info into HTML/JS. Not rocket science by any means, just pragmatic. So we extended Bruces <!-- --> syntax with our own.

We also build websites (mostly) for one industry, so we built a lot of functions (think widgets - in website development speak) so we could reuse them.

A complete explanation is probably beyond my ability to explain in a forum, and if i did it again i'd probably do it a little differently.

But i'll have a go at your specific question.

You'll need an ability to read a HTML page from disk and then feed it to the browser via NT. You'll be wanting to change the content of the HTML file as you go (with database and calculated values - think fancy mail merge).

Once you have the above function you can create a NetWebPage (can't be netwebsource) to load a page (say your homepage). It can then make decisions as to what HTML might be loaded and what database values it will have available for merging. Once you get your head around that, you then need to deal with iterations, like the "properties for sale" page. It just requires merging a HTML snippet repeatedly with a HTML header and footer snippet.

If this doesn't make much sense i could show you how i do boydell so you can see code in context with output.

Regards
Bill

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Advice need on calling html pages based on login information
« Reply #5 on: June 30, 2010, 04:15:03 AM »
Hi Terry,

I think i could probably be a bit clearer.

NT has a function <!-- Net:f:filename --> this will read a file (usually HTML) inplace at this position.

It may be suitable, but as you need to make decisions on which file etc it may not be suitable. I don't use it for that reason in my sites (although in hindsight i suspect i may have found a way).

If its not suitable you might just need to write a function that reads a file and outputs it via NT to the browser.

This function can be a normal clarion procedure, but you'll wanna pass it the p_web object.

So in pseudo code:

Openfile
Loop until end of file
  read line of html
  merge any necessary values
  output line to NT
endloop
Closefile


to do "output line to NT" only requires this:

p_web.ParseHTML(packet,1,LEN(CLIP(packet)),NET:NoHeader)

If you do the above, you'll be able to read a file under your own control to browser via NT. You'll also be able to decide which file to read. Plus you could put symbols inside HTML that correspond to database fields, macros or simple algorithms eg [UPPER(CUS:Name)] or even [CHOOSE(ORD:Quantity=0','None','FORMAT(ORD:Quantity,@n-18.2))].

Once you do the above, your next problem is to create a NetWebPage that makes appropriate decisions and calls the right HMTL files. In summary stick some code in the embed point Procedded Code [Priority 4000]. Read your variables, make decisions, load & merge HTML/JS and your done.

Regards
Bill


terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Advice need on calling html pages based on login information
« Reply #6 on: July 01, 2010, 01:57:24 AM »
Thanks Bill for taking the time to respond.
I think your websites are really great, Gives me something to aspire to  :)
I'll definitely have a go at using your suggestions and tips over the weekend.
In my mind I keep on trying to relate NT5 to what I can do in Clarion which is probably a mistake but if it ever becomes possible the ASP and .NET guys better watch out, we'll eat them alive.
The reason I want to do it this way is that I could be involved in more than 300 hundred artist pages with 5 or 6 subsidiary linked pages with the concommitent aggravation of changing page information, images etc in the HTML code (and adding new HTML pages for new artists)
First prize would be a totally database driven website where changing the management information would  immediately change the way the information is displayed. Probably unattainable but the more I can do the better.
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186